blob: 618c71fc6583e2f9cee7aa30635643b7d9697760 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Selvaraj, Sridhara9545d92016-06-08 17:38:20 +05302 * Copyright (c) 2012-2016 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"
57
58
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
163
164/**
165 * limSendSmeJoinReassocRspAfterResume()
166 *
167 *FUNCTION:
168 * This function is called to send Join/Reassoc rsp
169 * message to SME after the resume link.
170 *
171 *PARAMS:
172 *
173 *LOGIC:
174 *
175 *ASSUMPTIONS:
176 * NA
177 *
178 *NOTE:
179 * NA
180 *
181 * @param pMac Pointer to Global MAC structure
182 * @param status Resume link status
183 * @param ctx context passed while calling resmune link.
184 * (join response to be sent)
185 *
186 * @return None
187 */
188static void limSendSmeJoinReassocRspAfterResume( tpAniSirGlobal pMac,
189 eHalStatus status, tANI_U32 *ctx)
190{
191 tSirMsgQ mmhMsg;
192 tpSirSmeJoinRsp pSirSmeJoinRsp = (tpSirSmeJoinRsp) ctx;
193
194 mmhMsg.type = pSirSmeJoinRsp->messageType;
195 mmhMsg.bodyptr = pSirSmeJoinRsp;
196 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530197 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700198 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
199}
200
c_hpothu44ff4e02014-05-08 00:13:57 +0530201/**
202 * limGetMaxRateFlags()
203 *
204 *FUNCTION:
205 *This function is called by limSendSmeJoinReassocRsp get rateFlags.
206 *These rateflags are used when MAX link-speed need to be reported
207 *to UI.
208 *
209 *PARAMS:
210 * @param pStaDs - Pointer to internal STA Datastructure
211 * @param psessionEntry - Pointer to the session entry
212 *
213 *LOGIC:
214 *
215 *ASSUMPTIONS:
216 *
217 *NOTE:
218 *
219 * @return rateFlags
220 */
221tANI_U32 limGetMaxRateFlags(tpDphHashNode pStaDs, tpPESession psessionEntry)
222{
223 tANI_U32 rate_flags = 0;
224
225 if (NULL == psessionEntry)
226 {
227 return rate_flags;
228 }
229
230 if(!IS_DOT11_MODE_HT(psessionEntry->dot11mode) &&
231 !IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
232 {
233 rate_flags |= eHAL_TX_RATE_LEGACY;
234 }
235 else
236 {
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530237 if (IS_DOT11_MODE_HT(psessionEntry->dot11mode)
238#ifdef WLAN_FEATURE_11AC
239 || IS_DOT11_MODE_VHT(psessionEntry->dot11mode)
240 )
241#endif
c_hpothu44ff4e02014-05-08 00:13:57 +0530242 {
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530243 if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz)
244 rate_flags |= eHAL_TX_RATE_SGI;
c_hpothu44ff4e02014-05-08 00:13:57 +0530245 }
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530246
c_hpothu44ff4e02014-05-08 00:13:57 +0530247#ifdef WLAN_FEATURE_11AC
248 if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode))
249 {
c_hpothud65d2182014-06-06 21:18:17 +0530250 if (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ ==
251 pStaDs->vhtSupportedChannelWidthSet)
252 {
c_hpothu44ff4e02014-05-08 00:13:57 +0530253 rate_flags |= eHAL_TX_RATE_VHT80;
c_hpothud65d2182014-06-06 21:18:17 +0530254 }
255 else if(WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ ==
256 pStaDs->vhtSupportedChannelWidthSet)
257 {
258 if (eHT_CHANNEL_WIDTH_40MHZ ==
259 pStaDs->htSupportedChannelWidthSet)
260 rate_flags |= eHAL_TX_RATE_VHT40;
261 else
262 rate_flags |= eHAL_TX_RATE_VHT20;
263 }
c_hpothu44ff4e02014-05-08 00:13:57 +0530264 }
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530265 else
c_hpothu44ff4e02014-05-08 00:13:57 +0530266#endif
Arun Khandavallic9bb4872015-12-08 19:22:30 +0530267 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
268 {
269 if (pStaDs->htSupportedChannelWidthSet)
270 rate_flags |=eHAL_TX_RATE_HT40;
271 else
272 rate_flags |=eHAL_TX_RATE_HT20;
273 }
c_hpothu44ff4e02014-05-08 00:13:57 +0530274 }
275
276 return rate_flags;
277}
Jeff Johnson295189b2012-06-20 16:38:30 -0700278
279/**
280 * limSendSmeJoinReassocRsp()
281 *
282 *FUNCTION:
283 * This function is called by limProcessSmeReqMessages() to send
284 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
285 * above MAC Software.
286 *
287 *PARAMS:
288 *
289 *LOGIC:
290 *
291 *ASSUMPTIONS:
292 * NA
293 *
294 *NOTE:
295 * NA
296 *
297 * @param pMac Pointer to Global MAC structure
298 * @param msgType Indicates message type
299 * @param resultCode Indicates the result of previously issued
300 * eWNI_SME_msgType_REQ message
301 *
302 * @return None
303 */
304
305void
306limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
307 tSirResultCodes resultCode, tANI_U16 protStatusCode,
308 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
309{
310 tpSirSmeJoinRsp pSirSmeJoinRsp;
311 tANI_U32 rspLen;
312 tpDphHashNode pStaDs = NULL;
313
314#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
315 if (msgType == eWNI_SME_REASSOC_RSP)
316 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
317 else
318 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
319#endif //FEATURE_WLAN_DIAG_SUPPORT
320
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530321 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700322 FL("Sending message %s with reasonCode %s"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530323 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700324
325 if(psessionEntry == NULL)
326 {
327
328 rspLen = sizeof(tSirSmeJoinRsp);
329
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530330 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
331 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 {
333 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530334 limLog(pMac, LOGP, FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 return;
336 }
337
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530338 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700339
340
341 pSirSmeJoinRsp->beaconLength = 0;
342 pSirSmeJoinRsp->assocReqLength = 0;
343 pSirSmeJoinRsp->assocRspLength = 0;
344 }
345
346 else
347 {
348 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
349 psessionEntry->bcnLen +
350#ifdef WLAN_FEATURE_VOWIFI_11R
351 psessionEntry->RICDataLen +
352#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800353#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 psessionEntry->tspecLen +
355#endif
356 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530357
358 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
359 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700360 {
361 /// Buffer not available. Log error
362 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530363 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 return;
366 }
367
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530368 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700369
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 if (resultCode == eSIR_SME_SUCCESS)
371 {
372 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
373 if (pStaDs == NULL)
374 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700375 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 }
377 else
378 {
Jeff Johnson62c27982013-02-27 17:53:55 -0800379 //Pass the peer's staId
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 pSirSmeJoinRsp->staId = pStaDs->staIndex;
Jeff Johnson62c27982013-02-27 17:53:55 -0800381 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
382 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
c_hpothu44ff4e02014-05-08 00:13:57 +0530383 pSirSmeJoinRsp->maxRateFlags =
384 limGetMaxRateFlags(pStaDs, psessionEntry);
385 PELOGE(limLog(pMac, LOG1, FL("maxRateFlags: %x"),
386 pSirSmeJoinRsp->maxRateFlags);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 }
388 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
390 pSirSmeJoinRsp->beaconLength = 0;
391 pSirSmeJoinRsp->assocReqLength = 0;
392 pSirSmeJoinRsp->assocRspLength = 0;
393#ifdef WLAN_FEATURE_VOWIFI_11R
394 pSirSmeJoinRsp->parsedRicRspLen = 0;
395#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800396#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 pSirSmeJoinRsp->tspecIeLen = 0;
398#endif
399
400 if(resultCode == eSIR_SME_SUCCESS)
401 {
402
403 if(psessionEntry->beacon != NULL)
404 {
405 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530406 vos_mem_copy( pSirSmeJoinRsp->frames, psessionEntry->beacon,
407 pSirSmeJoinRsp->beaconLength);
408 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 psessionEntry->beacon = NULL;
410#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700411 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d"), psessionEntry->bcnLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700412#endif
413 }
414
415 if(psessionEntry->assocReq != NULL)
416 {
417 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530418 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen,
419 psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
420 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 psessionEntry->assocReq = NULL;
422#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700423 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d"), psessionEntry->assocReqLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700424#endif
425 }
426 if(psessionEntry->assocRsp != NULL)
427 {
428 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530429 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
430 psessionEntry->assocReqLen,
431 psessionEntry->assocRsp,
432 pSirSmeJoinRsp->assocRspLength);
433 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 psessionEntry->assocRsp = NULL;
435 }
436#ifdef WLAN_FEATURE_VOWIFI_11R
437 if(psessionEntry->ricData != NULL)
438 {
439 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530440 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
441 psessionEntry->assocReqLen + psessionEntry->assocRspLen,
442 psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
443 vos_mem_free(psessionEntry->ricData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 psessionEntry->ricData = NULL;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700445 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 }
447#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800448#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 if(psessionEntry->tspecIes != NULL)
450 {
451 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530452 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
453 psessionEntry->assocReqLen + psessionEntry->assocRspLen +
454 psessionEntry->RICDataLen,
455 psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
456 vos_mem_free(psessionEntry->tspecIes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 psessionEntry->tspecIes = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800458 PELOG1(limLog(pMac, LOG1, FL("ESE-TspecLen=%d"), psessionEntry->tspecLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 }
460#endif
461 pSirSmeJoinRsp->aid = psessionEntry->limAID;
462#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700463 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d"), psessionEntry->assocRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700464#endif
465 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700466 else
467 {
468
469 if(psessionEntry->beacon != NULL)
470 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530471 vos_mem_free(psessionEntry->beacon);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700472 psessionEntry->beacon = NULL;
473 }
474
475 if(psessionEntry->assocReq != NULL)
476 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530477 vos_mem_free( psessionEntry->assocReq);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700478 psessionEntry->assocReq = NULL;
479 }
480
481 if(psessionEntry->assocRsp != NULL)
482 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530483 vos_mem_free( psessionEntry->assocRsp);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700484 psessionEntry->assocRsp = NULL;
485 }
Deepthi Gowri241fac32015-04-23 14:27:15 +0530486#ifdef WLAN_FEATURE_VOWIFI_11R
487 if(psessionEntry->ricData != NULL)
488 {
489 vos_mem_free( psessionEntry->ricData);
490 psessionEntry->ricData = NULL;
491 }
492#endif
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700493
Deepthi Gowri241fac32015-04-23 14:27:15 +0530494#ifdef FEATURE_WLAN_ESE
495 if(psessionEntry->tspecIes != NULL)
496 {
497 vos_mem_free(psessionEntry->tspecIes);
498 psessionEntry->tspecIes = NULL;
499 }
500#endif
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700501 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 }
503
504
505 pSirSmeJoinRsp->messageType = msgType;
506 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
507 pSirSmeJoinRsp->statusCode = resultCode;
508 pSirSmeJoinRsp->protStatusCode = protStatusCode;
509
510 /* Update SME session ID and transaction Id */
511 pSirSmeJoinRsp->sessionId = smesessionId;
512 pSirSmeJoinRsp->transactionId = smetransactionId;
513
514 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
515 {
516 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
517 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700518
519#ifdef WLAN_FEATURE_11AC
520 if (psessionEntry->vhtCapability)
521 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700522 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700523 /*Get 11ac cbState from 11n cbState*/
524 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
525 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700526 psessionEntry->htSecondaryChannelOffset,
527 psessionEntry->apCenterChan,
528 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700529 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
530 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700531 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700532#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700533 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 }
535 else
536 {
537 peSetResumeChannel( pMac, 0, 0);
538 }
539 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
540 (tANI_U32*) pSirSmeJoinRsp );
541 }
542 else
543 {
544 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
545 (tANI_U32*) pSirSmeJoinRsp );
546 }
547} /*** end limSendSmeJoinReassocRsp() ***/
548
549
Jeff Johnson295189b2012-06-20 16:38:30 -0700550/**
551 * limSendSmeStartBssRsp()
552 *
553 *FUNCTION:
554 * This function is called to send eWNI_SME_START_BSS_RSP
555 * message to applications above MAC Software.
556 *
557 *PARAMS:
558 *
559 *LOGIC:
560 *
561 *ASSUMPTIONS:
562 * NA
563 *
564 *NOTE:
565 * NA
566 *
567 * @param pMac Pointer to Global MAC structure
568 * @param msgType Indicates message type
569 * @param resultCode Indicates the result of previously issued
570 * eWNI_SME_msgType_REQ message
571 *
572 * @return None
573 */
574
575void
576limSendSmeStartBssRsp(tpAniSirGlobal pMac,
577 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
578 tANI_U8 smesessionId,tANI_U16 smetransactionId)
579{
580
581
582 tANI_U16 size = 0;
583 tSirMsgQ mmhMsg;
584 tSirSmeStartBssRsp *pSirSmeRsp;
585 tANI_U16 ieLen;
586 tANI_U16 ieOffset, curLen;
587
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530588 limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
589 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
591 size = sizeof(tSirSmeStartBssRsp);
592
593 if(psessionEntry == NULL)
594 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530595 pSirSmeRsp = vos_mem_malloc(size);
596 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 {
598 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530599 limLog(pMac, LOGP,FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 return;
601 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530602 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700603
604 }
605 else
606 {
607 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
608 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
609 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
610 //calculate the memory size to allocate
611 size += ieLen;
612
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530613 pSirSmeRsp = vos_mem_malloc(size);
614 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 {
616 /// Buffer not available. Log error
617 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530618 FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700619
620 return;
621 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530622 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 size = sizeof(tSirSmeStartBssRsp);
624 if (resultCode == eSIR_SME_SUCCESS)
625 {
626
627 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
628
629 /* Read beacon interval from session */
630 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
631 pSirSmeRsp->bssType = psessionEntry->bssType;
632
633 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
634 != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700635 limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700636
637 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
638
639#if 0
640 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700641 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700642
643#endif// TO SUPPORT BT-AMP
644
645 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
646
647 pSirSmeRsp->bssDescription.aniIndicator = 1;
648
649 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530650 vos_mem_copy( (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
652 (tANI_U32)curLen);
653
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530654 vos_mem_copy( ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 pMac->sch.schObject.gSchBeaconFrameEnd,
656 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
657
658
659 //subtracting size of length indicator itself and size of pointer to ieFields
660 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
661 sizeof(tANI_U16) - sizeof(tANI_U32) +
662 ieLen;
663 //This is the size of the message, subtracting the size of the pointer to ieFields
664 size += ieLen - sizeof(tANI_U32);
665 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 }
667
668 pSirSmeRsp->messageType = msgType;
669 pSirSmeRsp->length = size;
670
671 /* Update SME session Id and transaction Id */
672 pSirSmeRsp->sessionId = smesessionId;
673 pSirSmeRsp->transactionId = smetransactionId;
674 pSirSmeRsp->statusCode = resultCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 if(psessionEntry != NULL )
676 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
677
Jeff Johnson295189b2012-06-20 16:38:30 -0700678
679 mmhMsg.type = msgType;
680 mmhMsg.bodyptr = pSirSmeRsp;
681 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800682 if(psessionEntry == NULL)
683 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530684 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800685 }
686 else
687 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530688 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
689 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800690 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700691#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
692 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
693#endif //FEATURE_WLAN_DIAG_SUPPORT
694
695 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
696} /*** end limSendSmeStartBssRsp() ***/
697
Jeff Johnson295189b2012-06-20 16:38:30 -0700698#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
699#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
700
701
702/**
703 * limSendSmeScanRsp()
704 *
705 *FUNCTION:
706 * This function is called by limProcessSmeReqMessages() to send
707 * eWNI_SME_SCAN_RSP message to applications above MAC
708 * Software.
709 *
710 *PARAMS:
711 *
712 *LOGIC:
713 *
714 *ASSUMPTIONS:
715 * NA
716 *
717 *NOTE:
718 * NA
719 *
720 * @param pMac Pointer to Global MAC structure
721 * @param length Indicates length of message
722 * @param resultCode Indicates the result of previously issued
723 * eWNI_SME_SCAN_REQ message
724 *
725 * @return None
726 */
727
728void
729limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
730 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
731{
732 tSirMsgQ mmhMsg;
733 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
734 tLimScanResultNode *ptemp = NULL;
735 tANI_U16 msgLen, allocLength, curMsgLen = 0;
736 tANI_U16 i, bssCount;
737 tANI_U8 *pbBuf;
738 tSirBssDescription *pDesc;
739
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 if (resultCode != eSIR_SME_SUCCESS)
741 {
742 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
743 return;
744 }
745
746 mmhMsg.type = eWNI_SME_SCAN_RSP;
747 i = 0;
748 bssCount = 0;
749 msgLen = 0;
750 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530751 pSirSmeScanRsp = vos_mem_malloc(allocLength);
752 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 {
754 // Log error
755 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530756 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700757
758 return;
759 }
760 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
761 {
762 //when ptemp is not NULL it is a left over
763 ptemp = pMac->lim.gLimCachedScanHashTable[i];
764 while(ptemp)
765 {
766 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
767 if(0 == bssCount)
768 {
769 msgLen = sizeof(tSirSmeScanRsp) -
770 sizeof(tSirBssDescription) +
771 ptemp->bssDescription.length +
772 sizeof(ptemp->bssDescription.length);
773 pDesc = pSirSmeScanRsp->bssDescription;
774 }
775 else
776 {
777 msgLen += ptemp->bssDescription.length +
778 sizeof(ptemp->bssDescription.length);
779 pDesc = (tSirBssDescription *)pbBuf;
780 }
781 if( (allocLength < msgLen) ||
782 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
783 {
784 pSirSmeScanRsp->statusCode =
785 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
787 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700788 mmhMsg.bodyptr = pSirSmeScanRsp;
789 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530790 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
791 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530793 pSirSmeScanRsp = vos_mem_malloc(allocLength);
794 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 {
796 // Log error
797 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530798 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700799 return;
800 }
801 msgLen = sizeof(tSirSmeScanRsp) -
802 sizeof(tSirBssDescription) +
803 ptemp->bssDescription.length +
804 sizeof(ptemp->bssDescription.length);
805 pDesc = pSirSmeScanRsp->bssDescription;
806 bssCount = 1;
807 }
808 curMsgLen = msgLen;
809
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 pDesc->length
811 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530812 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
813 (tANI_U8 *) &ptemp->bssDescription.bssId,
814 ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 pSirSmeScanRsp->sessionId = smesessionId;
817 pSirSmeScanRsp->transcationId = smetranscationId;
818
819 ptemp = ptemp->next;
820 } //while(ptemp)
821 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
822
823 if(0 == bssCount)
824 {
825 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700826 if (NULL != pSirSmeScanRsp)
827 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530828 vos_mem_free( pSirSmeScanRsp);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700829 pSirSmeScanRsp = NULL;
830 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 }
832 else
833 {
Deepthi Gowri639d5042015-11-16 20:23:39 +0530834#ifdef FEATURE_WLAN_DIAG_SUPPORT
835 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT, NULL,
836 eSIR_SUCCESS, eSIR_SUCCESS);
837#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 // send last message
839 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
841 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700842
843 /* Update SME session Id and SME transcation Id */
844 pSirSmeScanRsp->sessionId = smesessionId;
845 pSirSmeScanRsp->transcationId = smetranscationId;
846
847 mmhMsg.type = eWNI_SME_SCAN_RSP;
848 mmhMsg.bodyptr = pSirSmeScanRsp;
849 mmhMsg.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Abhishek Singh525045c2014-12-15 17:18:45 +0530851 limLog(pMac, LOG1, FL("statusCode : eSIR_SME_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 }
853
854 return;
855
856} /*** end limSendSmeScanRsp() ***/
857
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700858#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
859/**
860 * limSendSmeLfrScanRsp()
861 *
862 *FUNCTION:
863 * This function is called by limProcessSmeReqMessages() to send
864 * eWNI_SME_SCAN_RSP message to applications above MAC Software
865 * only for sending up the roam candidates.
866 *
867 *PARAMS:
868 *
869 *LOGIC:
870 *
871 *ASSUMPTIONS:
872 * NA
873 *
874 *NOTE:
875 * NA
876 *
877 * @param pMac Pointer to Global MAC structure
878 * @param length Indicates length of message
879 * @param resultCode Indicates the result of previously issued
880 * eWNI_SME_SCAN_REQ message
881 *
882 * @return None
883 */
884
885void
886limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
887 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
888{
889 tSirMsgQ mmhMsg;
890 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
891 tLimScanResultNode *ptemp = NULL;
892 tANI_U16 msgLen, allocLength, curMsgLen = 0;
893 tANI_U16 i, bssCount;
894 tANI_U8 *pbBuf;
895 tSirBssDescription *pDesc;
896
897 PELOG1(limLog(pMac, LOG1,
898 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
899 length, limResultCodeStr(resultCode));)
900
901 if (resultCode != eSIR_SME_SUCCESS)
902 {
903 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
904 return;
905 }
906
907 mmhMsg.type = eWNI_SME_SCAN_RSP;
908 i = 0;
909 bssCount = 0;
910 msgLen = 0;
911 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530912 pSirSmeScanRsp = vos_mem_malloc(allocLength);
913 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700914 {
915 // Log error
916 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530917 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700918
919 return;
920 }
921 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
922 {
923 //when ptemp is not NULL it is a left over
924 ptemp = pMac->lim.gLimCachedLfrScanHashTable[i];
925 while(ptemp)
926 {
927 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
928 if(0 == bssCount)
929 {
930 msgLen = sizeof(tSirSmeScanRsp) -
931 sizeof(tSirBssDescription) +
932 ptemp->bssDescription.length +
933 sizeof(ptemp->bssDescription.length);
934 pDesc = pSirSmeScanRsp->bssDescription;
935 }
936 else
937 {
938 msgLen += ptemp->bssDescription.length +
939 sizeof(ptemp->bssDescription.length);
940 pDesc = (tSirBssDescription *)pbBuf;
941 }
942 if ( (allocLength < msgLen) ||
943 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
944 {
945 pSirSmeScanRsp->statusCode =
946 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
947 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
948 pSirSmeScanRsp->length = curMsgLen;
949 mmhMsg.bodyptr = pSirSmeScanRsp;
950 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +0530951 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
952 mmhMsg.type));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700953 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530954 pSirSmeScanRsp = vos_mem_malloc(allocLength);
955 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700956 {
957 // Log error
958 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530959 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700960 return;
961 }
962 msgLen = sizeof(tSirSmeScanRsp) -
963 sizeof(tSirBssDescription) +
964 ptemp->bssDescription.length +
965 sizeof(ptemp->bssDescription.length);
966 pDesc = pSirSmeScanRsp->bssDescription;
967 bssCount = 1;
968 }
969 curMsgLen = msgLen;
970
971 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
972 msgLen, ptemp->bssDescription.length);)
973 pDesc->length
974 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530975 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
976 (tANI_U8 *) &ptemp->bssDescription.bssId,
977 ptemp->bssDescription.length);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700978
979 PELOG2(limLog(pMac, LOG2, FL("BssId "));
980 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
981
982 pSirSmeScanRsp->sessionId = smesessionId;
983 pSirSmeScanRsp->transcationId = smetranscationId;
984
985 ptemp = ptemp->next;
986 } //while(ptemp)
987 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
988
989 if (0 == bssCount)
990 {
991 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
992 if (NULL != pSirSmeScanRsp)
993 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530994 vos_mem_free( pSirSmeScanRsp);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700995 pSirSmeScanRsp = NULL;
996 }
997 }
998 else
999 {
1000 // send last message
1001 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
1002 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1003 pSirSmeScanRsp->length = curMsgLen;
1004
1005 /* Update SME session Id and SME transcation Id */
1006 pSirSmeScanRsp->sessionId = smesessionId;
1007 pSirSmeScanRsp->transcationId = smetranscationId;
1008
1009 mmhMsg.type = eWNI_SME_SCAN_RSP;
1010 mmhMsg.bodyptr = pSirSmeScanRsp;
1011 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301012 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001013 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1014 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
1015 }
1016
1017 return;
1018
1019} /*** end limSendSmeLfrScanRsp() ***/
1020#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001021
1022/**
1023 * limPostSmeScanRspMessage()
1024 *
1025 *FUNCTION:
1026 * This function is called by limSendSmeScanRsp() to send
1027 * eWNI_SME_SCAN_RSP message with failed result code
1028 *
1029 *NOTE:
1030 * NA
1031 *
1032 * @param pMac Pointer to Global MAC structure
1033 * @param length Indicates length of message
1034 * @param resultCode failed result code
1035 *
1036 * @return None
1037 */
1038
1039void
1040limPostSmeScanRspMessage(tpAniSirGlobal pMac,
1041 tANI_U16 length,
1042 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1043{
1044 tpSirSmeScanRsp pSirSmeScanRsp;
1045 tSirMsgQ mmhMsg;
1046
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301047 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001048 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301049 length, limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -07001050
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301051 pSirSmeScanRsp = vos_mem_malloc(length);
1052 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301054 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 return;
1056 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301057 vos_mem_set((void*)pSirSmeScanRsp, length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001058
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1060 pSirSmeScanRsp->length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -07001061
1062 if(sizeof(tSirSmeScanRsp) <= length)
1063 {
1064 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
1065 }
1066
1067 pSirSmeScanRsp->statusCode = resultCode;
1068
1069 /*Update SME session Id and transaction Id */
1070 pSirSmeScanRsp->sessionId = smesessionId;
1071 pSirSmeScanRsp->transcationId = smetransactionId;
1072
1073 mmhMsg.type = eWNI_SME_SCAN_RSP;
1074 mmhMsg.bodyptr = pSirSmeScanRsp;
1075 mmhMsg.bodyval = 0;
1076
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301077 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001078#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1079 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
1080#endif //FEATURE_WLAN_DIAG_SUPPORT
1081
1082 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1083 return;
1084
1085} /*** limPostSmeScanRspMessage ***/
1086
Jeff Johnsone7245742012-09-05 17:12:55 -07001087#ifdef FEATURE_OEM_DATA_SUPPORT
1088
1089/**
1090 * limSendSmeOemDataRsp()
1091 *
1092 *FUNCTION:
1093 * This function is called by limProcessSmeReqMessages() to send
1094 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
1095 * Software.
1096 *
1097 *PARAMS:
1098 *
1099 *LOGIC:
1100 *
1101 *ASSUMPTIONS:
1102 * NA
1103 *
1104 *NOTE:
1105 * NA
1106 *
1107 * @param pMac Pointer to Global MAC structure
1108 * @param pMsgBuf Indicates the mlm message
1109 * @param resultCode Indicates the result of previously issued
1110 * eWNI_SME_OEM_DATA_RSP message
1111 *
1112 * @return None
1113 */
1114
1115void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
1116{
1117 tSirMsgQ mmhMsg;
1118 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
1119 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
1120 tANI_U16 msgLength;
1121
1122
1123 //get the pointer to the mlm message
1124 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
1125
1126 msgLength = sizeof(tSirOemDataRsp);
1127
1128 //now allocate memory for the char buffer
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301129 pSirSmeOemDataRsp = vos_mem_malloc(msgLength);
1130 if (NULL == pSirSmeOemDataRsp)
Jeff Johnsone7245742012-09-05 17:12:55 -07001131 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301132 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSirSmeOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001133 return;
1134 }
1135
1136#if defined (ANI_LITTLE_BYTE_ENDIAN)
1137 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
1138 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
1139#else
1140 pSirSmeOemDataRsp->length = msgLength;
1141 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
1142#endif
1143
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301144 vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001145
1146 //Now free the memory from MLM Rsp Message
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301147 vos_mem_free(pMlmOemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001148
1149 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
1150 mmhMsg.bodyptr = pSirSmeOemDataRsp;
1151 mmhMsg.bodyval = 0;
1152
1153 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1154
1155 return;
1156} /*** limSendSmeOemDataRsp ***/
1157
1158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001159
1160
1161/**
1162 * limSendSmeAuthRsp()
1163 *
1164 *FUNCTION:
1165 * This function is called by limProcessSmeMessages() to send
1166 * eWNI_SME_AUTH_RSP message to host
1167 *
1168 *PARAMS:
1169 *
1170 *LOGIC:
1171 *
1172 *ASSUMPTIONS:
1173 * NA
1174 *
1175 *NOTE:
1176 * NA
1177 *
1178 * @param pMac Pointer to Global MAC structure
1179 * @param statusCode Indicates the result of previously issued
1180 * eWNI_SME_AUTH_REQ message
1181 *
1182 * @return None
1183 */
1184void
1185limSendSmeAuthRsp(tpAniSirGlobal pMac,
1186 tSirResultCodes statusCode,
1187 tSirMacAddr peerMacAddr,
1188 tAniAuthType authType,
1189 tANI_U16 protStatusCode,
1190 tpPESession psessionEntry,tANI_U8 smesessionId,
1191 tANI_U16 smetransactionId)
1192{
1193#if 0
1194 tSirMsgQ mmhMsg;
1195 tSirSmeAuthRsp *pSirSmeAuthRsp;
1196
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301197 pSirSmeAuthRsp = vos_mem_malloc(sizeof(tSirSmeAuthRsp));
1198 if (NULL == pSirSmeAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 {
1200 // Log error
1201 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301202 FL("call to AllocateMemory failed for eWNI_SME_AUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001203
1204 return;
1205 }
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207
1208
1209 if(psessionEntry != NULL)
1210 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301211 vos_mem_copy( (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1213 pSirSmeAuthRsp->authType = authType;
1214
1215 }
1216
1217 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1218 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1219 pSirSmeAuthRsp->statusCode = statusCode;
1220 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1221
1222 /* Update SME session and transaction Id*/
1223 pSirSmeAuthRsp->sessionId = smesessionId;
1224 pSirSmeAuthRsp->transactionId = smetransactionId;
1225
1226 mmhMsg.type = eWNI_SME_AUTH_RSP;
1227 mmhMsg.bodyptr = pSirSmeAuthRsp;
1228 mmhMsg.bodyval = 0;
1229 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1230 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1231#endif
1232} /*** end limSendSmeAuthRsp() ***/
1233
1234
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001235void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 eHalStatus status, tANI_U32 *pCtx )
1237{
1238 tSirMsgQ mmhMsg;
1239 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1240
1241 mmhMsg.type = pMsg->type;
1242 mmhMsg.bodyptr = pMsg;
1243 mmhMsg.bodyval = 0;
1244
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301245 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001246
1247 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1248}
1249/**
1250 * limSendSmeDisassocNtf()
1251 *
1252 *FUNCTION:
1253 * This function is called by limProcessSmeMessages() to send
1254 * eWNI_SME_DISASSOC_RSP/IND message to host
1255 *
1256 *PARAMS:
1257 *
1258 *LOGIC:
1259 *
1260 *ASSUMPTIONS:
1261 * NA
1262 *
1263 *NOTE:
1264 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1265 * or eWNI_SME_DISASSOC_IND to host depending on
1266 * disassociation trigger.
1267 *
1268 * @param peerMacAddr Indicates the peer MAC addr to which
1269 * disassociate was initiated
1270 * @param reasonCode Indicates the reason for Disassociation
1271 * @param disassocTrigger Indicates the trigger for Disassociation
1272 * @param aid Indicates the STAID. This parameter is
1273 * present only on AP.
1274 *
1275 * @return None
1276 */
1277void
1278limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1279 tSirMacAddr peerMacAddr,
1280 tSirResultCodes reasonCode,
1281 tANI_U16 disassocTrigger,
1282 tANI_U16 aid,
1283 tANI_U8 smesessionId,
1284 tANI_U16 smetransactionId,
1285 tpPESession psessionEntry)
1286{
1287
1288 tANI_U8 *pBuf;
1289 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1290 tSirSmeDisassocInd *pSirSmeDisassocInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301291 tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 tANI_U32 *pMsg;
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301293 bool failure = FALSE;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301294
1295 limLog(pMac, LOG1, FL("Disassoc Ntf with trigger : %d"
1296 "reasonCode: %d"),
1297 disassocTrigger,
1298 reasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300 switch (disassocTrigger)
1301 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 case eLIM_HOST_DISASSOC:
1303 /**
1304 * Disassociation response due to
1305 * host triggered disassociation
1306 */
1307
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301308 pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
1309 if ( NULL == pSirSmeDisassocRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 {
1311 // Log error
1312 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301313 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301314 failure = TRUE;
1315 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301317 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
Abhishek Singhcd09b562013-12-24 16:02:20 +05301318 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1319 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1321 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 //sessionId
1323 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1324 *pBuf = smesessionId;
1325 pBuf++;
1326
1327 //transactionId
1328 limCopyU16(pBuf, smetransactionId);
1329 pBuf += sizeof(tANI_U16);
1330
1331 //statusCode
1332 limCopyU32(pBuf, reasonCode);
1333 pBuf += sizeof(tSirResultCodes);
1334
1335 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301336 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 pBuf += sizeof(tSirMacAddr);
1338
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 // Clear Station Stats
1340 //for sta, it is always 1, IBSS is handled at halInitSta
1341
Jeff Johnson295189b2012-06-20 16:38:30 -07001342
1343
1344#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301345
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1347 psessionEntry, (tANI_U16)reasonCode, 0);
1348#endif
1349 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1350 break;
1351
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301352 case eLIM_PEER_ENTITY_DISASSOC:
1353 case eLIM_LINK_MONITORING_DISASSOC:
1354 pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
1355 if ( NULL == pSirSmeDisConDoneInd )
1356 {
1357 // Log error
1358 limLog(pMac, LOGP,
1359 FL("call to AllocateMemory failed for disconnect indication"));
1360
1361 return;
1362 }
1363 vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
1364 limLog(pMac, LOG1,
1365 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1366 reasonCode);
1367 pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
1368 pSirSmeDisConDoneInd->length = sizeof(tSirSmeDisConDoneInd);
1369 vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
1370 sizeof(tSirMacAddr));
1371 pSirSmeDisConDoneInd->sessionId = smesessionId;
Selvaraj, Sridhara9545d92016-06-08 17:38:20 +05301372
1373 if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
1374 pSirSmeDisConDoneInd->reasonCode = 0;
1375 else
1376 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1377
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301378 pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
1379 break;
1380
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 default:
1382 /**
1383 * Disassociation indication due to Disassociation
1384 * frame reception from peer entity or due to
1385 * loss of link with peer entity.
1386 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301387 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1388 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 {
1390 // Log error
1391 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301392 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001393
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301394 failure = TRUE;
1395 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301397 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1398 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1399 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1401 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1402
1403 /* Update SME session Id and Transaction Id */
1404 pSirSmeDisassocInd->sessionId = smesessionId;
1405 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001406 pSirSmeDisassocInd->reasonCode = reasonCode;
Wu Gao742b7352015-10-16 19:10:40 +08001407 pSirSmeDisassocInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1409
1410 limCopyU32(pBuf, reasonCode);
1411 pBuf += sizeof(tSirResultCodes);
1412
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301413 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 pBuf += sizeof(tSirMacAddr);
1415
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301416 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001417
1418
1419#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1420 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1421 psessionEntry, (tANI_U16)reasonCode, 0);
1422#endif
1423 pMsg = (tANI_U32*) pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001424
1425 break;
1426 }
1427
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301428error:
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 /* Delete the PE session Created */
1430 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1431 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1432 {
1433 peDeleteSession(pMac,psessionEntry);
1434 }
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301435 if (failure == FALSE)
1436 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1437 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001438} /*** end limSendSmeDisassocNtf() ***/
1439
1440
1441/** -----------------------------------------------------------------
1442 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1443
1444 After receiving disassociation frame from peer entity, this
1445 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1446 reason code.
1447
1448 \param pMac - global mac structure
1449 \param pStaDs - station dph hash node
1450 \return none
1451 \sa
1452 ----------------------------------------------------------------- */
1453void
1454limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1455{
1456 tSirMsgQ mmhMsg;
1457 tSirSmeDisassocInd *pSirSmeDisassocInd;
1458
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301459 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1460 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301462 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 return;
1464 }
1465
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1467 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001468
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1470 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
Padma, Santhosh Kumar95eaa7b2016-09-01 19:11:16 +05301471 pSirSmeDisassocInd->statusCode = eSIR_SME_DEAUTH_STATUS;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001472 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Wu Gao742b7352015-10-16 19:10:40 +08001473 pSirSmeDisassocInd->assocId = pStaDs->assocId;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301474
1475 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1476
1477 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001478
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301480
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1482 mmhMsg.bodyptr = pSirSmeDisassocInd;
1483 mmhMsg.bodyval = 0;
1484
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301485 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1486 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001487#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1488 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1489#endif //FEATURE_WLAN_DIAG_SUPPORT
1490
1491 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1492
1493} /*** end limSendSmeDisassocInd() ***/
1494
1495
1496/** -----------------------------------------------------------------
1497 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1498
1499 After receiving deauthentication frame from peer entity, this
1500 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1501 reason code.
1502
1503 \param pMac - global mac structure
1504 \param pStaDs - station dph hash node
1505 \return none
1506 \sa
1507 ----------------------------------------------------------------- */
1508void
1509limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1510{
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 tSirMsgQ mmhMsg;
1512 tSirSmeDeauthInd *pSirSmeDeauthInd;
1513
Bhargav Shahe3a6ff02016-04-11 16:31:49 +05301514 limSendTLPauseInd(pMac, pStaDs->staIndex);
1515
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301516 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1517 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301519 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 return;
1521 }
1522
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1524 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001525
Jeff Johnson295189b2012-06-20 16:38:30 -07001526 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1527 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
Wu Gao742b7352015-10-16 19:10:40 +08001528 pSirSmeDeauthInd->assocId = pStaDs->assocId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1530 {
1531 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1532 }
1533 else
1534 {
1535 //Need to indicatet he reascon code over the air
1536 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1537 }
1538 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301539 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301541 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001542 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001543
Jeff Johnson295189b2012-06-20 16:38:30 -07001544
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001546
1547 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1548 mmhMsg.bodyptr = pSirSmeDeauthInd;
1549 mmhMsg.bodyval = 0;
1550
Jeff Johnsone7245742012-09-05 17:12:55 -07001551 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001552#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1553 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1554#endif //FEATURE_WLAN_DIAG_SUPPORT
1555
1556 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1557 return;
1558} /*** end limSendSmeDeauthInd() ***/
1559
Hoonki Leee6bfe942013-02-05 15:01:19 -08001560#ifdef FEATURE_WLAN_TDLS
1561/**
1562 * limSendSmeTDLSDelStaInd()
1563 *
1564 *FUNCTION:
1565 * This function is called to send the TDLS STA context deletion to SME.
1566 *
1567 *LOGIC:
1568 *
1569 *ASSUMPTIONS:
1570 *
1571 *NOTE:
1572 * NA
1573 *
1574 * @param pMac - Pointer to global MAC structure
1575 * @param pStaDs - Pointer to internal STA Datastructure
1576 * @param psessionEntry - Pointer to the session entry
1577 * @param reasonCode - Reason for TDLS sta deletion
1578 * @return None
1579 */
1580void
1581limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1582{
1583 tSirMsgQ mmhMsg;
1584 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1585
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301586 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1587 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001588 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301589 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001590 return;
1591 }
1592
1593 //messageType
1594 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1595 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1596
1597 //sessionId
1598 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1599
1600 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301601 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001602
1603 //staId
1604 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1605
1606 //reasonCode
1607 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1608
1609 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1610 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1611 mmhMsg.bodyval = 0;
1612
1613
1614 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1615 return;
1616}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001617
1618/**
1619 * limSendSmeTDLSDeleteAllPeerInd()
1620 *
1621 *FUNCTION:
1622 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1623 * message to SME.
1624 *
1625 *LOGIC:
1626 *
1627 *ASSUMPTIONS:
1628 *
1629 *NOTE:
1630 * NA
1631 *
1632 * @param pMac - Pointer to global MAC structure
1633 * @param psessionEntry - Pointer to the session entry
1634 * @return None
1635 */
1636void
1637limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1638{
1639 tSirMsgQ mmhMsg;
1640 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1641
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301642 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1643 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001644 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301645 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001646 return;
1647 }
1648
1649 //messageType
1650 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1651 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1652
1653 //sessionId
1654 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1655
1656 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1657 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1658 mmhMsg.bodyval = 0;
1659
1660
1661 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1662 return;
1663}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001664
1665/**
1666 * limSendSmeMgmtTXCompletion()
1667 *
1668 *FUNCTION:
1669 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1670 * message to SME.
1671 *
1672 *LOGIC:
1673 *
1674 *ASSUMPTIONS:
1675 *
1676 *NOTE:
1677 * NA
1678 *
1679 * @param pMac - Pointer to global MAC structure
1680 * @param psessionEntry - Pointer to the session entry
1681 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1682 * @return None
1683 */
1684void
1685limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301686 tANI_U32 smeSessionId,
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001687 tANI_U32 txCompleteStatus)
1688{
1689 tSirMsgQ mmhMsg;
1690 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1691
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301692 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1693 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001694 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301695 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001696 return;
1697 }
1698
1699 //messageType
1700 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1701 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1702
1703 //sessionId
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301704 pSirMgmtTxCompletionInd->sessionId = smeSessionId;
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001705
1706 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1707
1708 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1709 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1710 mmhMsg.bodyval = 0;
1711
1712
1713 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1714 return;
1715}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001716#endif
1717
Jeff Johnson295189b2012-06-20 16:38:30 -07001718
1719/**
1720 * limSendSmeDeauthNtf()
1721 *
1722 *FUNCTION:
1723 * This function is called by limProcessSmeMessages() to send
1724 * eWNI_SME_DISASSOC_RSP/IND message to host
1725 *
1726 *PARAMS:
1727 *
1728 *LOGIC:
1729 *
1730 *ASSUMPTIONS:
1731 * NA
1732 *
1733 *NOTE:
1734 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1735 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1736 *
1737 * @param peerMacAddr Indicates the peer MAC addr to which
1738 * deauthentication was initiated
1739 * @param reasonCode Indicates the reason for Deauthetication
1740 * @param deauthTrigger Indicates the trigger for Deauthetication
1741 * @param aid Indicates the STAID. This parameter is present
1742 * only on AP.
1743 *
1744 * @return None
1745 */
1746void
1747limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1748 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1749{
1750 tANI_U8 *pBuf;
1751 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1752 tSirSmeDeauthInd *pSirSmeDeauthInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301753 tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 tpPESession psessionEntry;
1755 tANI_U8 sessionId;
1756 tANI_U32 *pMsg;
1757
1758 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1759 switch (deauthTrigger)
1760 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 case eLIM_HOST_DEAUTH:
1762 /**
1763 * Deauthentication response to host triggered
1764 * deauthentication.
1765 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301766 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1767 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 {
1769 // Log error
1770 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301771 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001772
1773 return;
1774 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301775 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1776 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1777 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1779 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001780 pSirSmeDeauthRsp->statusCode = reasonCode;
1781 pSirSmeDeauthRsp->sessionId = smesessionId;
1782 pSirSmeDeauthRsp->transactionId = smetransactionId;
1783
1784 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301785 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001786
Jeff Johnson295189b2012-06-20 16:38:30 -07001787#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1788 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1789 psessionEntry, 0, (tANI_U16)reasonCode);
1790#endif
1791 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1792
1793 break;
1794
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301795 case eLIM_PEER_ENTITY_DEAUTH:
1796 case eLIM_LINK_MONITORING_DEAUTH:
1797 pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
1798 if ( NULL == pSirSmeDisConDoneInd )
1799 {
1800 // Log error
1801 limLog(pMac, LOGP,
1802 FL("call to AllocateMemory failed for disconnect indication"));
1803
1804 return;
1805 }
1806 vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
1807 limLog(pMac, LOG1,
1808 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1809 reasonCode);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301810
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301811 pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
1812 pSirSmeDisConDoneInd->length = sizeof(tSirSmeDisConDoneInd);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301813 vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
1814 sizeof(tSirMacAddr));
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301815 pSirSmeDisConDoneInd->sessionId = smesessionId;
Selvaraj, Sridhara9545d92016-06-08 17:38:20 +05301816
1817 if (reasonCode == eSIR_SME_LOST_LINK_WITH_PEER_RESULT_CODE)
1818 pSirSmeDisConDoneInd->reasonCode = 0;
1819 else
1820 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1821
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301822 pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
1823 break;
1824
Jeff Johnson295189b2012-06-20 16:38:30 -07001825 default:
1826 /**
1827 * Deauthentication indication due to Deauthentication
1828 * frame reception from peer entity or due to
1829 * loss of link with peer entity.
1830 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301831 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1832 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 {
1834 // Log error
1835 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301836 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001837
1838 return;
1839 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301840 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1841 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1842 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1844 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001845 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Wu Gao742b7352015-10-16 19:10:40 +08001846 pSirSmeDeauthInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001847
1848 // sessionId
1849 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1850 *pBuf++ = smesessionId;
1851
1852 //transaction ID
1853 limCopyU16(pBuf, smetransactionId);
1854 pBuf += sizeof(tANI_U16);
1855
1856 // status code
1857 limCopyU32(pBuf, reasonCode);
1858 pBuf += sizeof(tSirResultCodes);
1859
1860 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301861 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 pBuf += sizeof(tSirMacAddr);
1863
1864 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301865 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001866
Jeff Johnson295189b2012-06-20 16:38:30 -07001867#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1868 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1869 psessionEntry, 0, (tANI_U16)reasonCode);
1870#endif //FEATURE_WLAN_DIAG_SUPPORT
1871 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1872
1873 break;
1874 }
1875
1876 /*Delete the PE session created */
1877 if(psessionEntry != NULL)
1878 {
1879 peDeleteSession(pMac,psessionEntry);
1880 }
1881
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001882 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1883 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001884
Jeff Johnson295189b2012-06-20 16:38:30 -07001885} /*** end limSendSmeDeauthNtf() ***/
1886
1887
1888/**
1889 * limSendSmeWmStatusChangeNtf()
1890 *
1891 *FUNCTION:
1892 * This function is called by limProcessSmeMessages() to send
1893 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1894 *
1895 *PARAMS:
1896 *
1897 *LOGIC:
1898 *
1899 *ASSUMPTIONS:
1900 * NA
1901 *
1902 *NOTE:
1903 *
1904 * @param statusChangeCode Indicates the change in the wireless medium.
1905 * @param statusChangeInfo Indicates the information associated with
1906 * change in the wireless medium.
1907 * @param infoLen Indicates the length of status change information
1908 * being sent.
1909 *
1910 * @return None
1911 */
1912void
1913limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1914 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1915{
1916 tSirMsgQ mmhMsg;
1917 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301918 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1919 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 {
1921 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301922 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 return;
1924 }
1925
Jeff Johnson295189b2012-06-20 16:38:30 -07001926
1927 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1928 mmhMsg.bodyval = 0;
1929 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1930
1931 switch(statusChangeCode)
1932 {
1933 case eSIR_SME_RADAR_DETECTED:
1934
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 break;
1936
1937 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 break;
1939
1940 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1941 limPackBkgndScanFailNotify(pMac,
1942 statusChangeCode,
1943 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1944 pSirSmeWmStatusChangeNtf, sessionId);
1945 break;
1946
1947 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1949 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1950 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1951 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1953 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301954 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1955 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 }
Sushant Kaushik1b645382014-10-13 16:39:36 +05301957 limLog(pMac, LOGE, FL("***---*** StatusChg: code %d, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 statusChangeCode, infoLen);
1959 break;
1960 }
1961
1962
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301963 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1965 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301966 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001967 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 }
1969
1970} /*** end limSendSmeWmStatusChangeNtf() ***/
1971
1972
1973/**
1974 * limSendSmeSetContextRsp()
1975 *
1976 *FUNCTION:
1977 * This function is called by limProcessSmeMessages() to send
1978 * eWNI_SME_SETCONTEXT_RSP message to host
1979 *
1980 *PARAMS:
1981 *
1982 *LOGIC:
1983 *
1984 *ASSUMPTIONS:
1985 * NA
1986 *
1987 *NOTE:
1988 *
1989 * @param pMac Pointer to Global MAC structure
1990 * @param peerMacAddr Indicates the peer MAC addr to which
1991 * setContext was performed
1992 * @param aid Indicates the aid corresponding to the peer MAC
1993 * address
1994 * @param resultCode Indicates the result of previously issued
1995 * eWNI_SME_SETCONTEXT_RSP message
1996 *
1997 * @return None
1998 */
1999void
2000limSendSmeSetContextRsp(tpAniSirGlobal pMac,
2001 tSirMacAddr peerMacAddr, tANI_U16 aid,
2002 tSirResultCodes resultCode,
2003 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2004{
2005
2006 tANI_U8 *pBuf;
2007 tSirMsgQ mmhMsg;
2008 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
2009
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302010 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
2011 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 {
2013 // Log error
2014 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302015 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002016
2017 return;
2018 }
2019
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
2021 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 pSirSmeSetContextRsp->statusCode = resultCode;
2023
2024 pBuf = pSirSmeSetContextRsp->peerMacAddr;
2025
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302026 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 pBuf += sizeof(tSirMacAddr);
2028
Jeff Johnson295189b2012-06-20 16:38:30 -07002029
2030 /* Update SME session and transaction Id*/
2031 pSirSmeSetContextRsp->sessionId = smesessionId;
2032 pSirSmeSetContextRsp->transactionId = smetransactionId;
2033
2034 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
2035 mmhMsg.bodyptr = pSirSmeSetContextRsp;
2036 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002037 if(NULL == psessionEntry)
2038 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302039 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
2040 mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002041 }
2042 else
2043 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302044 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2045 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002046 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002047
2048#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2049 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
2050#endif //FEATURE_WLAN_DIAG_SUPPORT
2051
2052 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2053} /*** end limSendSmeSetContextRsp() ***/
2054
2055/**
2056 * limSendSmeRemoveKeyRsp()
2057 *
2058 *FUNCTION:
2059 * This function is called by limProcessSmeMessages() to send
2060 * eWNI_SME_REMOVEKEY_RSP message to host
2061 *
2062 *PARAMS:
2063 *
2064 *LOGIC:
2065 *
2066 *ASSUMPTIONS:
2067 * NA
2068 *
2069 *NOTE:
2070 *
2071 * @param pMac Pointer to Global MAC structure
2072 * @param peerMacAddr Indicates the peer MAC addr to which
2073 * Removekey was performed
2074 * @param aid Indicates the aid corresponding to the peer MAC
2075 * address
2076 * @param resultCode Indicates the result of previously issued
2077 * eWNI_SME_REMOVEKEY_RSP message
2078 *
2079 * @return None
2080 */
2081void
2082limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
2083 tSirMacAddr peerMacAddr,
2084 tSirResultCodes resultCode,
2085 tpPESession psessionEntry,tANI_U8 smesessionId,
2086 tANI_U16 smetransactionId)
2087{
2088 tANI_U8 *pBuf;
2089 tSirMsgQ mmhMsg;
2090 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2091
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302092 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
2093 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 {
2095 // Log error
2096 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302097 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002098
2099 return;
2100 }
2101
Jeff Johnson295189b2012-06-20 16:38:30 -07002102
2103
2104 if(psessionEntry != NULL)
2105 {
2106 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302107 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 }
2109
2110 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2111 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2112 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2113
2114 /* Update SME session and transaction Id*/
2115 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2116 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2117
2118 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2119 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2120 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002121 if(NULL == psessionEntry)
2122 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302123 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002124 }
2125 else
2126 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302127 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2128 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002129 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2131} /*** end limSendSmeSetContextRsp() ***/
2132
2133
2134/**
2135 * limSendSmePromiscuousModeRsp()
2136 *
2137 *FUNCTION:
2138 * This function is called by limProcessSmeMessages() to send
2139 * eWNI_PROMISCUOUS_MODE_RSP message to host
2140 *
2141 *PARAMS:
2142 *
2143 *LOGIC:
2144 *
2145 *ASSUMPTIONS:
2146 * NA
2147 *
2148 *NOTE:
2149 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2150 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2151 *
2152 * @param None
2153 * @return None
2154 */
2155void
2156limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2157{
2158#if 0
2159 tSirMsgQ mmhMsg;
2160 tSirMbMsg *pMbMsg;
2161
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302162 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2163 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 {
2165 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302166 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002167
2168 return;
2169 }
2170
2171 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2172 pMbMsg->msgLen = 4;
2173
2174 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2175 mmhMsg.bodyptr = pMbMsg;
2176 mmhMsg.bodyval = 0;
2177 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2178 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2179#endif
2180} /*** end limSendSmePromiscuousModeRsp() ***/
2181
2182
2183
2184/**
2185 * limSendSmeNeighborBssInd()
2186 *
2187 *FUNCTION:
2188 * This function is called by limLookupNaddHashEntry() to send
2189 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2190 *
2191 *PARAMS:
2192 *
2193 *LOGIC:
2194 *
2195 *ASSUMPTIONS:
2196 * NA
2197 *
2198 *NOTE:
2199 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2200 * host upon detecting new BSS during background scanning if CFG
2201 * option is enabled for sending such indication
2202 *
2203 * @param pMac - Pointer to Global MAC structure
2204 * @return None
2205 */
2206
2207void
2208limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2209 tLimScanResultNode *pBssDescr)
2210{
2211 tSirMsgQ msgQ;
2212 tANI_U32 val;
2213 tSirSmeNeighborBssInd *pNewBssInd;
2214
2215 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2216 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2217 pMac->lim.gLimRspReqd))
2218 {
2219 // LIM is not in background scan state OR
2220 // current scan is initiated by HDD.
2221 // No need to send new BSS indication to HDD
2222 return;
2223 }
2224
2225 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2226 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002227 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002228
2229 return;
2230 }
2231
2232 if (val == 0)
2233 return;
2234
2235 /**
2236 * Need to indicate new BSSs found during
2237 * background scanning to host.
2238 * Allocate buffer for sending indication.
2239 * Length of buffer is length of BSS description
2240 * and length of header itself
2241 */
2242 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302243 pNewBssInd = vos_mem_malloc(val);
2244 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 {
2246 // Log error
2247 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302248 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249
2250 return;
2251 }
2252
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2254 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 pNewBssInd->sessionId = 0;
2256
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302257 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 (tANI_U8 *) &pBssDescr->bssDescription,
2259 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002260
2261 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2262 msgQ.bodyptr = pNewBssInd;
2263 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302264 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2266} /*** end limSendSmeNeighborBssInd() ***/
2267
2268/** -----------------------------------------------------------------
2269 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2270 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2271 \ SME only looks at rc and tspec field.
2272 \param pMac - global mac structure
2273 \param rspReqd - is SmeAddTsRsp required
2274 \param status - status code of SME_ADD_TS_RSP
2275 \return tspec
2276 \sa
2277 ----------------------------------------------------------------- */
2278void
2279limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2280 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2281{
2282 tpSirAddtsRsp rsp;
2283 tSirMsgQ mmhMsg;
2284
2285 if (! rspReqd)
2286 return;
2287
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302288 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2289 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302291 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 return;
2293 }
2294
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302295 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 rsp->messageType = eWNI_SME_ADDTS_RSP;
2297 rsp->rc = status;
2298 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302299 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 /* Update SME session Id and transcation Id */
2302 rsp->sessionId = smesessionId;
2303 rsp->transactionId = smetransactionId;
2304
2305 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2306 mmhMsg.bodyptr = rsp;
2307 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002308 if(NULL == psessionEntry)
2309 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302310 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002311 }
2312 else
2313 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302314 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2315 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002316 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002317#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2318 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2319#endif //FEATURE_WLAN_DIAG_SUPPORT
2320
2321 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2322 return;
2323}
2324
2325void
2326limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2327{
2328 tpSirAddtsRsp rsp;
2329 tSirMsgQ mmhMsg;
2330
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002331 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 addts->dialogToken,
2333 addts->tspec.tsinfo.traffic.tsid,
2334 addts->tspec.tsinfo.traffic.userPrio);
2335
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302336 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2337 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 {
2339 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302340 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 return;
2342 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302343 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002344
2345 rsp->messageType = eWNI_SME_ADDTS_IND;
2346
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302347 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002348
2349 mmhMsg.type = eWNI_SME_ADDTS_IND;
2350 mmhMsg.bodyptr = rsp;
2351 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002352 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2354}
2355
2356void
2357limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2358{
2359 tpSirDeltsRsp rsp;
2360 tSirMsgQ mmhMsg;
2361
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002362 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 delts->aid,
2364 delts->req.tsinfo.traffic.tsid,
2365 delts->req.tsinfo.traffic.userPrio,
2366 status);
2367 if (! delts->rspReqd)
2368 return;
2369
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302370 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2371 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 {
2373 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302374 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 return;
2376 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302377 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002378
2379 if(psessionEntry != NULL)
2380 {
2381
2382 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302383 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2384 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 }
2386
2387
2388 rsp->messageType = eWNI_SME_DELTS_RSP;
2389 rsp->rc = status;
2390
2391 /* Update SME session Id and transcation Id */
2392 rsp->sessionId = smesessionId;
2393 rsp->transactionId = smetransactionId;
2394
2395 mmhMsg.type = eWNI_SME_DELTS_RSP;
2396 mmhMsg.bodyptr = rsp;
2397 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002398 if(NULL == psessionEntry)
2399 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302400 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002401 }
2402 else
2403 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302404 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2405 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002406 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002407#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2408 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2409#endif //FEATURE_WLAN_DIAG_SUPPORT
2410
2411 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2412}
2413
2414void
2415limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2416{
2417 tpSirDeltsRsp rsp;
2418 tSirMsgQ mmhMsg;
2419
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002420 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 aid,
2422 delts->tsinfo.traffic.tsid,
2423 delts->tsinfo.traffic.userPrio);
2424
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302425 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2426 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 {
2428 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302429 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 return;
2431 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302432 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002433
2434 rsp->messageType = eWNI_SME_DELTS_IND;
2435 rsp->rc = eSIR_SUCCESS;
2436 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302437 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002438
2439 /* Update SME session Id and SME transaction Id */
2440
2441 rsp->sessionId = psessionEntry->smeSessionId;
2442 rsp->transactionId = psessionEntry->transactionId;
2443
2444 mmhMsg.type = eWNI_SME_DELTS_IND;
2445 mmhMsg.bodyptr = rsp;
2446 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002447 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002448#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2449 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2450#endif //FEATURE_WLAN_DIAG_SUPPORT
2451
2452 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2453}
2454
2455/**
2456 * limSendSmeStatsRsp()
2457 *
2458 *FUNCTION:
2459 * This function is called to send 802.11 statistics response to HDD.
2460 * This function posts the result back to HDD. This is a response to
2461 * HDD's request for statistics.
2462 *
2463 *PARAMS:
2464 *
2465 *LOGIC:
2466 *
2467 *ASSUMPTIONS:
2468 * NA
2469 *
2470 *NOTE:
2471 * NA
2472 *
2473 * @param pMac Pointer to Global MAC structure
2474 * @param p80211Stats Statistics sent in response
2475 * @param resultCode TODO:
2476 *
2477 *
2478 * @return none
2479 */
2480
2481void
2482limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2483{
2484 tSirMsgQ mmhMsg;
2485 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2486
2487 switch(msgType)
2488 {
2489 case WDA_STA_STAT_RSP:
2490 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2491 break;
2492 case WDA_AGGR_STAT_RSP:
2493 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2494 break;
2495 case WDA_GLOBAL_STAT_RSP:
2496 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2497 break;
2498 case WDA_STAT_SUMM_RSP:
2499 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2500 break;
2501 default:
2502 mmhMsg.type = msgType; //Response from within PE
2503 break;
2504 }
2505
2506 pMsgHdr->messageType = mmhMsg.type;
2507
2508 mmhMsg.bodyptr = stats;
2509 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302510 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2512
2513 return;
2514
2515} /*** end limSendSmeStatsRsp() ***/
2516
2517/**
2518 * limSendSmePEStatisticsRsp()
2519 *
2520 *FUNCTION:
2521 * This function is called to send 802.11 statistics response to HDD.
2522 * This function posts the result back to HDD. This is a response to
2523 * HDD's request for statistics.
2524 *
2525 *PARAMS:
2526 *
2527 *LOGIC:
2528 *
2529 *ASSUMPTIONS:
2530 * NA
2531 *
2532 *NOTE:
2533 * NA
2534 *
2535 * @param pMac Pointer to Global MAC structure
2536 * @param p80211Stats Statistics sent in response
2537 * @param resultCode TODO:
2538 *
2539 *
2540 * @return none
2541 */
2542
2543void
2544limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2545{
2546 tSirMsgQ mmhMsg;
2547 tANI_U8 sessionId;
2548 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2549 tpPESession pPeSessionEntry;
2550
2551 //Get the Session Id based on Sta Id
2552 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2553
2554 //Fill the Session Id
2555 if(NULL != pPeSessionEntry)
2556 {
2557 //Fill the Session Id
2558 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2559 }
2560
2561 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2562
2563
2564 //msgType should be WDA_GET_STATISTICS_RSP
2565 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2566
2567 mmhMsg.bodyptr = stats;
2568 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302569 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2571
2572 return;
2573
2574} /*** end limSendSmePEStatisticsRsp() ***/
2575
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002576#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002577/**
2578 * limSendSmePEGetRoamRssiRsp()
2579 *
2580 *FUNCTION:
2581 * This function is called to send roam rssi response to HDD.
2582 * This function posts the result back to HDD. This is a response to
2583 * HDD's request to get roam rssi.
2584 *
2585 *PARAMS:
2586 *
2587 *LOGIC:
2588 *
2589 *ASSUMPTIONS:
2590 * NA
2591 *
2592 *NOTE:
2593 * NA
2594 *
2595 * @param pMac Pointer to Global MAC structure
2596 * @param p80211Stats Statistics sent in response
2597 * @param resultCode TODO:
2598 *
2599 *
2600 * @return none
2601 */
2602
2603void
2604limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2605{
2606 tSirMsgQ mmhMsg;
2607 tANI_U8 sessionId;
2608 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2609 tpPESession pPeSessionEntry = NULL;
2610
2611 //Get the Session Id based on Sta Id
2612 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2613
2614 //Fill the Session Id
2615 if(NULL != pPeSessionEntry)
2616 {
2617 //Fill the Session Id
2618 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2619 }
2620
2621 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2622
2623 //msgType should be WDA_GET_STATISTICS_RSP
2624 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2625
2626 mmhMsg.bodyptr = stats;
2627 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302628 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002629 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2630
2631 return;
2632
2633} /*** end limSendSmePEGetRoamRssiRsp() ***/
2634
2635#endif
2636
Jeff Johnson295189b2012-06-20 16:38:30 -07002637
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002638#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002639/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002640 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002641 *
2642 *FUNCTION:
2643 * This function is called to send tsm stats response to HDD.
2644 * This function posts the result back to HDD. This is a response to
2645 * HDD's request to get tsm stats.
2646 *
2647 *PARAMS:
2648 * @param pMac - Pointer to global pMac structure
2649 * @param pStats - Pointer to TSM Stats
2650 *
2651 * @return none
2652 */
2653
2654void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002655limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002656{
2657 tSirMsgQ mmhMsg;
2658 tANI_U8 sessionId;
2659 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2660 tpPESession pPeSessionEntry = NULL;
2661
2662 //Get the Session Id based on Sta Id
2663 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2664
2665 //Fill the Session Id
2666 if(NULL != pPeSessionEntry)
2667 {
2668 //Fill the Session Id
2669 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2670 }
2671 else
2672 {
2673 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2674 pPeStats->staId);)
2675 return;
2676 }
2677
2678 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002679 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2680 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002681
2682 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2683 mmhMsg.bodyptr = pStats;
2684 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302685 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002686 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2687
2688 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002689} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002690
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002691#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002692
2693
Jeff Johnson295189b2012-06-20 16:38:30 -07002694void
2695limSendSmeIBSSPeerInd(
2696 tpAniSirGlobal pMac,
2697 tSirMacAddr peerMacAddr,
2698 tANI_U16 staIndex,
2699 tANI_U8 ucastIdx,
2700 tANI_U8 bcastIdx,
2701 tANI_U8 *beacon,
2702 tANI_U16 beaconLen,
2703 tANI_U16 msgType,
2704 tANI_U8 sessionId)
2705{
2706 tSirMsgQ mmhMsg;
2707 tSmeIbssPeerInd *pNewPeerInd;
2708
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302709 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2710 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 {
2712 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2713 return;
2714 }
2715
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302716 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002717
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302718 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 peerMacAddr, sizeof(tSirMacAddr));
2720 pNewPeerInd->staId= staIndex;
2721 pNewPeerInd->ucastSig = ucastIdx;
2722 pNewPeerInd->bcastSig = bcastIdx;
2723 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2724 pNewPeerInd->mesgType = msgType;
2725 pNewPeerInd->sessionId = sessionId;
2726
2727 if ( beacon != NULL )
2728 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302729 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2730 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 }
2732
2733 mmhMsg.type = msgType;
2734// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2735 mmhMsg.bodyptr = pNewPeerInd;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302736 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2738
2739}
2740
2741
2742/** -----------------------------------------------------------------
2743 \brief limSendExitBmpsInd() - sends exit bmps indication
2744
2745 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2746 code to SME. This will trigger SME to get out of BMPS mode.
2747
2748 \param pMac - global mac structure
2749 \param reasonCode - reason for which PE wish to exit BMPS
2750 \return none
2751 \sa
2752 ----------------------------------------------------------------- */
2753void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2754{
2755 tSirMsgQ mmhMsg;
2756 tANI_U16 msgLen = 0;
2757 tpSirSmeExitBmpsInd pExitBmpsInd;
2758
2759 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302760 pExitBmpsInd = vos_mem_malloc(msgLen);
2761 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302763 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 return;
2765 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302766 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002767
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2769 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 pExitBmpsInd->exitBmpsReason = reasonCode;
2771 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2772
2773 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2774 mmhMsg.bodyptr = pExitBmpsInd;
2775 mmhMsg.bodyval = 0;
2776
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302777 limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302778 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2780 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2781#endif //FEATURE_WLAN_DIAG_SUPPORT
2782
2783 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2784 return;
2785
2786} /*** end limSendExitBmpsInd() ***/
2787
2788
2789
2790
2791/*--------------------------------------------------------------------------
2792 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2793
2794
2795 \param pMac - pointer to global adapter context
2796 \param sessionId - Message pointer.
2797
2798 \sa
2799 --------------------------------------------------------------------------*/
2800
2801void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2802{
2803 tpPESession psessionEntry;
2804 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2805 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2806 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002807 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002808 return;
2809 }
2810 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2811 {
2812 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2813 }
2814 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2815 {
2816 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2817 }
2818
2819 else
2820 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2821
2822}
2823
2824#ifdef WLAN_FEATURE_VOWIFI_11R
2825/** -----------------------------------------------------------------
2826 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2827 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2828 \ SME only looks at rc and tspec field.
2829 \param pMac - global mac structure
2830 \param rspReqd - is SmeAddTsRsp required
2831 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2832 \return tspec
2833 \sa
2834 ----------------------------------------------------------------- */
2835void
2836limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2837 tANI_U8 smesessionId)
2838{
2839 tSirMsgQ mmhMsg;
2840
2841 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2842 mmhMsg.bodyptr = aggrQosRsp;
2843 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302844 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002845 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2846
2847 return;
2848}
2849#endif
2850
2851/** -----------------------------------------------------------------
2852 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2853 before switching channels for spectrum manangement.
2854
2855 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2856
2857 \param pMac - global mac structure
2858 \return none
2859 \sa
2860 ----------------------------------------------------------------- */
2861void
2862limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2863{
2864 tSirMsgQ mmhMsg;
2865
2866 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2867 mmhMsg.bodyptr = NULL;
2868 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302869 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2871
2872 return;
2873}
2874
2875/** -----------------------------------------------------------------
2876 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2877 after channel switch for spectrum manangement is complete.
2878
2879 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2880
2881 \param pMac - global mac structure
2882 \return none
2883 \sa
2884 ----------------------------------------------------------------- */
2885void
2886limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2887{
2888 tSirMsgQ mmhMsg;
2889
2890 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2891 mmhMsg.bodyptr = NULL;
2892 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302893 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002894 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2895
2896 return;
2897}
2898
2899void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2900 tANI_U8 smesessionId)
2901{
2902 tSirMsgQ mmhMsg;
2903 tSmeMaxAssocInd *pSmeMaxAssocInd;
2904
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302905 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2906 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002907 {
2908 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2909 return;
2910 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302911 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2912 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2913 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2915 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2916 pSmeMaxAssocInd->sessionId = smesessionId;
2917 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2918 mmhMsg.bodyptr = pSmeMaxAssocInd;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302919 limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2920 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr),smesessionId);
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302921 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2923
2924 return;
2925}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002926#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2927/** -----------------------------------------------------------------
2928 \brief limSendSmeCandidateFoundInd() - sends
2929 eWNI_SME_CANDIDATE_FOUND_IND
2930
2931 After receiving candidate found indication frame from FW, this
2932 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2933 roam candidate(s) are available.
2934
2935 \param pMac - global mac structure
2936 \param psessionEntry - session info
2937 \return none
2938 \sa
2939 ----------------------------------------------------------------- */
2940void
2941limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2942{
2943 tSirMsgQ mmhMsg;
2944 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2945
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302946 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2947 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002948 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302949 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002950 return;
2951 }
2952
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302953#ifdef FEATURE_WLAN_DIAG_SUPPORT
2954 limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_CANDIDATE_FOUND,
2955 NULL, eSIR_SUCCESS, eSIR_SUCCESS);
2956#endif
2957
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002958 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05302959 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeCandidateFoundInd);
2960 pSirSmeCandidateFoundInd->sessionId = sessionId;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002961
2962
2963 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2964 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2965 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2966 mmhMsg.bodyval = 0;
2967
2968 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2969
2970} /*** end limSendSmeCandidateFoundInd() ***/
2971#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD