blob: f9e423439d125c8c46383a670fa2e6951560a9ff [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 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;
1372 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1373 pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
1374 break;
1375
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 default:
1377 /**
1378 * Disassociation indication due to Disassociation
1379 * frame reception from peer entity or due to
1380 * loss of link with peer entity.
1381 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301382 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1383 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 {
1385 // Log error
1386 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301387 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301389 failure = TRUE;
1390 goto error;
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301392 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1393 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1394 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1396 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1397
1398 /* Update SME session Id and Transaction Id */
1399 pSirSmeDisassocInd->sessionId = smesessionId;
1400 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001401 pSirSmeDisassocInd->reasonCode = reasonCode;
Wu Gao742b7352015-10-16 19:10:40 +08001402 pSirSmeDisassocInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1404
1405 limCopyU32(pBuf, reasonCode);
1406 pBuf += sizeof(tSirResultCodes);
1407
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301408 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 pBuf += sizeof(tSirMacAddr);
1410
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301411 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001412
1413
1414#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1415 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1416 psessionEntry, (tANI_U16)reasonCode, 0);
1417#endif
1418 pMsg = (tANI_U32*) pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
1420 break;
1421 }
1422
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301423error:
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 /* Delete the PE session Created */
1425 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1426 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1427 {
1428 peDeleteSession(pMac,psessionEntry);
1429 }
Sushant Kaushik7ac65f02015-04-13 16:12:23 +05301430 if (failure == FALSE)
1431 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1432 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001433} /*** end limSendSmeDisassocNtf() ***/
1434
1435
1436/** -----------------------------------------------------------------
1437 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1438
1439 After receiving disassociation frame from peer entity, this
1440 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1441 reason code.
1442
1443 \param pMac - global mac structure
1444 \param pStaDs - station dph hash node
1445 \return none
1446 \sa
1447 ----------------------------------------------------------------- */
1448void
1449limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1450{
1451 tSirMsgQ mmhMsg;
1452 tSirSmeDisassocInd *pSirSmeDisassocInd;
1453
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301454 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1455 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301457 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 return;
1459 }
1460
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1462 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001463
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1465 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1466 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001467 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Wu Gao742b7352015-10-16 19:10:40 +08001468 pSirSmeDisassocInd->assocId = pStaDs->assocId;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301469
1470 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1471
1472 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001473
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301475
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1477 mmhMsg.bodyptr = pSirSmeDisassocInd;
1478 mmhMsg.bodyval = 0;
1479
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301480 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, psessionEntry->peSessionId,
1481 mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001482#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1483 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1484#endif //FEATURE_WLAN_DIAG_SUPPORT
1485
1486 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1487
1488} /*** end limSendSmeDisassocInd() ***/
1489
1490
1491/** -----------------------------------------------------------------
1492 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1493
1494 After receiving deauthentication frame from peer entity, this
1495 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1496 reason code.
1497
1498 \param pMac - global mac structure
1499 \param pStaDs - station dph hash node
1500 \return none
1501 \sa
1502 ----------------------------------------------------------------- */
1503void
1504limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1505{
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 tSirMsgQ mmhMsg;
1507 tSirSmeDeauthInd *pSirSmeDeauthInd;
1508
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301509 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1510 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301512 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 return;
1514 }
1515
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1517 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001518
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1520 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
Wu Gao742b7352015-10-16 19:10:40 +08001521 pSirSmeDeauthInd->assocId = pStaDs->assocId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1523 {
1524 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1525 }
1526 else
1527 {
1528 //Need to indicatet he reascon code over the air
1529 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1530 }
1531 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301532 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301534 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001535 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001536
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001539
1540 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1541 mmhMsg.bodyptr = pSirSmeDeauthInd;
1542 mmhMsg.bodyval = 0;
1543
Jeff Johnsone7245742012-09-05 17:12:55 -07001544 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001545#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1546 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1547#endif //FEATURE_WLAN_DIAG_SUPPORT
1548
1549 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1550 return;
1551} /*** end limSendSmeDeauthInd() ***/
1552
Hoonki Leee6bfe942013-02-05 15:01:19 -08001553#ifdef FEATURE_WLAN_TDLS
1554/**
1555 * limSendSmeTDLSDelStaInd()
1556 *
1557 *FUNCTION:
1558 * This function is called to send the TDLS STA context deletion to SME.
1559 *
1560 *LOGIC:
1561 *
1562 *ASSUMPTIONS:
1563 *
1564 *NOTE:
1565 * NA
1566 *
1567 * @param pMac - Pointer to global MAC structure
1568 * @param pStaDs - Pointer to internal STA Datastructure
1569 * @param psessionEntry - Pointer to the session entry
1570 * @param reasonCode - Reason for TDLS sta deletion
1571 * @return None
1572 */
1573void
1574limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1575{
1576 tSirMsgQ mmhMsg;
1577 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1578
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301579 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1580 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001581 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301582 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001583 return;
1584 }
1585
1586 //messageType
1587 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1588 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1589
1590 //sessionId
1591 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1592
1593 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301594 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001595
1596 //staId
1597 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1598
1599 //reasonCode
1600 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1601
1602 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1603 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1604 mmhMsg.bodyval = 0;
1605
1606
1607 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1608 return;
1609}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001610
1611/**
1612 * limSendSmeTDLSDeleteAllPeerInd()
1613 *
1614 *FUNCTION:
1615 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1616 * message to SME.
1617 *
1618 *LOGIC:
1619 *
1620 *ASSUMPTIONS:
1621 *
1622 *NOTE:
1623 * NA
1624 *
1625 * @param pMac - Pointer to global MAC structure
1626 * @param psessionEntry - Pointer to the session entry
1627 * @return None
1628 */
1629void
1630limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1631{
1632 tSirMsgQ mmhMsg;
1633 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1634
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301635 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1636 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001637 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301638 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001639 return;
1640 }
1641
1642 //messageType
1643 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1644 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1645
1646 //sessionId
1647 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1648
1649 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1650 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1651 mmhMsg.bodyval = 0;
1652
1653
1654 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1655 return;
1656}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001657
1658/**
1659 * limSendSmeMgmtTXCompletion()
1660 *
1661 *FUNCTION:
1662 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1663 * message to SME.
1664 *
1665 *LOGIC:
1666 *
1667 *ASSUMPTIONS:
1668 *
1669 *NOTE:
1670 * NA
1671 *
1672 * @param pMac - Pointer to global MAC structure
1673 * @param psessionEntry - Pointer to the session entry
1674 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1675 * @return None
1676 */
1677void
1678limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301679 tANI_U32 smeSessionId,
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001680 tANI_U32 txCompleteStatus)
1681{
1682 tSirMsgQ mmhMsg;
1683 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1684
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301685 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1686 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001687 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301688 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001689 return;
1690 }
1691
1692 //messageType
1693 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1694 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1695
1696 //sessionId
Ganesh Kondabattiniff987022015-08-11 19:43:44 +05301697 pSirMgmtTxCompletionInd->sessionId = smeSessionId;
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001698
1699 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1700
1701 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1702 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1703 mmhMsg.bodyval = 0;
1704
1705
1706 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1707 return;
1708}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001709#endif
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711
1712/**
1713 * limSendSmeDeauthNtf()
1714 *
1715 *FUNCTION:
1716 * This function is called by limProcessSmeMessages() to send
1717 * eWNI_SME_DISASSOC_RSP/IND message to host
1718 *
1719 *PARAMS:
1720 *
1721 *LOGIC:
1722 *
1723 *ASSUMPTIONS:
1724 * NA
1725 *
1726 *NOTE:
1727 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1728 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1729 *
1730 * @param peerMacAddr Indicates the peer MAC addr to which
1731 * deauthentication was initiated
1732 * @param reasonCode Indicates the reason for Deauthetication
1733 * @param deauthTrigger Indicates the trigger for Deauthetication
1734 * @param aid Indicates the STAID. This parameter is present
1735 * only on AP.
1736 *
1737 * @return None
1738 */
1739void
1740limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1741 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1742{
1743 tANI_U8 *pBuf;
1744 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1745 tSirSmeDeauthInd *pSirSmeDeauthInd;
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301746 tSirSmeDisConDoneInd *pSirSmeDisConDoneInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 tpPESession psessionEntry;
1748 tANI_U8 sessionId;
1749 tANI_U32 *pMsg;
1750
1751 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1752 switch (deauthTrigger)
1753 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 case eLIM_HOST_DEAUTH:
1755 /**
1756 * Deauthentication response to host triggered
1757 * deauthentication.
1758 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301759 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1760 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 {
1762 // Log error
1763 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301764 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001765
1766 return;
1767 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301768 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1769 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1770 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1772 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 pSirSmeDeauthRsp->statusCode = reasonCode;
1774 pSirSmeDeauthRsp->sessionId = smesessionId;
1775 pSirSmeDeauthRsp->transactionId = smetransactionId;
1776
1777 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301778 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001779
Jeff Johnson295189b2012-06-20 16:38:30 -07001780#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1781 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1782 psessionEntry, 0, (tANI_U16)reasonCode);
1783#endif
1784 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1785
1786 break;
1787
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301788 case eLIM_PEER_ENTITY_DEAUTH:
1789 case eLIM_LINK_MONITORING_DEAUTH:
1790 pSirSmeDisConDoneInd = vos_mem_malloc(sizeof(tSirSmeDisConDoneInd));
1791 if ( NULL == pSirSmeDisConDoneInd )
1792 {
1793 // Log error
1794 limLog(pMac, LOGP,
1795 FL("call to AllocateMemory failed for disconnect indication"));
1796
1797 return;
1798 }
1799 vos_mem_zero(pSirSmeDisConDoneInd, sizeof(tSirSmeDisConDoneInd));
1800 limLog(pMac, LOG1,
1801 FL("send eWNI_SME_DISCONNECT_DONE_IND withretCode: %d"),
1802 reasonCode);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301803
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301804 pSirSmeDisConDoneInd->messageType = eWNI_SME_DISCONNECT_DONE_IND;
1805 pSirSmeDisConDoneInd->length = sizeof(tSirSmeDisConDoneInd);
Deepthi Gowridc197d02015-12-30 16:48:32 +05301806 vos_mem_copy(pSirSmeDisConDoneInd->peerMacAddr, peerMacAddr,
1807 sizeof(tSirMacAddr));
Hanumantha Reddy Pothula1b6eb2f2015-11-30 20:50:23 +05301808 pSirSmeDisConDoneInd->sessionId = smesessionId;
1809 pSirSmeDisConDoneInd->reasonCode = reasonCode;
1810 pMsg = (tANI_U32 *)pSirSmeDisConDoneInd;
1811 break;
1812
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 default:
1814 /**
1815 * Deauthentication indication due to Deauthentication
1816 * frame reception from peer entity or due to
1817 * loss of link with peer entity.
1818 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301819 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1820 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 {
1822 // Log error
1823 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301824 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001825
1826 return;
1827 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301828 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1829 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1830 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1832 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001833 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Wu Gao742b7352015-10-16 19:10:40 +08001834 pSirSmeDeauthInd->assocId = aid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001835
1836 // sessionId
1837 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1838 *pBuf++ = smesessionId;
1839
1840 //transaction ID
1841 limCopyU16(pBuf, smetransactionId);
1842 pBuf += sizeof(tANI_U16);
1843
1844 // status code
1845 limCopyU32(pBuf, reasonCode);
1846 pBuf += sizeof(tSirResultCodes);
1847
1848 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301849 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 pBuf += sizeof(tSirMacAddr);
1851
1852 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301853 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001854
Jeff Johnson295189b2012-06-20 16:38:30 -07001855#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1856 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1857 psessionEntry, 0, (tANI_U16)reasonCode);
1858#endif //FEATURE_WLAN_DIAG_SUPPORT
1859 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1860
1861 break;
1862 }
1863
1864 /*Delete the PE session created */
1865 if(psessionEntry != NULL)
1866 {
1867 peDeleteSession(pMac,psessionEntry);
1868 }
1869
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001870 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1871 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001872
Jeff Johnson295189b2012-06-20 16:38:30 -07001873} /*** end limSendSmeDeauthNtf() ***/
1874
1875
1876/**
1877 * limSendSmeWmStatusChangeNtf()
1878 *
1879 *FUNCTION:
1880 * This function is called by limProcessSmeMessages() to send
1881 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1882 *
1883 *PARAMS:
1884 *
1885 *LOGIC:
1886 *
1887 *ASSUMPTIONS:
1888 * NA
1889 *
1890 *NOTE:
1891 *
1892 * @param statusChangeCode Indicates the change in the wireless medium.
1893 * @param statusChangeInfo Indicates the information associated with
1894 * change in the wireless medium.
1895 * @param infoLen Indicates the length of status change information
1896 * being sent.
1897 *
1898 * @return None
1899 */
1900void
1901limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1902 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1903{
1904 tSirMsgQ mmhMsg;
1905 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301906 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1907 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 {
1909 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301910 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 return;
1912 }
1913
Jeff Johnson295189b2012-06-20 16:38:30 -07001914
1915 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1916 mmhMsg.bodyval = 0;
1917 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1918
1919 switch(statusChangeCode)
1920 {
1921 case eSIR_SME_RADAR_DETECTED:
1922
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 break;
1924
1925 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001926 break;
1927
1928 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1929 limPackBkgndScanFailNotify(pMac,
1930 statusChangeCode,
1931 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1932 pSirSmeWmStatusChangeNtf, sessionId);
1933 break;
1934
1935 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1937 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1938 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1939 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1941 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301942 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1943 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 }
Sushant Kaushik1b645382014-10-13 16:39:36 +05301945 limLog(pMac, LOGE, FL("***---*** StatusChg: code %d, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 statusChangeCode, infoLen);
1947 break;
1948 }
1949
1950
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301951 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1953 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301954 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001955 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 }
1957
1958} /*** end limSendSmeWmStatusChangeNtf() ***/
1959
1960
1961/**
1962 * limSendSmeSetContextRsp()
1963 *
1964 *FUNCTION:
1965 * This function is called by limProcessSmeMessages() to send
1966 * eWNI_SME_SETCONTEXT_RSP message to host
1967 *
1968 *PARAMS:
1969 *
1970 *LOGIC:
1971 *
1972 *ASSUMPTIONS:
1973 * NA
1974 *
1975 *NOTE:
1976 *
1977 * @param pMac Pointer to Global MAC structure
1978 * @param peerMacAddr Indicates the peer MAC addr to which
1979 * setContext was performed
1980 * @param aid Indicates the aid corresponding to the peer MAC
1981 * address
1982 * @param resultCode Indicates the result of previously issued
1983 * eWNI_SME_SETCONTEXT_RSP message
1984 *
1985 * @return None
1986 */
1987void
1988limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1989 tSirMacAddr peerMacAddr, tANI_U16 aid,
1990 tSirResultCodes resultCode,
1991 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1992{
1993
1994 tANI_U8 *pBuf;
1995 tSirMsgQ mmhMsg;
1996 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1997
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301998 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
1999 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 {
2001 // Log error
2002 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302003 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002004
2005 return;
2006 }
2007
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
2009 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 pSirSmeSetContextRsp->statusCode = resultCode;
2011
2012 pBuf = pSirSmeSetContextRsp->peerMacAddr;
2013
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302014 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 pBuf += sizeof(tSirMacAddr);
2016
Jeff Johnson295189b2012-06-20 16:38:30 -07002017
2018 /* Update SME session and transaction Id*/
2019 pSirSmeSetContextRsp->sessionId = smesessionId;
2020 pSirSmeSetContextRsp->transactionId = smetransactionId;
2021
2022 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
2023 mmhMsg.bodyptr = pSirSmeSetContextRsp;
2024 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002025 if(NULL == psessionEntry)
2026 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302027 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION,
2028 mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002029 }
2030 else
2031 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302032 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2033 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002034 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002035
2036#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2037 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
2038#endif //FEATURE_WLAN_DIAG_SUPPORT
2039
2040 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2041} /*** end limSendSmeSetContextRsp() ***/
2042
2043/**
2044 * limSendSmeRemoveKeyRsp()
2045 *
2046 *FUNCTION:
2047 * This function is called by limProcessSmeMessages() to send
2048 * eWNI_SME_REMOVEKEY_RSP message to host
2049 *
2050 *PARAMS:
2051 *
2052 *LOGIC:
2053 *
2054 *ASSUMPTIONS:
2055 * NA
2056 *
2057 *NOTE:
2058 *
2059 * @param pMac Pointer to Global MAC structure
2060 * @param peerMacAddr Indicates the peer MAC addr to which
2061 * Removekey was performed
2062 * @param aid Indicates the aid corresponding to the peer MAC
2063 * address
2064 * @param resultCode Indicates the result of previously issued
2065 * eWNI_SME_REMOVEKEY_RSP message
2066 *
2067 * @return None
2068 */
2069void
2070limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
2071 tSirMacAddr peerMacAddr,
2072 tSirResultCodes resultCode,
2073 tpPESession psessionEntry,tANI_U8 smesessionId,
2074 tANI_U16 smetransactionId)
2075{
2076 tANI_U8 *pBuf;
2077 tSirMsgQ mmhMsg;
2078 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2079
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302080 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
2081 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 {
2083 // Log error
2084 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302085 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002086
2087 return;
2088 }
2089
Jeff Johnson295189b2012-06-20 16:38:30 -07002090
2091
2092 if(psessionEntry != NULL)
2093 {
2094 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302095 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 }
2097
2098 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2099 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2100 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2101
2102 /* Update SME session and transaction Id*/
2103 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2104 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2105
2106 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2107 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2108 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002109 if(NULL == psessionEntry)
2110 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302111 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002112 }
2113 else
2114 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302115 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2116 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002117 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2119} /*** end limSendSmeSetContextRsp() ***/
2120
2121
2122/**
2123 * limSendSmePromiscuousModeRsp()
2124 *
2125 *FUNCTION:
2126 * This function is called by limProcessSmeMessages() to send
2127 * eWNI_PROMISCUOUS_MODE_RSP message to host
2128 *
2129 *PARAMS:
2130 *
2131 *LOGIC:
2132 *
2133 *ASSUMPTIONS:
2134 * NA
2135 *
2136 *NOTE:
2137 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2138 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2139 *
2140 * @param None
2141 * @return None
2142 */
2143void
2144limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2145{
2146#if 0
2147 tSirMsgQ mmhMsg;
2148 tSirMbMsg *pMbMsg;
2149
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302150 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2151 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 {
2153 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302154 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002155
2156 return;
2157 }
2158
2159 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2160 pMbMsg->msgLen = 4;
2161
2162 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2163 mmhMsg.bodyptr = pMbMsg;
2164 mmhMsg.bodyval = 0;
2165 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2166 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2167#endif
2168} /*** end limSendSmePromiscuousModeRsp() ***/
2169
2170
2171
2172/**
2173 * limSendSmeNeighborBssInd()
2174 *
2175 *FUNCTION:
2176 * This function is called by limLookupNaddHashEntry() to send
2177 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2178 *
2179 *PARAMS:
2180 *
2181 *LOGIC:
2182 *
2183 *ASSUMPTIONS:
2184 * NA
2185 *
2186 *NOTE:
2187 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2188 * host upon detecting new BSS during background scanning if CFG
2189 * option is enabled for sending such indication
2190 *
2191 * @param pMac - Pointer to Global MAC structure
2192 * @return None
2193 */
2194
2195void
2196limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2197 tLimScanResultNode *pBssDescr)
2198{
2199 tSirMsgQ msgQ;
2200 tANI_U32 val;
2201 tSirSmeNeighborBssInd *pNewBssInd;
2202
2203 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2204 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2205 pMac->lim.gLimRspReqd))
2206 {
2207 // LIM is not in background scan state OR
2208 // current scan is initiated by HDD.
2209 // No need to send new BSS indication to HDD
2210 return;
2211 }
2212
2213 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2214 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002215 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002216
2217 return;
2218 }
2219
2220 if (val == 0)
2221 return;
2222
2223 /**
2224 * Need to indicate new BSSs found during
2225 * background scanning to host.
2226 * Allocate buffer for sending indication.
2227 * Length of buffer is length of BSS description
2228 * and length of header itself
2229 */
2230 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302231 pNewBssInd = vos_mem_malloc(val);
2232 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 {
2234 // Log error
2235 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302236 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002237
2238 return;
2239 }
2240
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2242 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 pNewBssInd->sessionId = 0;
2244
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302245 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 (tANI_U8 *) &pBssDescr->bssDescription,
2247 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2250 msgQ.bodyptr = pNewBssInd;
2251 msgQ.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302252 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2254} /*** end limSendSmeNeighborBssInd() ***/
2255
2256/** -----------------------------------------------------------------
2257 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2258 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2259 \ SME only looks at rc and tspec field.
2260 \param pMac - global mac structure
2261 \param rspReqd - is SmeAddTsRsp required
2262 \param status - status code of SME_ADD_TS_RSP
2263 \return tspec
2264 \sa
2265 ----------------------------------------------------------------- */
2266void
2267limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2268 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2269{
2270 tpSirAddtsRsp rsp;
2271 tSirMsgQ mmhMsg;
2272
2273 if (! rspReqd)
2274 return;
2275
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302276 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2277 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302279 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 return;
2281 }
2282
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302283 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 rsp->messageType = eWNI_SME_ADDTS_RSP;
2285 rsp->rc = status;
2286 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302287 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 /* Update SME session Id and transcation Id */
2290 rsp->sessionId = smesessionId;
2291 rsp->transactionId = smetransactionId;
2292
2293 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2294 mmhMsg.bodyptr = rsp;
2295 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002296 if(NULL == psessionEntry)
2297 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302298 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002299 }
2300 else
2301 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302302 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2303 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002304 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002305#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2306 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2307#endif //FEATURE_WLAN_DIAG_SUPPORT
2308
2309 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2310 return;
2311}
2312
2313void
2314limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2315{
2316 tpSirAddtsRsp rsp;
2317 tSirMsgQ mmhMsg;
2318
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002319 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 addts->dialogToken,
2321 addts->tspec.tsinfo.traffic.tsid,
2322 addts->tspec.tsinfo.traffic.userPrio);
2323
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302324 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2325 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 {
2327 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302328 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 return;
2330 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302331 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002332
2333 rsp->messageType = eWNI_SME_ADDTS_IND;
2334
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302335 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002336
2337 mmhMsg.type = eWNI_SME_ADDTS_IND;
2338 mmhMsg.bodyptr = rsp;
2339 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002340 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2342}
2343
2344void
2345limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2346{
2347 tpSirDeltsRsp rsp;
2348 tSirMsgQ mmhMsg;
2349
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002350 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 delts->aid,
2352 delts->req.tsinfo.traffic.tsid,
2353 delts->req.tsinfo.traffic.userPrio,
2354 status);
2355 if (! delts->rspReqd)
2356 return;
2357
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302358 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2359 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 {
2361 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302362 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 return;
2364 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302365 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002366
2367 if(psessionEntry != NULL)
2368 {
2369
2370 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302371 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2372 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 }
2374
2375
2376 rsp->messageType = eWNI_SME_DELTS_RSP;
2377 rsp->rc = status;
2378
2379 /* Update SME session Id and transcation Id */
2380 rsp->sessionId = smesessionId;
2381 rsp->transactionId = smetransactionId;
2382
2383 mmhMsg.type = eWNI_SME_DELTS_RSP;
2384 mmhMsg.bodyptr = rsp;
2385 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002386 if(NULL == psessionEntry)
2387 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302388 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002389 }
2390 else
2391 {
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302392 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG,
2393 psessionEntry->peSessionId, mmhMsg.type));
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002394 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002395#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2396 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2397#endif //FEATURE_WLAN_DIAG_SUPPORT
2398
2399 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2400}
2401
2402void
2403limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2404{
2405 tpSirDeltsRsp rsp;
2406 tSirMsgQ mmhMsg;
2407
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002408 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002409 aid,
2410 delts->tsinfo.traffic.tsid,
2411 delts->tsinfo.traffic.userPrio);
2412
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302413 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2414 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 {
2416 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302417 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 return;
2419 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302420 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002421
2422 rsp->messageType = eWNI_SME_DELTS_IND;
2423 rsp->rc = eSIR_SUCCESS;
2424 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302425 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002426
2427 /* Update SME session Id and SME transaction Id */
2428
2429 rsp->sessionId = psessionEntry->smeSessionId;
2430 rsp->transactionId = psessionEntry->transactionId;
2431
2432 mmhMsg.type = eWNI_SME_DELTS_IND;
2433 mmhMsg.bodyptr = rsp;
2434 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002435 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002436#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2437 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2438#endif //FEATURE_WLAN_DIAG_SUPPORT
2439
2440 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2441}
2442
2443/**
2444 * limSendSmeStatsRsp()
2445 *
2446 *FUNCTION:
2447 * This function is called to send 802.11 statistics response to HDD.
2448 * This function posts the result back to HDD. This is a response to
2449 * HDD's request for statistics.
2450 *
2451 *PARAMS:
2452 *
2453 *LOGIC:
2454 *
2455 *ASSUMPTIONS:
2456 * NA
2457 *
2458 *NOTE:
2459 * NA
2460 *
2461 * @param pMac Pointer to Global MAC structure
2462 * @param p80211Stats Statistics sent in response
2463 * @param resultCode TODO:
2464 *
2465 *
2466 * @return none
2467 */
2468
2469void
2470limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2471{
2472 tSirMsgQ mmhMsg;
2473 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2474
2475 switch(msgType)
2476 {
2477 case WDA_STA_STAT_RSP:
2478 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2479 break;
2480 case WDA_AGGR_STAT_RSP:
2481 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2482 break;
2483 case WDA_GLOBAL_STAT_RSP:
2484 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2485 break;
2486 case WDA_STAT_SUMM_RSP:
2487 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2488 break;
2489 default:
2490 mmhMsg.type = msgType; //Response from within PE
2491 break;
2492 }
2493
2494 pMsgHdr->messageType = mmhMsg.type;
2495
2496 mmhMsg.bodyptr = stats;
2497 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302498 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002499 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2500
2501 return;
2502
2503} /*** end limSendSmeStatsRsp() ***/
2504
2505/**
2506 * limSendSmePEStatisticsRsp()
2507 *
2508 *FUNCTION:
2509 * This function is called to send 802.11 statistics response to HDD.
2510 * This function posts the result back to HDD. This is a response to
2511 * HDD's request for statistics.
2512 *
2513 *PARAMS:
2514 *
2515 *LOGIC:
2516 *
2517 *ASSUMPTIONS:
2518 * NA
2519 *
2520 *NOTE:
2521 * NA
2522 *
2523 * @param pMac Pointer to Global MAC structure
2524 * @param p80211Stats Statistics sent in response
2525 * @param resultCode TODO:
2526 *
2527 *
2528 * @return none
2529 */
2530
2531void
2532limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2533{
2534 tSirMsgQ mmhMsg;
2535 tANI_U8 sessionId;
2536 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2537 tpPESession pPeSessionEntry;
2538
2539 //Get the Session Id based on Sta Id
2540 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2541
2542 //Fill the Session Id
2543 if(NULL != pPeSessionEntry)
2544 {
2545 //Fill the Session Id
2546 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2547 }
2548
2549 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2550
2551
2552 //msgType should be WDA_GET_STATISTICS_RSP
2553 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2554
2555 mmhMsg.bodyptr = stats;
2556 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302557 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2559
2560 return;
2561
2562} /*** end limSendSmePEStatisticsRsp() ***/
2563
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002564#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002565/**
2566 * limSendSmePEGetRoamRssiRsp()
2567 *
2568 *FUNCTION:
2569 * This function is called to send roam rssi response to HDD.
2570 * This function posts the result back to HDD. This is a response to
2571 * HDD's request to get roam rssi.
2572 *
2573 *PARAMS:
2574 *
2575 *LOGIC:
2576 *
2577 *ASSUMPTIONS:
2578 * NA
2579 *
2580 *NOTE:
2581 * NA
2582 *
2583 * @param pMac Pointer to Global MAC structure
2584 * @param p80211Stats Statistics sent in response
2585 * @param resultCode TODO:
2586 *
2587 *
2588 * @return none
2589 */
2590
2591void
2592limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2593{
2594 tSirMsgQ mmhMsg;
2595 tANI_U8 sessionId;
2596 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2597 tpPESession pPeSessionEntry = NULL;
2598
2599 //Get the Session Id based on Sta Id
2600 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2601
2602 //Fill the Session Id
2603 if(NULL != pPeSessionEntry)
2604 {
2605 //Fill the Session Id
2606 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2607 }
2608
2609 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2610
2611 //msgType should be WDA_GET_STATISTICS_RSP
2612 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2613
2614 mmhMsg.bodyptr = stats;
2615 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302616 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002617 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2618
2619 return;
2620
2621} /*** end limSendSmePEGetRoamRssiRsp() ***/
2622
2623#endif
2624
Jeff Johnson295189b2012-06-20 16:38:30 -07002625
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002626#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002627/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002628 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002629 *
2630 *FUNCTION:
2631 * This function is called to send tsm stats response to HDD.
2632 * This function posts the result back to HDD. This is a response to
2633 * HDD's request to get tsm stats.
2634 *
2635 *PARAMS:
2636 * @param pMac - Pointer to global pMac structure
2637 * @param pStats - Pointer to TSM Stats
2638 *
2639 * @return none
2640 */
2641
2642void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002643limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002644{
2645 tSirMsgQ mmhMsg;
2646 tANI_U8 sessionId;
2647 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2648 tpPESession pPeSessionEntry = NULL;
2649
2650 //Get the Session Id based on Sta Id
2651 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2652
2653 //Fill the Session Id
2654 if(NULL != pPeSessionEntry)
2655 {
2656 //Fill the Session Id
2657 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2658 }
2659 else
2660 {
2661 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2662 pPeStats->staId);)
2663 return;
2664 }
2665
2666 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002667 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2668 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002669
2670 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2671 mmhMsg.bodyptr = pStats;
2672 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302673 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002674 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2675
2676 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002677} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002678
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002679#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002680
2681
Jeff Johnson295189b2012-06-20 16:38:30 -07002682void
2683limSendSmeIBSSPeerInd(
2684 tpAniSirGlobal pMac,
2685 tSirMacAddr peerMacAddr,
2686 tANI_U16 staIndex,
2687 tANI_U8 ucastIdx,
2688 tANI_U8 bcastIdx,
2689 tANI_U8 *beacon,
2690 tANI_U16 beaconLen,
2691 tANI_U16 msgType,
2692 tANI_U8 sessionId)
2693{
2694 tSirMsgQ mmhMsg;
2695 tSmeIbssPeerInd *pNewPeerInd;
2696
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302697 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2698 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 {
2700 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2701 return;
2702 }
2703
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302704 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002705
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302706 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 peerMacAddr, sizeof(tSirMacAddr));
2708 pNewPeerInd->staId= staIndex;
2709 pNewPeerInd->ucastSig = ucastIdx;
2710 pNewPeerInd->bcastSig = bcastIdx;
2711 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2712 pNewPeerInd->mesgType = msgType;
2713 pNewPeerInd->sessionId = sessionId;
2714
2715 if ( beacon != NULL )
2716 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302717 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2718 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 }
2720
2721 mmhMsg.type = msgType;
2722// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2723 mmhMsg.bodyptr = pNewPeerInd;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302724 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2726
2727}
2728
2729
2730/** -----------------------------------------------------------------
2731 \brief limSendExitBmpsInd() - sends exit bmps indication
2732
2733 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2734 code to SME. This will trigger SME to get out of BMPS mode.
2735
2736 \param pMac - global mac structure
2737 \param reasonCode - reason for which PE wish to exit BMPS
2738 \return none
2739 \sa
2740 ----------------------------------------------------------------- */
2741void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2742{
2743 tSirMsgQ mmhMsg;
2744 tANI_U16 msgLen = 0;
2745 tpSirSmeExitBmpsInd pExitBmpsInd;
2746
2747 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302748 pExitBmpsInd = vos_mem_malloc(msgLen);
2749 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002750 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302751 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002752 return;
2753 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302754 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002755
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2757 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 pExitBmpsInd->exitBmpsReason = reasonCode;
2759 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2760
2761 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2762 mmhMsg.bodyptr = pExitBmpsInd;
2763 mmhMsg.bodyval = 0;
2764
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302765 limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302766 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002767#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2768 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2769#endif //FEATURE_WLAN_DIAG_SUPPORT
2770
2771 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2772 return;
2773
2774} /*** end limSendExitBmpsInd() ***/
2775
2776
2777
2778
2779/*--------------------------------------------------------------------------
2780 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2781
2782
2783 \param pMac - pointer to global adapter context
2784 \param sessionId - Message pointer.
2785
2786 \sa
2787 --------------------------------------------------------------------------*/
2788
2789void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2790{
2791 tpPESession psessionEntry;
2792 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2793 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002795 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 return;
2797 }
2798 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2799 {
2800 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2801 }
2802 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2803 {
2804 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2805 }
2806
2807 else
2808 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2809
2810}
2811
2812#ifdef WLAN_FEATURE_VOWIFI_11R
2813/** -----------------------------------------------------------------
2814 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2815 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2816 \ SME only looks at rc and tspec field.
2817 \param pMac - global mac structure
2818 \param rspReqd - is SmeAddTsRsp required
2819 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2820 \return tspec
2821 \sa
2822 ----------------------------------------------------------------- */
2823void
2824limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2825 tANI_U8 smesessionId)
2826{
2827 tSirMsgQ mmhMsg;
2828
2829 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2830 mmhMsg.bodyptr = aggrQosRsp;
2831 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302832 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002833 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2834
2835 return;
2836}
2837#endif
2838
2839/** -----------------------------------------------------------------
2840 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2841 before switching channels for spectrum manangement.
2842
2843 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2844
2845 \param pMac - global mac structure
2846 \return none
2847 \sa
2848 ----------------------------------------------------------------- */
2849void
2850limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2851{
2852 tSirMsgQ mmhMsg;
2853
2854 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2855 mmhMsg.bodyptr = NULL;
2856 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302857 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2859
2860 return;
2861}
2862
2863/** -----------------------------------------------------------------
2864 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2865 after channel switch for spectrum manangement is complete.
2866
2867 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2868
2869 \param pMac - global mac structure
2870 \return none
2871 \sa
2872 ----------------------------------------------------------------- */
2873void
2874limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2875{
2876 tSirMsgQ mmhMsg;
2877
2878 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2879 mmhMsg.bodyptr = NULL;
2880 mmhMsg.bodyval = 0;
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302881 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002882 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2883
2884 return;
2885}
2886
2887void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2888 tANI_U8 smesessionId)
2889{
2890 tSirMsgQ mmhMsg;
2891 tSmeMaxAssocInd *pSmeMaxAssocInd;
2892
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302893 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2894 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 {
2896 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2897 return;
2898 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302899 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2900 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2901 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2903 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2904 pSmeMaxAssocInd->sessionId = smesessionId;
2905 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2906 mmhMsg.bodyptr = pSmeMaxAssocInd;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302907 limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2908 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr),smesessionId);
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05302909 MTRACE(macTrace(pMac, TRACE_CODE_TX_SME_MSG, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2911
2912 return;
2913}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002914#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2915/** -----------------------------------------------------------------
2916 \brief limSendSmeCandidateFoundInd() - sends
2917 eWNI_SME_CANDIDATE_FOUND_IND
2918
2919 After receiving candidate found indication frame from FW, this
2920 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2921 roam candidate(s) are available.
2922
2923 \param pMac - global mac structure
2924 \param psessionEntry - session info
2925 \return none
2926 \sa
2927 ----------------------------------------------------------------- */
2928void
2929limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2930{
2931 tSirMsgQ mmhMsg;
2932 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2933
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302934 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2935 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002936 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302937 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002938 return;
2939 }
2940
Sushant Kaushikb97a0082015-08-31 12:36:45 +05302941#ifdef FEATURE_WLAN_DIAG_SUPPORT
2942 limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_CANDIDATE_FOUND,
2943 NULL, eSIR_SUCCESS, eSIR_SUCCESS);
2944#endif
2945
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002946 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05302947 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeCandidateFoundInd);
2948 pSirSmeCandidateFoundInd->sessionId = sessionId;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002949
2950
2951 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2952 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2953 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2954 mmhMsg.bodyval = 0;
2955
2956 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2957
2958} /*** end limSendSmeCandidateFoundInd() ***/
2959#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD