blob: df31b6f47a869b46658788a9f06cae1982b48ffd [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;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530119 MTRACE(macTraceMsgTx(pMac, 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;
Jeff Johnsone7245742012-09-05 17:12:55 -0700197 MTRACE(macTraceMsgTx(pMac, 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 {
237 if(IS_DOT11_MODE_HT(psessionEntry->dot11mode))
238 {
239 if (pStaDs->htShortGI20Mhz || pStaDs->htShortGI40Mhz )
240 rate_flags |= eHAL_TX_RATE_SGI;
241
c_hpothu5eb1a8e2014-05-23 17:21:00 +0530242 if (pStaDs->htSupportedChannelWidthSet)
c_hpothu44ff4e02014-05-08 00:13:57 +0530243 rate_flags |=eHAL_TX_RATE_HT40;
244 else
245 rate_flags |=eHAL_TX_RATE_HT20;
246 }
247#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 }
265#endif
266 }
267
268 return rate_flags;
269}
Jeff Johnson295189b2012-06-20 16:38:30 -0700270
271/**
272 * limSendSmeJoinReassocRsp()
273 *
274 *FUNCTION:
275 * This function is called by limProcessSmeReqMessages() to send
276 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
277 * above MAC Software.
278 *
279 *PARAMS:
280 *
281 *LOGIC:
282 *
283 *ASSUMPTIONS:
284 * NA
285 *
286 *NOTE:
287 * NA
288 *
289 * @param pMac Pointer to Global MAC structure
290 * @param msgType Indicates message type
291 * @param resultCode Indicates the result of previously issued
292 * eWNI_SME_msgType_REQ message
293 *
294 * @return None
295 */
296
297void
298limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
299 tSirResultCodes resultCode, tANI_U16 protStatusCode,
300 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
301{
302 tpSirSmeJoinRsp pSirSmeJoinRsp;
303 tANI_U32 rspLen;
304 tpDphHashNode pStaDs = NULL;
305
306#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
307 if (msgType == eWNI_SME_REASSOC_RSP)
308 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
309 else
310 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
311#endif //FEATURE_WLAN_DIAG_SUPPORT
312
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530313 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700314 FL("Sending message %s with reasonCode %s"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530315 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 if(psessionEntry == NULL)
318 {
319
320 rspLen = sizeof(tSirSmeJoinRsp);
321
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530322 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
323 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 {
325 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530326 limLog(pMac, LOGP, FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 return;
328 }
329
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530330 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700331
332
333 pSirSmeJoinRsp->beaconLength = 0;
334 pSirSmeJoinRsp->assocReqLength = 0;
335 pSirSmeJoinRsp->assocRspLength = 0;
336 }
337
338 else
339 {
340 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
341 psessionEntry->bcnLen +
342#ifdef WLAN_FEATURE_VOWIFI_11R
343 psessionEntry->RICDataLen +
344#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800345#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 psessionEntry->tspecLen +
347#endif
348 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530349
350 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
351 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 {
353 /// Buffer not available. Log error
354 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530355 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357 return;
358 }
359
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530360 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700361
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 if (resultCode == eSIR_SME_SUCCESS)
363 {
364 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
365 if (pStaDs == NULL)
366 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700367 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 }
369 else
370 {
Jeff Johnson62c27982013-02-27 17:53:55 -0800371 //Pass the peer's staId
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 pSirSmeJoinRsp->staId = pStaDs->staIndex;
Jeff Johnson62c27982013-02-27 17:53:55 -0800373 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
374 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
c_hpothu44ff4e02014-05-08 00:13:57 +0530375 pSirSmeJoinRsp->maxRateFlags =
376 limGetMaxRateFlags(pStaDs, psessionEntry);
377 PELOGE(limLog(pMac, LOG1, FL("maxRateFlags: %x"),
378 pSirSmeJoinRsp->maxRateFlags);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 }
380 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700381
382 pSirSmeJoinRsp->beaconLength = 0;
383 pSirSmeJoinRsp->assocReqLength = 0;
384 pSirSmeJoinRsp->assocRspLength = 0;
385#ifdef WLAN_FEATURE_VOWIFI_11R
386 pSirSmeJoinRsp->parsedRicRspLen = 0;
387#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800388#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 pSirSmeJoinRsp->tspecIeLen = 0;
390#endif
391
392 if(resultCode == eSIR_SME_SUCCESS)
393 {
394
395 if(psessionEntry->beacon != NULL)
396 {
397 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530398 vos_mem_copy( pSirSmeJoinRsp->frames, psessionEntry->beacon,
399 pSirSmeJoinRsp->beaconLength);
400 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 psessionEntry->beacon = NULL;
402#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700403 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d"), psessionEntry->bcnLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700404#endif
405 }
406
407 if(psessionEntry->assocReq != NULL)
408 {
409 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530410 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen,
411 psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
412 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 psessionEntry->assocReq = NULL;
414#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700415 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d"), psessionEntry->assocReqLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700416#endif
417 }
418 if(psessionEntry->assocRsp != NULL)
419 {
420 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530421 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
422 psessionEntry->assocReqLen,
423 psessionEntry->assocRsp,
424 pSirSmeJoinRsp->assocRspLength);
425 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 psessionEntry->assocRsp = NULL;
427 }
428#ifdef WLAN_FEATURE_VOWIFI_11R
429 if(psessionEntry->ricData != NULL)
430 {
431 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530432 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
433 psessionEntry->assocReqLen + psessionEntry->assocRspLen,
434 psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
435 vos_mem_free(psessionEntry->ricData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 psessionEntry->ricData = NULL;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700437 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
439#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800440#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 if(psessionEntry->tspecIes != NULL)
442 {
443 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530444 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
445 psessionEntry->assocReqLen + psessionEntry->assocRspLen +
446 psessionEntry->RICDataLen,
447 psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
448 vos_mem_free(psessionEntry->tspecIes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449 psessionEntry->tspecIes = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800450 PELOG1(limLog(pMac, LOG1, FL("ESE-TspecLen=%d"), psessionEntry->tspecLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 }
452#endif
453 pSirSmeJoinRsp->aid = psessionEntry->limAID;
454#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700455 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d"), psessionEntry->assocRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700456#endif
457 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700458 else
459 {
460
461 if(psessionEntry->beacon != NULL)
462 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530463 vos_mem_free(psessionEntry->beacon);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700464 psessionEntry->beacon = NULL;
465 }
466
467 if(psessionEntry->assocReq != NULL)
468 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530469 vos_mem_free( psessionEntry->assocReq);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700470 psessionEntry->assocReq = NULL;
471 }
472
473 if(psessionEntry->assocRsp != NULL)
474 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530475 vos_mem_free( psessionEntry->assocRsp);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700476 psessionEntry->assocRsp = NULL;
477 }
478
479 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 }
481
482
483 pSirSmeJoinRsp->messageType = msgType;
484 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
485 pSirSmeJoinRsp->statusCode = resultCode;
486 pSirSmeJoinRsp->protStatusCode = protStatusCode;
487
488 /* Update SME session ID and transaction Id */
489 pSirSmeJoinRsp->sessionId = smesessionId;
490 pSirSmeJoinRsp->transactionId = smetransactionId;
491
492 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
493 {
494 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
495 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700496
497#ifdef WLAN_FEATURE_11AC
498 if (psessionEntry->vhtCapability)
499 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700500 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700501 /*Get 11ac cbState from 11n cbState*/
502 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
503 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700504 psessionEntry->htSecondaryChannelOffset,
505 psessionEntry->apCenterChan,
506 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700507 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
508 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700509 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700510#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700511 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 }
513 else
514 {
515 peSetResumeChannel( pMac, 0, 0);
516 }
517 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
518 (tANI_U32*) pSirSmeJoinRsp );
519 }
520 else
521 {
522 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
523 (tANI_U32*) pSirSmeJoinRsp );
524 }
525} /*** end limSendSmeJoinReassocRsp() ***/
526
527
Jeff Johnson295189b2012-06-20 16:38:30 -0700528/**
529 * limSendSmeStartBssRsp()
530 *
531 *FUNCTION:
532 * This function is called to send eWNI_SME_START_BSS_RSP
533 * message to applications above MAC Software.
534 *
535 *PARAMS:
536 *
537 *LOGIC:
538 *
539 *ASSUMPTIONS:
540 * NA
541 *
542 *NOTE:
543 * NA
544 *
545 * @param pMac Pointer to Global MAC structure
546 * @param msgType Indicates message type
547 * @param resultCode Indicates the result of previously issued
548 * eWNI_SME_msgType_REQ message
549 *
550 * @return None
551 */
552
553void
554limSendSmeStartBssRsp(tpAniSirGlobal pMac,
555 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
556 tANI_U8 smesessionId,tANI_U16 smetransactionId)
557{
558
559
560 tANI_U16 size = 0;
561 tSirMsgQ mmhMsg;
562 tSirSmeStartBssRsp *pSirSmeRsp;
563 tANI_U16 ieLen;
564 tANI_U16 ieOffset, curLen;
565
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530566 limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
567 limMsgStr(msgType), limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700568
569 size = sizeof(tSirSmeStartBssRsp);
570
571 if(psessionEntry == NULL)
572 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530573 pSirSmeRsp = vos_mem_malloc(size);
574 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 {
576 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530577 limLog(pMac, LOGP,FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 return;
579 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530580 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
582 }
583 else
584 {
585 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
586 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
587 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
588 //calculate the memory size to allocate
589 size += ieLen;
590
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530591 pSirSmeRsp = vos_mem_malloc(size);
592 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 {
594 /// Buffer not available. Log error
595 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530596 FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700597
598 return;
599 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530600 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 size = sizeof(tSirSmeStartBssRsp);
602 if (resultCode == eSIR_SME_SUCCESS)
603 {
604
605 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
606
607 /* Read beacon interval from session */
608 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
609 pSirSmeRsp->bssType = psessionEntry->bssType;
610
611 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
612 != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700613 limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
615 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
616
617#if 0
618 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700619 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700620
621#endif// TO SUPPORT BT-AMP
622
623 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
624
625 pSirSmeRsp->bssDescription.aniIndicator = 1;
626
627 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530628 vos_mem_copy( (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
630 (tANI_U32)curLen);
631
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530632 vos_mem_copy( ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 pMac->sch.schObject.gSchBeaconFrameEnd,
634 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
635
636
637 //subtracting size of length indicator itself and size of pointer to ieFields
638 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
639 sizeof(tANI_U16) - sizeof(tANI_U32) +
640 ieLen;
641 //This is the size of the message, subtracting the size of the pointer to ieFields
642 size += ieLen - sizeof(tANI_U32);
643 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 }
645
646 pSirSmeRsp->messageType = msgType;
647 pSirSmeRsp->length = size;
648
649 /* Update SME session Id and transaction Id */
650 pSirSmeRsp->sessionId = smesessionId;
651 pSirSmeRsp->transactionId = smetransactionId;
652 pSirSmeRsp->statusCode = resultCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 if(psessionEntry != NULL )
654 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
655
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657 mmhMsg.type = msgType;
658 mmhMsg.bodyptr = pSirSmeRsp;
659 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800660 if(psessionEntry == NULL)
661 {
662 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
663 }
664 else
665 {
666 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
667 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700668#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
669 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
670#endif //FEATURE_WLAN_DIAG_SUPPORT
671
672 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
673} /*** end limSendSmeStartBssRsp() ***/
674
Jeff Johnson295189b2012-06-20 16:38:30 -0700675#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
676#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
677
678
679/**
680 * limSendSmeScanRsp()
681 *
682 *FUNCTION:
683 * This function is called by limProcessSmeReqMessages() to send
684 * eWNI_SME_SCAN_RSP message to applications above MAC
685 * Software.
686 *
687 *PARAMS:
688 *
689 *LOGIC:
690 *
691 *ASSUMPTIONS:
692 * NA
693 *
694 *NOTE:
695 * NA
696 *
697 * @param pMac Pointer to Global MAC structure
698 * @param length Indicates length of message
699 * @param resultCode Indicates the result of previously issued
700 * eWNI_SME_SCAN_REQ message
701 *
702 * @return None
703 */
704
705void
706limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
707 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
708{
709 tSirMsgQ mmhMsg;
710 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
711 tLimScanResultNode *ptemp = NULL;
712 tANI_U16 msgLen, allocLength, curMsgLen = 0;
713 tANI_U16 i, bssCount;
714 tANI_U8 *pbBuf;
715 tSirBssDescription *pDesc;
716
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530717 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700718 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530719 length, limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -0700720
721 if (resultCode != eSIR_SME_SUCCESS)
722 {
723 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
724 return;
725 }
726
727 mmhMsg.type = eWNI_SME_SCAN_RSP;
728 i = 0;
729 bssCount = 0;
730 msgLen = 0;
731 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530732 pSirSmeScanRsp = vos_mem_malloc(allocLength);
733 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 {
735 // Log error
736 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530737 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
739 return;
740 }
741 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
742 {
743 //when ptemp is not NULL it is a left over
744 ptemp = pMac->lim.gLimCachedScanHashTable[i];
745 while(ptemp)
746 {
747 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
748 if(0 == bssCount)
749 {
750 msgLen = sizeof(tSirSmeScanRsp) -
751 sizeof(tSirBssDescription) +
752 ptemp->bssDescription.length +
753 sizeof(ptemp->bssDescription.length);
754 pDesc = pSirSmeScanRsp->bssDescription;
755 }
756 else
757 {
758 msgLen += ptemp->bssDescription.length +
759 sizeof(ptemp->bssDescription.length);
760 pDesc = (tSirBssDescription *)pbBuf;
761 }
762 if( (allocLength < msgLen) ||
763 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
764 {
765 pSirSmeScanRsp->statusCode =
766 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
768 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 mmhMsg.bodyptr = pSirSmeScanRsp;
770 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530773 pSirSmeScanRsp = vos_mem_malloc(allocLength);
774 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 {
776 // Log error
777 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530778 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 return;
780 }
781 msgLen = sizeof(tSirSmeScanRsp) -
782 sizeof(tSirBssDescription) +
783 ptemp->bssDescription.length +
784 sizeof(ptemp->bssDescription.length);
785 pDesc = pSirSmeScanRsp->bssDescription;
786 bssCount = 1;
787 }
788 curMsgLen = msgLen;
789
Abhishek Singh525045c2014-12-15 17:18:45 +0530790 limLog(pMac, LOG1, FL("ScanRsp : msgLen %d, bssDescr Len=%d"),
791 msgLen, ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 pDesc->length
793 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530794 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
795 (tANI_U8 *) &ptemp->bssDescription.bssId,
796 ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700797
Abhishek Singh525045c2014-12-15 17:18:45 +0530798 limLog(pMac, LOG1, FL("BssId "));
799 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700800
801 pSirSmeScanRsp->sessionId = smesessionId;
802 pSirSmeScanRsp->transcationId = smetranscationId;
803
804 ptemp = ptemp->next;
805 } //while(ptemp)
806 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
807
808 if(0 == bssCount)
809 {
810 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700811 if (NULL != pSirSmeScanRsp)
812 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530813 vos_mem_free( pSirSmeScanRsp);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700814 pSirSmeScanRsp = NULL;
815 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 }
817 else
818 {
819 // send last message
820 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700821 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
822 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700823
824 /* Update SME session Id and SME transcation Id */
825 pSirSmeScanRsp->sessionId = smesessionId;
826 pSirSmeScanRsp->transcationId = smetranscationId;
827
828 mmhMsg.type = eWNI_SME_SCAN_RSP;
829 mmhMsg.bodyptr = pSirSmeScanRsp;
830 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700831 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Abhishek Singh525045c2014-12-15 17:18:45 +0530833 limLog(pMac, LOG1, FL("statusCode : eSIR_SME_SUCCESS"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 }
835
836 return;
837
838} /*** end limSendSmeScanRsp() ***/
839
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700840#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
841/**
842 * limSendSmeLfrScanRsp()
843 *
844 *FUNCTION:
845 * This function is called by limProcessSmeReqMessages() to send
846 * eWNI_SME_SCAN_RSP message to applications above MAC Software
847 * only for sending up the roam candidates.
848 *
849 *PARAMS:
850 *
851 *LOGIC:
852 *
853 *ASSUMPTIONS:
854 * NA
855 *
856 *NOTE:
857 * NA
858 *
859 * @param pMac Pointer to Global MAC structure
860 * @param length Indicates length of message
861 * @param resultCode Indicates the result of previously issued
862 * eWNI_SME_SCAN_REQ message
863 *
864 * @return None
865 */
866
867void
868limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
869 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
870{
871 tSirMsgQ mmhMsg;
872 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
873 tLimScanResultNode *ptemp = NULL;
874 tANI_U16 msgLen, allocLength, curMsgLen = 0;
875 tANI_U16 i, bssCount;
876 tANI_U8 *pbBuf;
877 tSirBssDescription *pDesc;
878
879 PELOG1(limLog(pMac, LOG1,
880 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
881 length, limResultCodeStr(resultCode));)
882
883 if (resultCode != eSIR_SME_SUCCESS)
884 {
885 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
886 return;
887 }
888
889 mmhMsg.type = eWNI_SME_SCAN_RSP;
890 i = 0;
891 bssCount = 0;
892 msgLen = 0;
893 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530894 pSirSmeScanRsp = vos_mem_malloc(allocLength);
895 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700896 {
897 // Log error
898 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530899 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700900
901 return;
902 }
903 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
904 {
905 //when ptemp is not NULL it is a left over
906 ptemp = pMac->lim.gLimCachedLfrScanHashTable[i];
907 while(ptemp)
908 {
909 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
910 if(0 == bssCount)
911 {
912 msgLen = sizeof(tSirSmeScanRsp) -
913 sizeof(tSirBssDescription) +
914 ptemp->bssDescription.length +
915 sizeof(ptemp->bssDescription.length);
916 pDesc = pSirSmeScanRsp->bssDescription;
917 }
918 else
919 {
920 msgLen += ptemp->bssDescription.length +
921 sizeof(ptemp->bssDescription.length);
922 pDesc = (tSirBssDescription *)pbBuf;
923 }
924 if ( (allocLength < msgLen) ||
925 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
926 {
927 pSirSmeScanRsp->statusCode =
928 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
929 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
930 pSirSmeScanRsp->length = curMsgLen;
931 mmhMsg.bodyptr = pSirSmeScanRsp;
932 mmhMsg.bodyval = 0;
933 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
934 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530935 pSirSmeScanRsp = vos_mem_malloc(allocLength);
936 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700937 {
938 // Log error
939 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530940 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700941 return;
942 }
943 msgLen = sizeof(tSirSmeScanRsp) -
944 sizeof(tSirBssDescription) +
945 ptemp->bssDescription.length +
946 sizeof(ptemp->bssDescription.length);
947 pDesc = pSirSmeScanRsp->bssDescription;
948 bssCount = 1;
949 }
950 curMsgLen = msgLen;
951
952 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
953 msgLen, ptemp->bssDescription.length);)
954 pDesc->length
955 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530956 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
957 (tANI_U8 *) &ptemp->bssDescription.bssId,
958 ptemp->bssDescription.length);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700959
960 PELOG2(limLog(pMac, LOG2, FL("BssId "));
961 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
962
963 pSirSmeScanRsp->sessionId = smesessionId;
964 pSirSmeScanRsp->transcationId = smetranscationId;
965
966 ptemp = ptemp->next;
967 } //while(ptemp)
968 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
969
970 if (0 == bssCount)
971 {
972 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
973 if (NULL != pSirSmeScanRsp)
974 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530975 vos_mem_free( pSirSmeScanRsp);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700976 pSirSmeScanRsp = NULL;
977 }
978 }
979 else
980 {
981 // send last message
982 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
983 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
984 pSirSmeScanRsp->length = curMsgLen;
985
986 /* Update SME session Id and SME transcation Id */
987 pSirSmeScanRsp->sessionId = smesessionId;
988 pSirSmeScanRsp->transcationId = smetranscationId;
989
990 mmhMsg.type = eWNI_SME_SCAN_RSP;
991 mmhMsg.bodyptr = pSirSmeScanRsp;
992 mmhMsg.bodyval = 0;
993 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
994 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
995 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
996 }
997
998 return;
999
1000} /*** end limSendSmeLfrScanRsp() ***/
1001#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
1003/**
1004 * limPostSmeScanRspMessage()
1005 *
1006 *FUNCTION:
1007 * This function is called by limSendSmeScanRsp() to send
1008 * eWNI_SME_SCAN_RSP message with failed result code
1009 *
1010 *NOTE:
1011 * NA
1012 *
1013 * @param pMac Pointer to Global MAC structure
1014 * @param length Indicates length of message
1015 * @param resultCode failed result code
1016 *
1017 * @return None
1018 */
1019
1020void
1021limPostSmeScanRspMessage(tpAniSirGlobal pMac,
1022 tANI_U16 length,
1023 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1024{
1025 tpSirSmeScanRsp pSirSmeScanRsp;
1026 tSirMsgQ mmhMsg;
1027
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301028 limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001029 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301030 length, limResultCodeStr(resultCode));
Jeff Johnson295189b2012-06-20 16:38:30 -07001031
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301032 pSirSmeScanRsp = vos_mem_malloc(length);
1033 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301035 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 return;
1037 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301038 vos_mem_set((void*)pSirSmeScanRsp, length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1041 pSirSmeScanRsp->length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -07001042
1043 if(sizeof(tSirSmeScanRsp) <= length)
1044 {
1045 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
1046 }
1047
1048 pSirSmeScanRsp->statusCode = resultCode;
1049
1050 /*Update SME session Id and transaction Id */
1051 pSirSmeScanRsp->sessionId = smesessionId;
1052 pSirSmeScanRsp->transcationId = smetransactionId;
1053
1054 mmhMsg.type = eWNI_SME_SCAN_RSP;
1055 mmhMsg.bodyptr = pSirSmeScanRsp;
1056 mmhMsg.bodyval = 0;
1057
Jeff Johnsone7245742012-09-05 17:12:55 -07001058 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001059#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1060 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
1061#endif //FEATURE_WLAN_DIAG_SUPPORT
1062
1063 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1064 return;
1065
1066} /*** limPostSmeScanRspMessage ***/
1067
Jeff Johnsone7245742012-09-05 17:12:55 -07001068#ifdef FEATURE_OEM_DATA_SUPPORT
1069
1070/**
1071 * limSendSmeOemDataRsp()
1072 *
1073 *FUNCTION:
1074 * This function is called by limProcessSmeReqMessages() to send
1075 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
1076 * Software.
1077 *
1078 *PARAMS:
1079 *
1080 *LOGIC:
1081 *
1082 *ASSUMPTIONS:
1083 * NA
1084 *
1085 *NOTE:
1086 * NA
1087 *
1088 * @param pMac Pointer to Global MAC structure
1089 * @param pMsgBuf Indicates the mlm message
1090 * @param resultCode Indicates the result of previously issued
1091 * eWNI_SME_OEM_DATA_RSP message
1092 *
1093 * @return None
1094 */
1095
1096void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
1097{
1098 tSirMsgQ mmhMsg;
1099 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
1100 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
1101 tANI_U16 msgLength;
1102
1103
1104 //get the pointer to the mlm message
1105 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
1106
1107 msgLength = sizeof(tSirOemDataRsp);
1108
1109 //now allocate memory for the char buffer
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301110 pSirSmeOemDataRsp = vos_mem_malloc(msgLength);
1111 if (NULL == pSirSmeOemDataRsp)
Jeff Johnsone7245742012-09-05 17:12:55 -07001112 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301113 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSirSmeOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001114 return;
1115 }
1116
1117#if defined (ANI_LITTLE_BYTE_ENDIAN)
1118 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
1119 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
1120#else
1121 pSirSmeOemDataRsp->length = msgLength;
1122 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
1123#endif
1124
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301125 vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001126
1127 //Now free the memory from MLM Rsp Message
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301128 vos_mem_free(pMlmOemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001129
1130 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
1131 mmhMsg.bodyptr = pSirSmeOemDataRsp;
1132 mmhMsg.bodyval = 0;
1133
1134 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1135
1136 return;
1137} /*** limSendSmeOemDataRsp ***/
1138
1139#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001140
1141
1142/**
1143 * limSendSmeAuthRsp()
1144 *
1145 *FUNCTION:
1146 * This function is called by limProcessSmeMessages() to send
1147 * eWNI_SME_AUTH_RSP message to host
1148 *
1149 *PARAMS:
1150 *
1151 *LOGIC:
1152 *
1153 *ASSUMPTIONS:
1154 * NA
1155 *
1156 *NOTE:
1157 * NA
1158 *
1159 * @param pMac Pointer to Global MAC structure
1160 * @param statusCode Indicates the result of previously issued
1161 * eWNI_SME_AUTH_REQ message
1162 *
1163 * @return None
1164 */
1165void
1166limSendSmeAuthRsp(tpAniSirGlobal pMac,
1167 tSirResultCodes statusCode,
1168 tSirMacAddr peerMacAddr,
1169 tAniAuthType authType,
1170 tANI_U16 protStatusCode,
1171 tpPESession psessionEntry,tANI_U8 smesessionId,
1172 tANI_U16 smetransactionId)
1173{
1174#if 0
1175 tSirMsgQ mmhMsg;
1176 tSirSmeAuthRsp *pSirSmeAuthRsp;
1177
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301178 pSirSmeAuthRsp = vos_mem_malloc(sizeof(tSirSmeAuthRsp));
1179 if (NULL == pSirSmeAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 {
1181 // Log error
1182 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301183 FL("call to AllocateMemory failed for eWNI_SME_AUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001184
1185 return;
1186 }
1187
Jeff Johnson295189b2012-06-20 16:38:30 -07001188
1189
1190 if(psessionEntry != NULL)
1191 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301192 vos_mem_copy( (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1194 pSirSmeAuthRsp->authType = authType;
1195
1196 }
1197
1198 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1199 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1200 pSirSmeAuthRsp->statusCode = statusCode;
1201 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1202
1203 /* Update SME session and transaction Id*/
1204 pSirSmeAuthRsp->sessionId = smesessionId;
1205 pSirSmeAuthRsp->transactionId = smetransactionId;
1206
1207 mmhMsg.type = eWNI_SME_AUTH_RSP;
1208 mmhMsg.bodyptr = pSirSmeAuthRsp;
1209 mmhMsg.bodyval = 0;
1210 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1211 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1212#endif
1213} /*** end limSendSmeAuthRsp() ***/
1214
1215
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001216void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 eHalStatus status, tANI_U32 *pCtx )
1218{
1219 tSirMsgQ mmhMsg;
1220 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1221
1222 mmhMsg.type = pMsg->type;
1223 mmhMsg.bodyptr = pMsg;
1224 mmhMsg.bodyval = 0;
1225
Jeff Johnsone7245742012-09-05 17:12:55 -07001226 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001227
1228 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1229}
1230/**
1231 * limSendSmeDisassocNtf()
1232 *
1233 *FUNCTION:
1234 * This function is called by limProcessSmeMessages() to send
1235 * eWNI_SME_DISASSOC_RSP/IND message to host
1236 *
1237 *PARAMS:
1238 *
1239 *LOGIC:
1240 *
1241 *ASSUMPTIONS:
1242 * NA
1243 *
1244 *NOTE:
1245 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1246 * or eWNI_SME_DISASSOC_IND to host depending on
1247 * disassociation trigger.
1248 *
1249 * @param peerMacAddr Indicates the peer MAC addr to which
1250 * disassociate was initiated
1251 * @param reasonCode Indicates the reason for Disassociation
1252 * @param disassocTrigger Indicates the trigger for Disassociation
1253 * @param aid Indicates the STAID. This parameter is
1254 * present only on AP.
1255 *
1256 * @return None
1257 */
1258void
1259limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1260 tSirMacAddr peerMacAddr,
1261 tSirResultCodes reasonCode,
1262 tANI_U16 disassocTrigger,
1263 tANI_U16 aid,
1264 tANI_U8 smesessionId,
1265 tANI_U16 smetransactionId,
1266 tpPESession psessionEntry)
1267{
1268
1269 tANI_U8 *pBuf;
1270 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1271 tSirSmeDisassocInd *pSirSmeDisassocInd;
1272 tANI_U32 *pMsg;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301273
1274 limLog(pMac, LOG1, FL("Disassoc Ntf with trigger : %d"
1275 "reasonCode: %d"),
1276 disassocTrigger,
1277 reasonCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001278
1279 switch (disassocTrigger)
1280 {
1281 case eLIM_PEER_ENTITY_DISASSOC:
Sachin Ahuja48431cf2014-07-15 00:24:48 +05301282 if (reasonCode != eSIR_SME_STA_NOT_ASSOCIATED)
1283 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001284
1285 case eLIM_HOST_DISASSOC:
1286 /**
1287 * Disassociation response due to
1288 * host triggered disassociation
1289 */
1290
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301291 pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
1292 if ( NULL == pSirSmeDisassocRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 {
1294 // Log error
1295 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301296 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
1298 return;
1299 }
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05301300 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with "
Abhishek Singhcd09b562013-12-24 16:02:20 +05301301 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1302 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1304 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 //sessionId
1306 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1307 *pBuf = smesessionId;
1308 pBuf++;
1309
1310 //transactionId
1311 limCopyU16(pBuf, smetransactionId);
1312 pBuf += sizeof(tANI_U16);
1313
1314 //statusCode
1315 limCopyU32(pBuf, reasonCode);
1316 pBuf += sizeof(tSirResultCodes);
1317
1318 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301319 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 pBuf += sizeof(tSirMacAddr);
1321
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 // Clear Station Stats
1323 //for sta, it is always 1, IBSS is handled at halInitSta
1324
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
1326
1327#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301328
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1330 psessionEntry, (tANI_U16)reasonCode, 0);
1331#endif
1332 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1333 break;
1334
1335 default:
1336 /**
1337 * Disassociation indication due to Disassociation
1338 * frame reception from peer entity or due to
1339 * loss of link with peer entity.
1340 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301341 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1342 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 {
1344 // Log error
1345 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301346 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001347
1348 return;
1349 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301350 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1351 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1352 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1354 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1355
1356 /* Update SME session Id and Transaction Id */
1357 pSirSmeDisassocInd->sessionId = smesessionId;
1358 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001359 pSirSmeDisassocInd->reasonCode = reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1361
1362 limCopyU32(pBuf, reasonCode);
1363 pBuf += sizeof(tSirResultCodes);
1364
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301365 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 pBuf += sizeof(tSirMacAddr);
1367
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301368 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001369
1370
1371#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1372 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1373 psessionEntry, (tANI_U16)reasonCode, 0);
1374#endif
1375 pMsg = (tANI_U32*) pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001376
1377 break;
1378 }
1379
1380 /* Delete the PE session Created */
1381 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1382 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1383 {
1384 peDeleteSession(pMac,psessionEntry);
1385 }
1386
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001387 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001389} /*** end limSendSmeDisassocNtf() ***/
1390
1391
1392/** -----------------------------------------------------------------
1393 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1394
1395 After receiving disassociation frame from peer entity, this
1396 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1397 reason code.
1398
1399 \param pMac - global mac structure
1400 \param pStaDs - station dph hash node
1401 \return none
1402 \sa
1403 ----------------------------------------------------------------- */
1404void
1405limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1406{
1407 tSirMsgQ mmhMsg;
1408 tSirSmeDisassocInd *pSirSmeDisassocInd;
1409
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301410 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1411 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001412 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301413 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 return;
1415 }
1416
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1418 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
Jeff Johnson295189b2012-06-20 16:38:30 -07001420 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1421 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1422 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001423 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301424
1425 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1426
1427 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
Jeff Johnson295189b2012-06-20 16:38:30 -07001429 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301430
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1432 mmhMsg.bodyptr = pSirSmeDisassocInd;
1433 mmhMsg.bodyval = 0;
1434
Jeff Johnsone7245742012-09-05 17:12:55 -07001435 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001436#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1437 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1438#endif //FEATURE_WLAN_DIAG_SUPPORT
1439
1440 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1441
1442} /*** end limSendSmeDisassocInd() ***/
1443
1444
1445/** -----------------------------------------------------------------
1446 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1447
1448 After receiving deauthentication frame from peer entity, this
1449 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1450 reason code.
1451
1452 \param pMac - global mac structure
1453 \param pStaDs - station dph hash node
1454 \return none
1455 \sa
1456 ----------------------------------------------------------------- */
1457void
1458limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1459{
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 tSirMsgQ mmhMsg;
1461 tSirSmeDeauthInd *pSirSmeDeauthInd;
1462
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301463 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1464 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301466 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 return;
1468 }
1469
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1471 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1474 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1475 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1476 {
1477 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1478 }
1479 else
1480 {
1481 //Need to indicatet he reascon code over the air
1482 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1483 }
1484 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301485 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301487 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001488 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001489
Jeff Johnson295189b2012-06-20 16:38:30 -07001490
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
1493 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1494 mmhMsg.bodyptr = pSirSmeDeauthInd;
1495 mmhMsg.bodyval = 0;
1496
Jeff Johnsone7245742012-09-05 17:12:55 -07001497 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001498#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1499 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1500#endif //FEATURE_WLAN_DIAG_SUPPORT
1501
1502 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1503 return;
1504} /*** end limSendSmeDeauthInd() ***/
1505
Hoonki Leee6bfe942013-02-05 15:01:19 -08001506#ifdef FEATURE_WLAN_TDLS
1507/**
1508 * limSendSmeTDLSDelStaInd()
1509 *
1510 *FUNCTION:
1511 * This function is called to send the TDLS STA context deletion to SME.
1512 *
1513 *LOGIC:
1514 *
1515 *ASSUMPTIONS:
1516 *
1517 *NOTE:
1518 * NA
1519 *
1520 * @param pMac - Pointer to global MAC structure
1521 * @param pStaDs - Pointer to internal STA Datastructure
1522 * @param psessionEntry - Pointer to the session entry
1523 * @param reasonCode - Reason for TDLS sta deletion
1524 * @return None
1525 */
1526void
1527limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1528{
1529 tSirMsgQ mmhMsg;
1530 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1531
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301532 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1533 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001534 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301535 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001536 return;
1537 }
1538
1539 //messageType
1540 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1541 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1542
1543 //sessionId
1544 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1545
1546 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301547 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001548
1549 //staId
1550 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1551
1552 //reasonCode
1553 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1554
1555 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1556 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1557 mmhMsg.bodyval = 0;
1558
1559
1560 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1561 return;
1562}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001563
1564/**
1565 * limSendSmeTDLSDeleteAllPeerInd()
1566 *
1567 *FUNCTION:
1568 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1569 * message to SME.
1570 *
1571 *LOGIC:
1572 *
1573 *ASSUMPTIONS:
1574 *
1575 *NOTE:
1576 * NA
1577 *
1578 * @param pMac - Pointer to global MAC structure
1579 * @param psessionEntry - Pointer to the session entry
1580 * @return None
1581 */
1582void
1583limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1584{
1585 tSirMsgQ mmhMsg;
1586 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1587
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301588 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1589 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001590 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301591 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001592 return;
1593 }
1594
1595 //messageType
1596 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1597 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1598
1599 //sessionId
1600 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1601
1602 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1603 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1604 mmhMsg.bodyval = 0;
1605
1606
1607 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1608 return;
1609}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001610
1611/**
1612 * limSendSmeMgmtTXCompletion()
1613 *
1614 *FUNCTION:
1615 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_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 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1628 * @return None
1629 */
1630void
1631limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
1632 tpPESession psessionEntry,
1633 tANI_U32 txCompleteStatus)
1634{
1635 tSirMsgQ mmhMsg;
1636 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1637
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301638 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1639 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001640 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301641 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001642 return;
1643 }
1644
1645 //messageType
1646 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1647 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1648
1649 //sessionId
1650 pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
1651
1652 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1653
1654 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1655 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1656 mmhMsg.bodyval = 0;
1657
1658
1659 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1660 return;
1661}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001662#endif
1663
Jeff Johnson295189b2012-06-20 16:38:30 -07001664
1665/**
1666 * limSendSmeDeauthNtf()
1667 *
1668 *FUNCTION:
1669 * This function is called by limProcessSmeMessages() to send
1670 * eWNI_SME_DISASSOC_RSP/IND message to host
1671 *
1672 *PARAMS:
1673 *
1674 *LOGIC:
1675 *
1676 *ASSUMPTIONS:
1677 * NA
1678 *
1679 *NOTE:
1680 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1681 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1682 *
1683 * @param peerMacAddr Indicates the peer MAC addr to which
1684 * deauthentication was initiated
1685 * @param reasonCode Indicates the reason for Deauthetication
1686 * @param deauthTrigger Indicates the trigger for Deauthetication
1687 * @param aid Indicates the STAID. This parameter is present
1688 * only on AP.
1689 *
1690 * @return None
1691 */
1692void
1693limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1694 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1695{
1696 tANI_U8 *pBuf;
1697 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1698 tSirSmeDeauthInd *pSirSmeDeauthInd;
1699 tpPESession psessionEntry;
1700 tANI_U8 sessionId;
1701 tANI_U32 *pMsg;
1702
1703 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1704 switch (deauthTrigger)
1705 {
1706 case eLIM_PEER_ENTITY_DEAUTH:
1707 return;
1708
1709 case eLIM_HOST_DEAUTH:
1710 /**
1711 * Deauthentication response to host triggered
1712 * deauthentication.
1713 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301714 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1715 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 {
1717 // Log error
1718 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301719 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001720
1721 return;
1722 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301723 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1724 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1725 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001726 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1727 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 pSirSmeDeauthRsp->statusCode = reasonCode;
1729 pSirSmeDeauthRsp->sessionId = smesessionId;
1730 pSirSmeDeauthRsp->transactionId = smetransactionId;
1731
1732 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301733 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001734
Jeff Johnson295189b2012-06-20 16:38:30 -07001735#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1736 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1737 psessionEntry, 0, (tANI_U16)reasonCode);
1738#endif
1739 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1740
1741 break;
1742
1743 default:
1744 /**
1745 * Deauthentication indication due to Deauthentication
1746 * frame reception from peer entity or due to
1747 * loss of link with peer entity.
1748 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301749 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1750 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 {
1752 // Log error
1753 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301754 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001755
1756 return;
1757 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301758 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1759 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1760 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1762 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001763 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Jeff Johnson295189b2012-06-20 16:38:30 -07001764
1765 // sessionId
1766 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1767 *pBuf++ = smesessionId;
1768
1769 //transaction ID
1770 limCopyU16(pBuf, smetransactionId);
1771 pBuf += sizeof(tANI_U16);
1772
1773 // status code
1774 limCopyU32(pBuf, reasonCode);
1775 pBuf += sizeof(tSirResultCodes);
1776
1777 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301778 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001779 pBuf += sizeof(tSirMacAddr);
1780
1781 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301782 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001783
Jeff Johnson295189b2012-06-20 16:38:30 -07001784#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1785 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1786 psessionEntry, 0, (tANI_U16)reasonCode);
1787#endif //FEATURE_WLAN_DIAG_SUPPORT
1788 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1789
1790 break;
1791 }
1792
1793 /*Delete the PE session created */
1794 if(psessionEntry != NULL)
1795 {
1796 peDeleteSession(pMac,psessionEntry);
1797 }
1798
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001799 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1800 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001801
Jeff Johnson295189b2012-06-20 16:38:30 -07001802} /*** end limSendSmeDeauthNtf() ***/
1803
1804
1805/**
1806 * limSendSmeWmStatusChangeNtf()
1807 *
1808 *FUNCTION:
1809 * This function is called by limProcessSmeMessages() to send
1810 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1811 *
1812 *PARAMS:
1813 *
1814 *LOGIC:
1815 *
1816 *ASSUMPTIONS:
1817 * NA
1818 *
1819 *NOTE:
1820 *
1821 * @param statusChangeCode Indicates the change in the wireless medium.
1822 * @param statusChangeInfo Indicates the information associated with
1823 * change in the wireless medium.
1824 * @param infoLen Indicates the length of status change information
1825 * being sent.
1826 *
1827 * @return None
1828 */
1829void
1830limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1831 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1832{
1833 tSirMsgQ mmhMsg;
1834 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301835 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1836 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 {
1838 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301839 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 return;
1841 }
1842
Jeff Johnson295189b2012-06-20 16:38:30 -07001843
1844 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1845 mmhMsg.bodyval = 0;
1846 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1847
1848 switch(statusChangeCode)
1849 {
1850 case eSIR_SME_RADAR_DETECTED:
1851
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 break;
1853
1854 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 break;
1856
1857 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1858 limPackBkgndScanFailNotify(pMac,
1859 statusChangeCode,
1860 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1861 pSirSmeWmStatusChangeNtf, sessionId);
1862 break;
1863
1864 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1866 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1867 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1868 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1870 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301871 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1872 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 }
Sushant Kaushik1b645382014-10-13 16:39:36 +05301874 limLog(pMac, LOGE, FL("***---*** StatusChg: code %d, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 statusChangeCode, infoLen);
1876 break;
1877 }
1878
1879
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001880 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1882 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301883 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001884 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 }
1886
1887} /*** end limSendSmeWmStatusChangeNtf() ***/
1888
1889
1890/**
1891 * limSendSmeSetContextRsp()
1892 *
1893 *FUNCTION:
1894 * This function is called by limProcessSmeMessages() to send
1895 * eWNI_SME_SETCONTEXT_RSP message to host
1896 *
1897 *PARAMS:
1898 *
1899 *LOGIC:
1900 *
1901 *ASSUMPTIONS:
1902 * NA
1903 *
1904 *NOTE:
1905 *
1906 * @param pMac Pointer to Global MAC structure
1907 * @param peerMacAddr Indicates the peer MAC addr to which
1908 * setContext was performed
1909 * @param aid Indicates the aid corresponding to the peer MAC
1910 * address
1911 * @param resultCode Indicates the result of previously issued
1912 * eWNI_SME_SETCONTEXT_RSP message
1913 *
1914 * @return None
1915 */
1916void
1917limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1918 tSirMacAddr peerMacAddr, tANI_U16 aid,
1919 tSirResultCodes resultCode,
1920 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1921{
1922
1923 tANI_U8 *pBuf;
1924 tSirMsgQ mmhMsg;
1925 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1926
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301927 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
1928 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 {
1930 // Log error
1931 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301932 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933
1934 return;
1935 }
1936
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1938 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 pSirSmeSetContextRsp->statusCode = resultCode;
1940
1941 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1942
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301943 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 pBuf += sizeof(tSirMacAddr);
1945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946
1947 /* Update SME session and transaction Id*/
1948 pSirSmeSetContextRsp->sessionId = smesessionId;
1949 pSirSmeSetContextRsp->transactionId = smetransactionId;
1950
1951 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1952 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1953 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08001954 if(NULL == psessionEntry)
1955 {
1956 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
1957 }
1958 else
1959 {
1960 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1961 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001962
1963#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1964 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1965#endif //FEATURE_WLAN_DIAG_SUPPORT
1966
1967 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1968} /*** end limSendSmeSetContextRsp() ***/
1969
1970/**
1971 * limSendSmeRemoveKeyRsp()
1972 *
1973 *FUNCTION:
1974 * This function is called by limProcessSmeMessages() to send
1975 * eWNI_SME_REMOVEKEY_RSP message to host
1976 *
1977 *PARAMS:
1978 *
1979 *LOGIC:
1980 *
1981 *ASSUMPTIONS:
1982 * NA
1983 *
1984 *NOTE:
1985 *
1986 * @param pMac Pointer to Global MAC structure
1987 * @param peerMacAddr Indicates the peer MAC addr to which
1988 * Removekey was performed
1989 * @param aid Indicates the aid corresponding to the peer MAC
1990 * address
1991 * @param resultCode Indicates the result of previously issued
1992 * eWNI_SME_REMOVEKEY_RSP message
1993 *
1994 * @return None
1995 */
1996void
1997limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1998 tSirMacAddr peerMacAddr,
1999 tSirResultCodes resultCode,
2000 tpPESession psessionEntry,tANI_U8 smesessionId,
2001 tANI_U16 smetransactionId)
2002{
2003 tANI_U8 *pBuf;
2004 tSirMsgQ mmhMsg;
2005 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2006
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302007 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
2008 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 {
2010 // Log error
2011 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302012 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002013
2014 return;
2015 }
2016
Jeff Johnson295189b2012-06-20 16:38:30 -07002017
2018
2019 if(psessionEntry != NULL)
2020 {
2021 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302022 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 }
2024
2025 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2026 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2027 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2028
2029 /* Update SME session and transaction Id*/
2030 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2031 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2032
2033 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2034 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2035 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002036 if(NULL == psessionEntry)
2037 {
2038 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2039 }
2040 else
2041 {
2042 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2045} /*** end limSendSmeSetContextRsp() ***/
2046
2047
2048/**
2049 * limSendSmePromiscuousModeRsp()
2050 *
2051 *FUNCTION:
2052 * This function is called by limProcessSmeMessages() to send
2053 * eWNI_PROMISCUOUS_MODE_RSP message to host
2054 *
2055 *PARAMS:
2056 *
2057 *LOGIC:
2058 *
2059 *ASSUMPTIONS:
2060 * NA
2061 *
2062 *NOTE:
2063 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2064 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2065 *
2066 * @param None
2067 * @return None
2068 */
2069void
2070limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2071{
2072#if 0
2073 tSirMsgQ mmhMsg;
2074 tSirMbMsg *pMbMsg;
2075
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302076 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2077 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 {
2079 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302080 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002081
2082 return;
2083 }
2084
2085 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2086 pMbMsg->msgLen = 4;
2087
2088 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2089 mmhMsg.bodyptr = pMbMsg;
2090 mmhMsg.bodyval = 0;
2091 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2092 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2093#endif
2094} /*** end limSendSmePromiscuousModeRsp() ***/
2095
2096
2097
2098/**
2099 * limSendSmeNeighborBssInd()
2100 *
2101 *FUNCTION:
2102 * This function is called by limLookupNaddHashEntry() to send
2103 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2104 *
2105 *PARAMS:
2106 *
2107 *LOGIC:
2108 *
2109 *ASSUMPTIONS:
2110 * NA
2111 *
2112 *NOTE:
2113 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2114 * host upon detecting new BSS during background scanning if CFG
2115 * option is enabled for sending such indication
2116 *
2117 * @param pMac - Pointer to Global MAC structure
2118 * @return None
2119 */
2120
2121void
2122limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2123 tLimScanResultNode *pBssDescr)
2124{
2125 tSirMsgQ msgQ;
2126 tANI_U32 val;
2127 tSirSmeNeighborBssInd *pNewBssInd;
2128
2129 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2130 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2131 pMac->lim.gLimRspReqd))
2132 {
2133 // LIM is not in background scan state OR
2134 // current scan is initiated by HDD.
2135 // No need to send new BSS indication to HDD
2136 return;
2137 }
2138
2139 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2140 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002141 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002142
2143 return;
2144 }
2145
2146 if (val == 0)
2147 return;
2148
2149 /**
2150 * Need to indicate new BSSs found during
2151 * background scanning to host.
2152 * Allocate buffer for sending indication.
2153 * Length of buffer is length of BSS description
2154 * and length of header itself
2155 */
2156 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302157 pNewBssInd = vos_mem_malloc(val);
2158 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 {
2160 // Log error
2161 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302162 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002163
2164 return;
2165 }
2166
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2168 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 pNewBssInd->sessionId = 0;
2170
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302171 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 (tANI_U8 *) &pBssDescr->bssDescription,
2173 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002174
2175 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2176 msgQ.bodyptr = pNewBssInd;
2177 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002178 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2180} /*** end limSendSmeNeighborBssInd() ***/
2181
2182/** -----------------------------------------------------------------
2183 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2184 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2185 \ SME only looks at rc and tspec field.
2186 \param pMac - global mac structure
2187 \param rspReqd - is SmeAddTsRsp required
2188 \param status - status code of SME_ADD_TS_RSP
2189 \return tspec
2190 \sa
2191 ----------------------------------------------------------------- */
2192void
2193limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2194 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2195{
2196 tpSirAddtsRsp rsp;
2197 tSirMsgQ mmhMsg;
2198
2199 if (! rspReqd)
2200 return;
2201
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302202 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2203 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302205 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 return;
2207 }
2208
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302209 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 rsp->messageType = eWNI_SME_ADDTS_RSP;
2211 rsp->rc = status;
2212 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302213 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 /* Update SME session Id and transcation Id */
2216 rsp->sessionId = smesessionId;
2217 rsp->transactionId = smetransactionId;
2218
2219 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2220 mmhMsg.bodyptr = rsp;
2221 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002222 if(NULL == psessionEntry)
2223 {
2224 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2225 }
2226 else
2227 {
2228 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2229 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002230#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2231 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2232#endif //FEATURE_WLAN_DIAG_SUPPORT
2233
2234 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2235 return;
2236}
2237
2238void
2239limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2240{
2241 tpSirAddtsRsp rsp;
2242 tSirMsgQ mmhMsg;
2243
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002244 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 addts->dialogToken,
2246 addts->tspec.tsinfo.traffic.tsid,
2247 addts->tspec.tsinfo.traffic.userPrio);
2248
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302249 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2250 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 {
2252 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302253 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 return;
2255 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302256 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002257
2258 rsp->messageType = eWNI_SME_ADDTS_IND;
2259
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302260 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002261
2262 mmhMsg.type = eWNI_SME_ADDTS_IND;
2263 mmhMsg.bodyptr = rsp;
2264 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002265 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2267}
2268
2269void
2270limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2271{
2272 tpSirDeltsRsp rsp;
2273 tSirMsgQ mmhMsg;
2274
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002275 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 delts->aid,
2277 delts->req.tsinfo.traffic.tsid,
2278 delts->req.tsinfo.traffic.userPrio,
2279 status);
2280 if (! delts->rspReqd)
2281 return;
2282
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302283 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2284 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 {
2286 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302287 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 return;
2289 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302290 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002291
2292 if(psessionEntry != NULL)
2293 {
2294
2295 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302296 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2297 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 }
2299
2300
2301 rsp->messageType = eWNI_SME_DELTS_RSP;
2302 rsp->rc = status;
2303
2304 /* Update SME session Id and transcation Id */
2305 rsp->sessionId = smesessionId;
2306 rsp->transactionId = smetransactionId;
2307
2308 mmhMsg.type = eWNI_SME_DELTS_RSP;
2309 mmhMsg.bodyptr = rsp;
2310 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002311 if(NULL == psessionEntry)
2312 {
2313 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2314 }
2315 else
2316 {
2317 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2318 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002319#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2320 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2321#endif //FEATURE_WLAN_DIAG_SUPPORT
2322
2323 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2324}
2325
2326void
2327limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2328{
2329 tpSirDeltsRsp rsp;
2330 tSirMsgQ mmhMsg;
2331
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002332 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 aid,
2334 delts->tsinfo.traffic.tsid,
2335 delts->tsinfo.traffic.userPrio);
2336
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302337 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2338 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 {
2340 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302341 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 return;
2343 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302344 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002345
2346 rsp->messageType = eWNI_SME_DELTS_IND;
2347 rsp->rc = eSIR_SUCCESS;
2348 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302349 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002350
2351 /* Update SME session Id and SME transaction Id */
2352
2353 rsp->sessionId = psessionEntry->smeSessionId;
2354 rsp->transactionId = psessionEntry->transactionId;
2355
2356 mmhMsg.type = eWNI_SME_DELTS_IND;
2357 mmhMsg.bodyptr = rsp;
2358 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002359 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002360#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2361 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2362#endif //FEATURE_WLAN_DIAG_SUPPORT
2363
2364 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2365}
2366
2367/**
2368 * limSendSmeStatsRsp()
2369 *
2370 *FUNCTION:
2371 * This function is called to send 802.11 statistics response to HDD.
2372 * This function posts the result back to HDD. This is a response to
2373 * HDD's request for statistics.
2374 *
2375 *PARAMS:
2376 *
2377 *LOGIC:
2378 *
2379 *ASSUMPTIONS:
2380 * NA
2381 *
2382 *NOTE:
2383 * NA
2384 *
2385 * @param pMac Pointer to Global MAC structure
2386 * @param p80211Stats Statistics sent in response
2387 * @param resultCode TODO:
2388 *
2389 *
2390 * @return none
2391 */
2392
2393void
2394limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2395{
2396 tSirMsgQ mmhMsg;
2397 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2398
2399 switch(msgType)
2400 {
2401 case WDA_STA_STAT_RSP:
2402 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2403 break;
2404 case WDA_AGGR_STAT_RSP:
2405 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2406 break;
2407 case WDA_GLOBAL_STAT_RSP:
2408 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2409 break;
2410 case WDA_STAT_SUMM_RSP:
2411 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2412 break;
2413 default:
2414 mmhMsg.type = msgType; //Response from within PE
2415 break;
2416 }
2417
2418 pMsgHdr->messageType = mmhMsg.type;
2419
2420 mmhMsg.bodyptr = stats;
2421 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002422 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002423 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2424
2425 return;
2426
2427} /*** end limSendSmeStatsRsp() ***/
2428
2429/**
2430 * limSendSmePEStatisticsRsp()
2431 *
2432 *FUNCTION:
2433 * This function is called to send 802.11 statistics response to HDD.
2434 * This function posts the result back to HDD. This is a response to
2435 * HDD's request for statistics.
2436 *
2437 *PARAMS:
2438 *
2439 *LOGIC:
2440 *
2441 *ASSUMPTIONS:
2442 * NA
2443 *
2444 *NOTE:
2445 * NA
2446 *
2447 * @param pMac Pointer to Global MAC structure
2448 * @param p80211Stats Statistics sent in response
2449 * @param resultCode TODO:
2450 *
2451 *
2452 * @return none
2453 */
2454
2455void
2456limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2457{
2458 tSirMsgQ mmhMsg;
2459 tANI_U8 sessionId;
2460 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2461 tpPESession pPeSessionEntry;
2462
2463 //Get the Session Id based on Sta Id
2464 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2465
2466 //Fill the Session Id
2467 if(NULL != pPeSessionEntry)
2468 {
2469 //Fill the Session Id
2470 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2471 }
2472
2473 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2474
2475
2476 //msgType should be WDA_GET_STATISTICS_RSP
2477 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2478
2479 mmhMsg.bodyptr = stats;
2480 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002481 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2483
2484 return;
2485
2486} /*** end limSendSmePEStatisticsRsp() ***/
2487
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002488#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002489/**
2490 * limSendSmePEGetRoamRssiRsp()
2491 *
2492 *FUNCTION:
2493 * This function is called to send roam rssi response to HDD.
2494 * This function posts the result back to HDD. This is a response to
2495 * HDD's request to get roam rssi.
2496 *
2497 *PARAMS:
2498 *
2499 *LOGIC:
2500 *
2501 *ASSUMPTIONS:
2502 * NA
2503 *
2504 *NOTE:
2505 * NA
2506 *
2507 * @param pMac Pointer to Global MAC structure
2508 * @param p80211Stats Statistics sent in response
2509 * @param resultCode TODO:
2510 *
2511 *
2512 * @return none
2513 */
2514
2515void
2516limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2517{
2518 tSirMsgQ mmhMsg;
2519 tANI_U8 sessionId;
2520 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2521 tpPESession pPeSessionEntry = NULL;
2522
2523 //Get the Session Id based on Sta Id
2524 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2525
2526 //Fill the Session Id
2527 if(NULL != pPeSessionEntry)
2528 {
2529 //Fill the Session Id
2530 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2531 }
2532
2533 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2534
2535 //msgType should be WDA_GET_STATISTICS_RSP
2536 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2537
2538 mmhMsg.bodyptr = stats;
2539 mmhMsg.bodyval = 0;
2540 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2541 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2542
2543 return;
2544
2545} /*** end limSendSmePEGetRoamRssiRsp() ***/
2546
2547#endif
2548
Jeff Johnson295189b2012-06-20 16:38:30 -07002549
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002550#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002551/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002552 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002553 *
2554 *FUNCTION:
2555 * This function is called to send tsm stats response to HDD.
2556 * This function posts the result back to HDD. This is a response to
2557 * HDD's request to get tsm stats.
2558 *
2559 *PARAMS:
2560 * @param pMac - Pointer to global pMac structure
2561 * @param pStats - Pointer to TSM Stats
2562 *
2563 * @return none
2564 */
2565
2566void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002567limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002568{
2569 tSirMsgQ mmhMsg;
2570 tANI_U8 sessionId;
2571 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2572 tpPESession pPeSessionEntry = NULL;
2573
2574 //Get the Session Id based on Sta Id
2575 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2576
2577 //Fill the Session Id
2578 if(NULL != pPeSessionEntry)
2579 {
2580 //Fill the Session Id
2581 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2582 }
2583 else
2584 {
2585 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2586 pPeStats->staId);)
2587 return;
2588 }
2589
2590 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002591 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2592 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002593
2594 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2595 mmhMsg.bodyptr = pStats;
2596 mmhMsg.bodyval = 0;
2597 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2598 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2599
2600 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002601} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002602
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002603#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002604
2605
Jeff Johnson295189b2012-06-20 16:38:30 -07002606void
2607limSendSmeIBSSPeerInd(
2608 tpAniSirGlobal pMac,
2609 tSirMacAddr peerMacAddr,
2610 tANI_U16 staIndex,
2611 tANI_U8 ucastIdx,
2612 tANI_U8 bcastIdx,
2613 tANI_U8 *beacon,
2614 tANI_U16 beaconLen,
2615 tANI_U16 msgType,
2616 tANI_U8 sessionId)
2617{
2618 tSirMsgQ mmhMsg;
2619 tSmeIbssPeerInd *pNewPeerInd;
2620
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302621 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2622 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 {
2624 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2625 return;
2626 }
2627
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302628 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002629
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302630 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 peerMacAddr, sizeof(tSirMacAddr));
2632 pNewPeerInd->staId= staIndex;
2633 pNewPeerInd->ucastSig = ucastIdx;
2634 pNewPeerInd->bcastSig = bcastIdx;
2635 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2636 pNewPeerInd->mesgType = msgType;
2637 pNewPeerInd->sessionId = sessionId;
2638
2639 if ( beacon != NULL )
2640 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302641 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2642 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002643 }
2644
2645 mmhMsg.type = msgType;
2646// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2647 mmhMsg.bodyptr = pNewPeerInd;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002648 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2650
2651}
2652
2653
2654/** -----------------------------------------------------------------
2655 \brief limSendExitBmpsInd() - sends exit bmps indication
2656
2657 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2658 code to SME. This will trigger SME to get out of BMPS mode.
2659
2660 \param pMac - global mac structure
2661 \param reasonCode - reason for which PE wish to exit BMPS
2662 \return none
2663 \sa
2664 ----------------------------------------------------------------- */
2665void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2666{
2667 tSirMsgQ mmhMsg;
2668 tANI_U16 msgLen = 0;
2669 tpSirSmeExitBmpsInd pExitBmpsInd;
2670
2671 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302672 pExitBmpsInd = vos_mem_malloc(msgLen);
2673 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302675 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 return;
2677 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302678 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002679
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2681 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 pExitBmpsInd->exitBmpsReason = reasonCode;
2683 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2684
2685 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2686 mmhMsg.bodyptr = pExitBmpsInd;
2687 mmhMsg.bodyval = 0;
2688
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302689 limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));
Jeff Johnsone7245742012-09-05 17:12:55 -07002690 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002691#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2692 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2693#endif //FEATURE_WLAN_DIAG_SUPPORT
2694
2695 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2696 return;
2697
2698} /*** end limSendExitBmpsInd() ***/
2699
2700
2701
2702
2703/*--------------------------------------------------------------------------
2704 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2705
2706
2707 \param pMac - pointer to global adapter context
2708 \param sessionId - Message pointer.
2709
2710 \sa
2711 --------------------------------------------------------------------------*/
2712
2713void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2714{
2715 tpPESession psessionEntry;
2716 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2717 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2718 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002719 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 return;
2721 }
2722 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2723 {
2724 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2725 }
2726 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2727 {
2728 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2729 }
2730
2731 else
2732 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2733
2734}
2735
2736#ifdef WLAN_FEATURE_VOWIFI_11R
2737/** -----------------------------------------------------------------
2738 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2739 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2740 \ SME only looks at rc and tspec field.
2741 \param pMac - global mac structure
2742 \param rspReqd - is SmeAddTsRsp required
2743 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2744 \return tspec
2745 \sa
2746 ----------------------------------------------------------------- */
2747void
2748limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2749 tANI_U8 smesessionId)
2750{
2751 tSirMsgQ mmhMsg;
2752
2753 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2754 mmhMsg.bodyptr = aggrQosRsp;
2755 mmhMsg.bodyval = 0;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302756 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2758
2759 return;
2760}
2761#endif
2762
2763/** -----------------------------------------------------------------
2764 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2765 before switching channels for spectrum manangement.
2766
2767 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2768
2769 \param pMac - global mac structure
2770 \return none
2771 \sa
2772 ----------------------------------------------------------------- */
2773void
2774limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2775{
2776 tSirMsgQ mmhMsg;
2777
2778 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2779 mmhMsg.bodyptr = NULL;
2780 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002781 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2783
2784 return;
2785}
2786
2787/** -----------------------------------------------------------------
2788 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2789 after channel switch for spectrum manangement is complete.
2790
2791 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2792
2793 \param pMac - global mac structure
2794 \return none
2795 \sa
2796 ----------------------------------------------------------------- */
2797void
2798limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2799{
2800 tSirMsgQ mmhMsg;
2801
2802 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2803 mmhMsg.bodyptr = NULL;
2804 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002805 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2807
2808 return;
2809}
2810
2811void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2812 tANI_U8 smesessionId)
2813{
2814 tSirMsgQ mmhMsg;
2815 tSmeMaxAssocInd *pSmeMaxAssocInd;
2816
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302817 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2818 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002819 {
2820 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2821 return;
2822 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302823 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2824 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2825 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2827 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2828 pSmeMaxAssocInd->sessionId = smesessionId;
2829 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2830 mmhMsg.bodyptr = pSmeMaxAssocInd;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302831 limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2832 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr),smesessionId);
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002833 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2835
2836 return;
2837}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002838#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2839/** -----------------------------------------------------------------
2840 \brief limSendSmeCandidateFoundInd() - sends
2841 eWNI_SME_CANDIDATE_FOUND_IND
2842
2843 After receiving candidate found indication frame from FW, this
2844 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2845 roam candidate(s) are available.
2846
2847 \param pMac - global mac structure
2848 \param psessionEntry - session info
2849 \return none
2850 \sa
2851 ----------------------------------------------------------------- */
2852void
2853limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2854{
2855 tSirMsgQ mmhMsg;
2856 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2857
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302858 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2859 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002860 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302861 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002862 return;
2863 }
2864
2865 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05302866 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeCandidateFoundInd);
2867 pSirSmeCandidateFoundInd->sessionId = sessionId;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002868
2869
2870 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2871 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2872 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2873 mmhMsg.bodyval = 0;
2874
2875 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2876
2877} /*** end limSendSmeCandidateFoundInd() ***/
2878#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD