blob: ff3c7742ea9eba1169016cf186e2beb32b93a40b [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002 * Copyright (c) 2012-2014 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
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniCfgSta.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 }
c_hpothud65d2182014-06-06 21:18:17 +0530265 else
266 rate_flags |= eHAL_TX_RATE_VHT20;
c_hpothu44ff4e02014-05-08 00:13:57 +0530267#endif
268 }
269
270 return rate_flags;
271}
Jeff Johnson295189b2012-06-20 16:38:30 -0700272
273/**
274 * limSendSmeJoinReassocRsp()
275 *
276 *FUNCTION:
277 * This function is called by limProcessSmeReqMessages() to send
278 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
279 * above MAC Software.
280 *
281 *PARAMS:
282 *
283 *LOGIC:
284 *
285 *ASSUMPTIONS:
286 * NA
287 *
288 *NOTE:
289 * NA
290 *
291 * @param pMac Pointer to Global MAC structure
292 * @param msgType Indicates message type
293 * @param resultCode Indicates the result of previously issued
294 * eWNI_SME_msgType_REQ message
295 *
296 * @return None
297 */
298
299void
300limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
301 tSirResultCodes resultCode, tANI_U16 protStatusCode,
302 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
303{
304 tpSirSmeJoinRsp pSirSmeJoinRsp;
305 tANI_U32 rspLen;
306 tpDphHashNode pStaDs = NULL;
307
308#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
309 if (msgType == eWNI_SME_REASSOC_RSP)
310 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
311 else
312 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
313#endif //FEATURE_WLAN_DIAG_SUPPORT
314
315 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700316 FL("Sending message %s with reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 limMsgStr(msgType), limResultCodeStr(resultCode));)
318
319 if(psessionEntry == NULL)
320 {
321
322 rspLen = sizeof(tSirSmeJoinRsp);
323
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530324 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
325 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 {
327 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530328 limLog(pMac, LOGP, FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 return;
330 }
331
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530332 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700333
334
335 pSirSmeJoinRsp->beaconLength = 0;
336 pSirSmeJoinRsp->assocReqLength = 0;
337 pSirSmeJoinRsp->assocRspLength = 0;
338 }
339
340 else
341 {
342 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
343 psessionEntry->bcnLen +
344#ifdef WLAN_FEATURE_VOWIFI_11R
345 psessionEntry->RICDataLen +
346#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800347#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 psessionEntry->tspecLen +
349#endif
350 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530351
352 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
353 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 {
355 /// Buffer not available. Log error
356 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530357 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359 return;
360 }
361
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530362 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700363
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 if (resultCode == eSIR_SME_SUCCESS)
365 {
366 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
367 if (pStaDs == NULL)
368 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700369 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 }
371 else
372 {
Jeff Johnson62c27982013-02-27 17:53:55 -0800373 //Pass the peer's staId
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 pSirSmeJoinRsp->staId = pStaDs->staIndex;
Jeff Johnson62c27982013-02-27 17:53:55 -0800375 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
376 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
c_hpothu44ff4e02014-05-08 00:13:57 +0530377 pSirSmeJoinRsp->maxRateFlags =
378 limGetMaxRateFlags(pStaDs, psessionEntry);
379 PELOGE(limLog(pMac, LOG1, FL("maxRateFlags: %x"),
380 pSirSmeJoinRsp->maxRateFlags);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700381 }
382 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700383
384 pSirSmeJoinRsp->beaconLength = 0;
385 pSirSmeJoinRsp->assocReqLength = 0;
386 pSirSmeJoinRsp->assocRspLength = 0;
387#ifdef WLAN_FEATURE_VOWIFI_11R
388 pSirSmeJoinRsp->parsedRicRspLen = 0;
389#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800390#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 pSirSmeJoinRsp->tspecIeLen = 0;
392#endif
393
394 if(resultCode == eSIR_SME_SUCCESS)
395 {
396
397 if(psessionEntry->beacon != NULL)
398 {
399 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530400 vos_mem_copy( pSirSmeJoinRsp->frames, psessionEntry->beacon,
401 pSirSmeJoinRsp->beaconLength);
402 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 psessionEntry->beacon = NULL;
404#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700405 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d"), psessionEntry->bcnLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700406#endif
407 }
408
409 if(psessionEntry->assocReq != NULL)
410 {
411 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530412 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen,
413 psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
414 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700415 psessionEntry->assocReq = NULL;
416#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700417 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d"), psessionEntry->assocReqLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700418#endif
419 }
420 if(psessionEntry->assocRsp != NULL)
421 {
422 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530423 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
424 psessionEntry->assocReqLen,
425 psessionEntry->assocRsp,
426 pSirSmeJoinRsp->assocRspLength);
427 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 psessionEntry->assocRsp = NULL;
429 }
430#ifdef WLAN_FEATURE_VOWIFI_11R
431 if(psessionEntry->ricData != NULL)
432 {
433 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530434 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
435 psessionEntry->assocReqLen + psessionEntry->assocRspLen,
436 psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
437 vos_mem_free(psessionEntry->ricData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 psessionEntry->ricData = NULL;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700439 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 }
441#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800442#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 if(psessionEntry->tspecIes != NULL)
444 {
445 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530446 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
447 psessionEntry->assocReqLen + psessionEntry->assocRspLen +
448 psessionEntry->RICDataLen,
449 psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
450 vos_mem_free(psessionEntry->tspecIes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 psessionEntry->tspecIes = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800452 PELOG1(limLog(pMac, LOG1, FL("ESE-TspecLen=%d"), psessionEntry->tspecLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 }
454#endif
455 pSirSmeJoinRsp->aid = psessionEntry->limAID;
456#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700457 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d"), psessionEntry->assocRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700458#endif
459 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700460 else
461 {
462
463 if(psessionEntry->beacon != NULL)
464 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530465 vos_mem_free(psessionEntry->beacon);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700466 psessionEntry->beacon = NULL;
467 }
468
469 if(psessionEntry->assocReq != NULL)
470 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530471 vos_mem_free( psessionEntry->assocReq);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700472 psessionEntry->assocReq = NULL;
473 }
474
475 if(psessionEntry->assocRsp != NULL)
476 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530477 vos_mem_free( psessionEntry->assocRsp);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700478 psessionEntry->assocRsp = NULL;
479 }
480
481 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 }
483
484
485 pSirSmeJoinRsp->messageType = msgType;
486 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
487 pSirSmeJoinRsp->statusCode = resultCode;
488 pSirSmeJoinRsp->protStatusCode = protStatusCode;
489
490 /* Update SME session ID and transaction Id */
491 pSirSmeJoinRsp->sessionId = smesessionId;
492 pSirSmeJoinRsp->transactionId = smetransactionId;
493
494 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
495 {
496 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
497 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700498
499#ifdef WLAN_FEATURE_11AC
500 if (psessionEntry->vhtCapability)
501 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700502 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700503 /*Get 11ac cbState from 11n cbState*/
504 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
505 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700506 psessionEntry->htSecondaryChannelOffset,
507 psessionEntry->apCenterChan,
508 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700509 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
510 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700511 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700512#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700513 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 }
515 else
516 {
517 peSetResumeChannel( pMac, 0, 0);
518 }
519 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
520 (tANI_U32*) pSirSmeJoinRsp );
521 }
522 else
523 {
524 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
525 (tANI_U32*) pSirSmeJoinRsp );
526 }
527} /*** end limSendSmeJoinReassocRsp() ***/
528
529
Jeff Johnson295189b2012-06-20 16:38:30 -0700530/**
531 * limSendSmeStartBssRsp()
532 *
533 *FUNCTION:
534 * This function is called to send eWNI_SME_START_BSS_RSP
535 * message to applications above MAC Software.
536 *
537 *PARAMS:
538 *
539 *LOGIC:
540 *
541 *ASSUMPTIONS:
542 * NA
543 *
544 *NOTE:
545 * NA
546 *
547 * @param pMac Pointer to Global MAC structure
548 * @param msgType Indicates message type
549 * @param resultCode Indicates the result of previously issued
550 * eWNI_SME_msgType_REQ message
551 *
552 * @return None
553 */
554
555void
556limSendSmeStartBssRsp(tpAniSirGlobal pMac,
557 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
558 tANI_U8 smesessionId,tANI_U16 smetransactionId)
559{
560
561
562 tANI_U16 size = 0;
563 tSirMsgQ mmhMsg;
564 tSirSmeStartBssRsp *pSirSmeRsp;
565 tANI_U16 ieLen;
566 tANI_U16 ieOffset, curLen;
567
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700568 PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 limMsgStr(msgType), limResultCodeStr(resultCode));)
570
571 size = sizeof(tSirSmeStartBssRsp);
572
573 if(psessionEntry == NULL)
574 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530575 pSirSmeRsp = vos_mem_malloc(size);
576 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 {
578 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530579 limLog(pMac, LOGP,FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 return;
581 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530582 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700583
584 }
585 else
586 {
587 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
588 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
589 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
590 //calculate the memory size to allocate
591 size += ieLen;
592
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530593 pSirSmeRsp = vos_mem_malloc(size);
594 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 {
596 /// Buffer not available. Log error
597 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530598 FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700599
600 return;
601 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530602 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 size = sizeof(tSirSmeStartBssRsp);
604 if (resultCode == eSIR_SME_SUCCESS)
605 {
606
607 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
608
609 /* Read beacon interval from session */
610 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
611 pSirSmeRsp->bssType = psessionEntry->bssType;
612
613 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
614 != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700615 limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
617 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
618
619#if 0
620 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700621 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700622
623#endif// TO SUPPORT BT-AMP
624
625 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
626
627 pSirSmeRsp->bssDescription.aniIndicator = 1;
628
629 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530630 vos_mem_copy( (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
632 (tANI_U32)curLen);
633
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530634 vos_mem_copy( ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 pMac->sch.schObject.gSchBeaconFrameEnd,
636 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
637
638
639 //subtracting size of length indicator itself and size of pointer to ieFields
640 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
641 sizeof(tANI_U16) - sizeof(tANI_U32) +
642 ieLen;
643 //This is the size of the message, subtracting the size of the pointer to ieFields
644 size += ieLen - sizeof(tANI_U32);
645 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 }
647
648 pSirSmeRsp->messageType = msgType;
649 pSirSmeRsp->length = size;
650
651 /* Update SME session Id and transaction Id */
652 pSirSmeRsp->sessionId = smesessionId;
653 pSirSmeRsp->transactionId = smetransactionId;
654 pSirSmeRsp->statusCode = resultCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 if(psessionEntry != NULL )
656 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
657
Jeff Johnson295189b2012-06-20 16:38:30 -0700658
659 mmhMsg.type = msgType;
660 mmhMsg.bodyptr = pSirSmeRsp;
661 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800662 if(psessionEntry == NULL)
663 {
664 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
665 }
666 else
667 {
668 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
669 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700670#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
671 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
672#endif //FEATURE_WLAN_DIAG_SUPPORT
673
674 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
675} /*** end limSendSmeStartBssRsp() ***/
676
Jeff Johnson295189b2012-06-20 16:38:30 -0700677#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
678#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
679
680
681/**
682 * limSendSmeScanRsp()
683 *
684 *FUNCTION:
685 * This function is called by limProcessSmeReqMessages() to send
686 * eWNI_SME_SCAN_RSP message to applications above MAC
687 * Software.
688 *
689 *PARAMS:
690 *
691 *LOGIC:
692 *
693 *ASSUMPTIONS:
694 * NA
695 *
696 *NOTE:
697 * NA
698 *
699 * @param pMac Pointer to Global MAC structure
700 * @param length Indicates length of message
701 * @param resultCode Indicates the result of previously issued
702 * eWNI_SME_SCAN_REQ message
703 *
704 * @return None
705 */
706
707void
708limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
709 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
710{
711 tSirMsgQ mmhMsg;
712 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
713 tLimScanResultNode *ptemp = NULL;
714 tANI_U16 msgLen, allocLength, curMsgLen = 0;
715 tANI_U16 i, bssCount;
716 tANI_U8 *pbBuf;
717 tSirBssDescription *pDesc;
718
719 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700720 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 length, limResultCodeStr(resultCode));)
722
723 if (resultCode != eSIR_SME_SUCCESS)
724 {
725 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
726 return;
727 }
728
729 mmhMsg.type = eWNI_SME_SCAN_RSP;
730 i = 0;
731 bssCount = 0;
732 msgLen = 0;
733 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530734 pSirSmeScanRsp = vos_mem_malloc(allocLength);
735 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 {
737 // Log error
738 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530739 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
741 return;
742 }
743 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
744 {
745 //when ptemp is not NULL it is a left over
746 ptemp = pMac->lim.gLimCachedScanHashTable[i];
747 while(ptemp)
748 {
749 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
750 if(0 == bssCount)
751 {
752 msgLen = sizeof(tSirSmeScanRsp) -
753 sizeof(tSirBssDescription) +
754 ptemp->bssDescription.length +
755 sizeof(ptemp->bssDescription.length);
756 pDesc = pSirSmeScanRsp->bssDescription;
757 }
758 else
759 {
760 msgLen += ptemp->bssDescription.length +
761 sizeof(ptemp->bssDescription.length);
762 pDesc = (tSirBssDescription *)pbBuf;
763 }
764 if( (allocLength < msgLen) ||
765 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
766 {
767 pSirSmeScanRsp->statusCode =
768 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
Jeff Johnson295189b2012-06-20 16:38:30 -0700769 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
770 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 mmhMsg.bodyptr = pSirSmeScanRsp;
772 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700773 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530775 pSirSmeScanRsp = vos_mem_malloc(allocLength);
776 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 {
778 // Log error
779 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530780 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 return;
782 }
783 msgLen = sizeof(tSirSmeScanRsp) -
784 sizeof(tSirBssDescription) +
785 ptemp->bssDescription.length +
786 sizeof(ptemp->bssDescription.length);
787 pDesc = pSirSmeScanRsp->bssDescription;
788 bssCount = 1;
789 }
790 curMsgLen = msgLen;
791
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700792 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 msgLen, ptemp->bssDescription.length);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 pDesc->length
795 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530796 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
797 (tANI_U8 *) &ptemp->bssDescription.bssId,
798 ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700799
800 PELOG2(limLog(pMac, LOG2, FL("BssId "));
801 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
802
803 pSirSmeScanRsp->sessionId = smesessionId;
804 pSirSmeScanRsp->transcationId = smetranscationId;
805
806 ptemp = ptemp->next;
807 } //while(ptemp)
808 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
809
810 if(0 == bssCount)
811 {
812 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700813 if (NULL != pSirSmeScanRsp)
814 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530815 vos_mem_free( pSirSmeScanRsp);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700816 pSirSmeScanRsp = NULL;
817 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 }
819 else
820 {
821 // send last message
822 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
824 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700825
826 /* Update SME session Id and SME transcation Id */
827 pSirSmeScanRsp->sessionId = smesessionId;
828 pSirSmeScanRsp->transcationId = smetranscationId;
829
830 mmhMsg.type = eWNI_SME_SCAN_RSP;
831 mmhMsg.bodyptr = pSirSmeScanRsp;
832 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700833 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700835 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 }
837
838 return;
839
840} /*** end limSendSmeScanRsp() ***/
841
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700842#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
843/**
844 * limSendSmeLfrScanRsp()
845 *
846 *FUNCTION:
847 * This function is called by limProcessSmeReqMessages() to send
848 * eWNI_SME_SCAN_RSP message to applications above MAC Software
849 * only for sending up the roam candidates.
850 *
851 *PARAMS:
852 *
853 *LOGIC:
854 *
855 *ASSUMPTIONS:
856 * NA
857 *
858 *NOTE:
859 * NA
860 *
861 * @param pMac Pointer to Global MAC structure
862 * @param length Indicates length of message
863 * @param resultCode Indicates the result of previously issued
864 * eWNI_SME_SCAN_REQ message
865 *
866 * @return None
867 */
868
869void
870limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
871 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
872{
873 tSirMsgQ mmhMsg;
874 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
875 tLimScanResultNode *ptemp = NULL;
876 tANI_U16 msgLen, allocLength, curMsgLen = 0;
877 tANI_U16 i, bssCount;
878 tANI_U8 *pbBuf;
879 tSirBssDescription *pDesc;
880
881 PELOG1(limLog(pMac, LOG1,
882 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
883 length, limResultCodeStr(resultCode));)
884
885 if (resultCode != eSIR_SME_SUCCESS)
886 {
887 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
888 return;
889 }
890
891 mmhMsg.type = eWNI_SME_SCAN_RSP;
892 i = 0;
893 bssCount = 0;
894 msgLen = 0;
895 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530896 pSirSmeScanRsp = vos_mem_malloc(allocLength);
897 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700898 {
899 // Log error
900 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530901 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700902
903 return;
904 }
905 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
906 {
907 //when ptemp is not NULL it is a left over
908 ptemp = pMac->lim.gLimCachedLfrScanHashTable[i];
909 while(ptemp)
910 {
911 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
912 if(0 == bssCount)
913 {
914 msgLen = sizeof(tSirSmeScanRsp) -
915 sizeof(tSirBssDescription) +
916 ptemp->bssDescription.length +
917 sizeof(ptemp->bssDescription.length);
918 pDesc = pSirSmeScanRsp->bssDescription;
919 }
920 else
921 {
922 msgLen += ptemp->bssDescription.length +
923 sizeof(ptemp->bssDescription.length);
924 pDesc = (tSirBssDescription *)pbBuf;
925 }
926 if ( (allocLength < msgLen) ||
927 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
928 {
929 pSirSmeScanRsp->statusCode =
930 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
931 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
932 pSirSmeScanRsp->length = curMsgLen;
933 mmhMsg.bodyptr = pSirSmeScanRsp;
934 mmhMsg.bodyval = 0;
935 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
936 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530937 pSirSmeScanRsp = vos_mem_malloc(allocLength);
938 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700939 {
940 // Log error
941 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530942 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700943 return;
944 }
945 msgLen = sizeof(tSirSmeScanRsp) -
946 sizeof(tSirBssDescription) +
947 ptemp->bssDescription.length +
948 sizeof(ptemp->bssDescription.length);
949 pDesc = pSirSmeScanRsp->bssDescription;
950 bssCount = 1;
951 }
952 curMsgLen = msgLen;
953
954 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
955 msgLen, ptemp->bssDescription.length);)
956 pDesc->length
957 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530958 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
959 (tANI_U8 *) &ptemp->bssDescription.bssId,
960 ptemp->bssDescription.length);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700961
962 PELOG2(limLog(pMac, LOG2, FL("BssId "));
963 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
964
965 pSirSmeScanRsp->sessionId = smesessionId;
966 pSirSmeScanRsp->transcationId = smetranscationId;
967
968 ptemp = ptemp->next;
969 } //while(ptemp)
970 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
971
972 if (0 == bssCount)
973 {
974 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
975 if (NULL != pSirSmeScanRsp)
976 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530977 vos_mem_free( pSirSmeScanRsp);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700978 pSirSmeScanRsp = NULL;
979 }
980 }
981 else
982 {
983 // send last message
984 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
985 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
986 pSirSmeScanRsp->length = curMsgLen;
987
988 /* Update SME session Id and SME transcation Id */
989 pSirSmeScanRsp->sessionId = smesessionId;
990 pSirSmeScanRsp->transcationId = smetranscationId;
991
992 mmhMsg.type = eWNI_SME_SCAN_RSP;
993 mmhMsg.bodyptr = pSirSmeScanRsp;
994 mmhMsg.bodyval = 0;
995 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
996 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
997 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
998 }
999
1000 return;
1001
1002} /*** end limSendSmeLfrScanRsp() ***/
1003#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001004
1005/**
1006 * limPostSmeScanRspMessage()
1007 *
1008 *FUNCTION:
1009 * This function is called by limSendSmeScanRsp() to send
1010 * eWNI_SME_SCAN_RSP message with failed result code
1011 *
1012 *NOTE:
1013 * NA
1014 *
1015 * @param pMac Pointer to Global MAC structure
1016 * @param length Indicates length of message
1017 * @param resultCode failed result code
1018 *
1019 * @return None
1020 */
1021
1022void
1023limPostSmeScanRspMessage(tpAniSirGlobal pMac,
1024 tANI_U16 length,
1025 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1026{
1027 tpSirSmeScanRsp pSirSmeScanRsp;
1028 tSirMsgQ mmhMsg;
1029
1030 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001031 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 length, limResultCodeStr(resultCode));)
1033
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301034 pSirSmeScanRsp = vos_mem_malloc(length);
1035 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301037 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 return;
1039 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301040 vos_mem_set((void*)pSirSmeScanRsp, length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
1043 pSirSmeScanRsp->length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
1045 if(sizeof(tSirSmeScanRsp) <= length)
1046 {
1047 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
1048 }
1049
1050 pSirSmeScanRsp->statusCode = resultCode;
1051
1052 /*Update SME session Id and transaction Id */
1053 pSirSmeScanRsp->sessionId = smesessionId;
1054 pSirSmeScanRsp->transcationId = smetransactionId;
1055
1056 mmhMsg.type = eWNI_SME_SCAN_RSP;
1057 mmhMsg.bodyptr = pSirSmeScanRsp;
1058 mmhMsg.bodyval = 0;
1059
Jeff Johnsone7245742012-09-05 17:12:55 -07001060 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001061#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1062 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
1063#endif //FEATURE_WLAN_DIAG_SUPPORT
1064
1065 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1066 return;
1067
1068} /*** limPostSmeScanRspMessage ***/
1069
Jeff Johnsone7245742012-09-05 17:12:55 -07001070#ifdef FEATURE_OEM_DATA_SUPPORT
1071
1072/**
1073 * limSendSmeOemDataRsp()
1074 *
1075 *FUNCTION:
1076 * This function is called by limProcessSmeReqMessages() to send
1077 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
1078 * Software.
1079 *
1080 *PARAMS:
1081 *
1082 *LOGIC:
1083 *
1084 *ASSUMPTIONS:
1085 * NA
1086 *
1087 *NOTE:
1088 * NA
1089 *
1090 * @param pMac Pointer to Global MAC structure
1091 * @param pMsgBuf Indicates the mlm message
1092 * @param resultCode Indicates the result of previously issued
1093 * eWNI_SME_OEM_DATA_RSP message
1094 *
1095 * @return None
1096 */
1097
1098void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
1099{
1100 tSirMsgQ mmhMsg;
1101 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
1102 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
1103 tANI_U16 msgLength;
1104
1105
1106 //get the pointer to the mlm message
1107 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
1108
1109 msgLength = sizeof(tSirOemDataRsp);
1110
1111 //now allocate memory for the char buffer
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301112 pSirSmeOemDataRsp = vos_mem_malloc(msgLength);
1113 if (NULL == pSirSmeOemDataRsp)
Jeff Johnsone7245742012-09-05 17:12:55 -07001114 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301115 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSirSmeOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001116 return;
1117 }
1118
1119#if defined (ANI_LITTLE_BYTE_ENDIAN)
1120 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
1121 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
1122#else
1123 pSirSmeOemDataRsp->length = msgLength;
1124 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
1125#endif
1126
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301127 vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001128
1129 //Now free the memory from MLM Rsp Message
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301130 vos_mem_free(pMlmOemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001131
1132 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
1133 mmhMsg.bodyptr = pSirSmeOemDataRsp;
1134 mmhMsg.bodyval = 0;
1135
1136 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1137
1138 return;
1139} /*** limSendSmeOemDataRsp ***/
1140
1141#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001142
1143
1144/**
1145 * limSendSmeAuthRsp()
1146 *
1147 *FUNCTION:
1148 * This function is called by limProcessSmeMessages() to send
1149 * eWNI_SME_AUTH_RSP message to host
1150 *
1151 *PARAMS:
1152 *
1153 *LOGIC:
1154 *
1155 *ASSUMPTIONS:
1156 * NA
1157 *
1158 *NOTE:
1159 * NA
1160 *
1161 * @param pMac Pointer to Global MAC structure
1162 * @param statusCode Indicates the result of previously issued
1163 * eWNI_SME_AUTH_REQ message
1164 *
1165 * @return None
1166 */
1167void
1168limSendSmeAuthRsp(tpAniSirGlobal pMac,
1169 tSirResultCodes statusCode,
1170 tSirMacAddr peerMacAddr,
1171 tAniAuthType authType,
1172 tANI_U16 protStatusCode,
1173 tpPESession psessionEntry,tANI_U8 smesessionId,
1174 tANI_U16 smetransactionId)
1175{
1176#if 0
1177 tSirMsgQ mmhMsg;
1178 tSirSmeAuthRsp *pSirSmeAuthRsp;
1179
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301180 pSirSmeAuthRsp = vos_mem_malloc(sizeof(tSirSmeAuthRsp));
1181 if (NULL == pSirSmeAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 {
1183 // Log error
1184 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301185 FL("call to AllocateMemory failed for eWNI_SME_AUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001186
1187 return;
1188 }
1189
Jeff Johnson295189b2012-06-20 16:38:30 -07001190
1191
1192 if(psessionEntry != NULL)
1193 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301194 vos_mem_copy( (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1196 pSirSmeAuthRsp->authType = authType;
1197
1198 }
1199
1200 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1201 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1202 pSirSmeAuthRsp->statusCode = statusCode;
1203 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1204
1205 /* Update SME session and transaction Id*/
1206 pSirSmeAuthRsp->sessionId = smesessionId;
1207 pSirSmeAuthRsp->transactionId = smetransactionId;
1208
1209 mmhMsg.type = eWNI_SME_AUTH_RSP;
1210 mmhMsg.bodyptr = pSirSmeAuthRsp;
1211 mmhMsg.bodyval = 0;
1212 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1213 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1214#endif
1215} /*** end limSendSmeAuthRsp() ***/
1216
1217
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001218void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001219 eHalStatus status, tANI_U32 *pCtx )
1220{
1221 tSirMsgQ mmhMsg;
1222 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1223
1224 mmhMsg.type = pMsg->type;
1225 mmhMsg.bodyptr = pMsg;
1226 mmhMsg.bodyval = 0;
1227
Jeff Johnsone7245742012-09-05 17:12:55 -07001228 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1231}
1232/**
1233 * limSendSmeDisassocNtf()
1234 *
1235 *FUNCTION:
1236 * This function is called by limProcessSmeMessages() to send
1237 * eWNI_SME_DISASSOC_RSP/IND message to host
1238 *
1239 *PARAMS:
1240 *
1241 *LOGIC:
1242 *
1243 *ASSUMPTIONS:
1244 * NA
1245 *
1246 *NOTE:
1247 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1248 * or eWNI_SME_DISASSOC_IND to host depending on
1249 * disassociation trigger.
1250 *
1251 * @param peerMacAddr Indicates the peer MAC addr to which
1252 * disassociate was initiated
1253 * @param reasonCode Indicates the reason for Disassociation
1254 * @param disassocTrigger Indicates the trigger for Disassociation
1255 * @param aid Indicates the STAID. This parameter is
1256 * present only on AP.
1257 *
1258 * @return None
1259 */
1260void
1261limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1262 tSirMacAddr peerMacAddr,
1263 tSirResultCodes reasonCode,
1264 tANI_U16 disassocTrigger,
1265 tANI_U16 aid,
1266 tANI_U8 smesessionId,
1267 tANI_U16 smetransactionId,
1268 tpPESession psessionEntry)
1269{
1270
1271 tANI_U8 *pBuf;
1272 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1273 tSirSmeDisassocInd *pSirSmeDisassocInd;
1274 tANI_U32 *pMsg;
1275
1276 switch (disassocTrigger)
1277 {
1278 case eLIM_PEER_ENTITY_DISASSOC:
1279 return;
1280
1281 case eLIM_HOST_DISASSOC:
1282 /**
1283 * Disassociation response due to
1284 * host triggered disassociation
1285 */
1286
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301287 pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
1288 if ( NULL == pSirSmeDisassocRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 {
1290 // Log error
1291 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301292 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293
1294 return;
1295 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301296 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1297 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1298 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001299 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1300 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 //sessionId
1302 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1303 *pBuf = smesessionId;
1304 pBuf++;
1305
1306 //transactionId
1307 limCopyU16(pBuf, smetransactionId);
1308 pBuf += sizeof(tANI_U16);
1309
1310 //statusCode
1311 limCopyU32(pBuf, reasonCode);
1312 pBuf += sizeof(tSirResultCodes);
1313
1314 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301315 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 pBuf += sizeof(tSirMacAddr);
1317
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 // Clear Station Stats
1319 //for sta, it is always 1, IBSS is handled at halInitSta
1320
Jeff Johnson295189b2012-06-20 16:38:30 -07001321
1322
1323#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301324
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1326 psessionEntry, (tANI_U16)reasonCode, 0);
1327#endif
1328 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1329 break;
1330
1331 default:
1332 /**
1333 * Disassociation indication due to Disassociation
1334 * frame reception from peer entity or due to
1335 * loss of link with peer entity.
1336 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301337 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1338 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 {
1340 // Log error
1341 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301342 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001343
1344 return;
1345 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301346 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1347 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1348 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1350 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1351
1352 /* Update SME session Id and Transaction Id */
1353 pSirSmeDisassocInd->sessionId = smesessionId;
1354 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001355 pSirSmeDisassocInd->reasonCode = reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1357
1358 limCopyU32(pBuf, reasonCode);
1359 pBuf += sizeof(tSirResultCodes);
1360
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301361 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 pBuf += sizeof(tSirMacAddr);
1363
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301364 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001365
1366
1367#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1368 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1369 psessionEntry, (tANI_U16)reasonCode, 0);
1370#endif
1371 pMsg = (tANI_U32*) pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001372
1373 break;
1374 }
1375
1376 /* Delete the PE session Created */
1377 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1378 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1379 {
1380 peDeleteSession(pMac,psessionEntry);
1381 }
1382
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001383 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001385} /*** end limSendSmeDisassocNtf() ***/
1386
1387
1388/** -----------------------------------------------------------------
1389 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1390
1391 After receiving disassociation frame from peer entity, this
1392 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1393 reason code.
1394
1395 \param pMac - global mac structure
1396 \param pStaDs - station dph hash node
1397 \return none
1398 \sa
1399 ----------------------------------------------------------------- */
1400void
1401limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1402{
1403 tSirMsgQ mmhMsg;
1404 tSirSmeDisassocInd *pSirSmeDisassocInd;
1405
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301406 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1407 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301409 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 return;
1411 }
1412
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1414 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1417 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1418 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001419 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301420
1421 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1422
1423 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001424
Jeff Johnson295189b2012-06-20 16:38:30 -07001425 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301426
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1428 mmhMsg.bodyptr = pSirSmeDisassocInd;
1429 mmhMsg.bodyval = 0;
1430
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001432#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1433 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1434#endif //FEATURE_WLAN_DIAG_SUPPORT
1435
1436 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1437
1438} /*** end limSendSmeDisassocInd() ***/
1439
1440
1441/** -----------------------------------------------------------------
1442 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1443
1444 After receiving deauthentication frame from peer entity, this
1445 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1446 reason code.
1447
1448 \param pMac - global mac structure
1449 \param pStaDs - station dph hash node
1450 \return none
1451 \sa
1452 ----------------------------------------------------------------- */
1453void
1454limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1455{
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 tSirMsgQ mmhMsg;
1457 tSirSmeDeauthInd *pSirSmeDeauthInd;
1458
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301459 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1460 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301462 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 return;
1464 }
1465
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1467 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001468
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1470 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1471 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1472 {
1473 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1474 }
1475 else
1476 {
1477 //Need to indicatet he reascon code over the air
1478 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1479 }
1480 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301481 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301483 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001484 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001485
Jeff Johnson295189b2012-06-20 16:38:30 -07001486
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001488
1489 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1490 mmhMsg.bodyptr = pSirSmeDeauthInd;
1491 mmhMsg.bodyval = 0;
1492
Jeff Johnsone7245742012-09-05 17:12:55 -07001493 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001494#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1495 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1496#endif //FEATURE_WLAN_DIAG_SUPPORT
1497
1498 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1499 return;
1500} /*** end limSendSmeDeauthInd() ***/
1501
Hoonki Leee6bfe942013-02-05 15:01:19 -08001502#ifdef FEATURE_WLAN_TDLS
1503/**
1504 * limSendSmeTDLSDelStaInd()
1505 *
1506 *FUNCTION:
1507 * This function is called to send the TDLS STA context deletion to SME.
1508 *
1509 *LOGIC:
1510 *
1511 *ASSUMPTIONS:
1512 *
1513 *NOTE:
1514 * NA
1515 *
1516 * @param pMac - Pointer to global MAC structure
1517 * @param pStaDs - Pointer to internal STA Datastructure
1518 * @param psessionEntry - Pointer to the session entry
1519 * @param reasonCode - Reason for TDLS sta deletion
1520 * @return None
1521 */
1522void
1523limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1524{
1525 tSirMsgQ mmhMsg;
1526 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1527
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301528 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1529 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001530 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301531 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001532 return;
1533 }
1534
1535 //messageType
1536 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1537 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1538
1539 //sessionId
1540 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1541
1542 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301543 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001544
1545 //staId
1546 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1547
1548 //reasonCode
1549 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1550
1551 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1552 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1553 mmhMsg.bodyval = 0;
1554
1555
1556 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1557 return;
1558}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001559
1560/**
1561 * limSendSmeTDLSDeleteAllPeerInd()
1562 *
1563 *FUNCTION:
1564 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1565 * message to SME.
1566 *
1567 *LOGIC:
1568 *
1569 *ASSUMPTIONS:
1570 *
1571 *NOTE:
1572 * NA
1573 *
1574 * @param pMac - Pointer to global MAC structure
1575 * @param psessionEntry - Pointer to the session entry
1576 * @return None
1577 */
1578void
1579limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1580{
1581 tSirMsgQ mmhMsg;
1582 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1583
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301584 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1585 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001586 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301587 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001588 return;
1589 }
1590
1591 //messageType
1592 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1593 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1594
1595 //sessionId
1596 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1597
1598 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1599 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1600 mmhMsg.bodyval = 0;
1601
1602
1603 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1604 return;
1605}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001606
1607/**
1608 * limSendSmeMgmtTXCompletion()
1609 *
1610 *FUNCTION:
1611 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1612 * message to SME.
1613 *
1614 *LOGIC:
1615 *
1616 *ASSUMPTIONS:
1617 *
1618 *NOTE:
1619 * NA
1620 *
1621 * @param pMac - Pointer to global MAC structure
1622 * @param psessionEntry - Pointer to the session entry
1623 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1624 * @return None
1625 */
1626void
1627limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
1628 tpPESession psessionEntry,
1629 tANI_U32 txCompleteStatus)
1630{
1631 tSirMsgQ mmhMsg;
1632 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1633
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301634 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1635 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001636 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301637 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001638 return;
1639 }
1640
1641 //messageType
1642 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1643 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1644
1645 //sessionId
1646 pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
1647
1648 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1649
1650 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1651 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1652 mmhMsg.bodyval = 0;
1653
1654
1655 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1656 return;
1657}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001658#endif
1659
Jeff Johnson295189b2012-06-20 16:38:30 -07001660
1661/**
1662 * limSendSmeDeauthNtf()
1663 *
1664 *FUNCTION:
1665 * This function is called by limProcessSmeMessages() to send
1666 * eWNI_SME_DISASSOC_RSP/IND message to host
1667 *
1668 *PARAMS:
1669 *
1670 *LOGIC:
1671 *
1672 *ASSUMPTIONS:
1673 * NA
1674 *
1675 *NOTE:
1676 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1677 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1678 *
1679 * @param peerMacAddr Indicates the peer MAC addr to which
1680 * deauthentication was initiated
1681 * @param reasonCode Indicates the reason for Deauthetication
1682 * @param deauthTrigger Indicates the trigger for Deauthetication
1683 * @param aid Indicates the STAID. This parameter is present
1684 * only on AP.
1685 *
1686 * @return None
1687 */
1688void
1689limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1690 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1691{
1692 tANI_U8 *pBuf;
1693 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1694 tSirSmeDeauthInd *pSirSmeDeauthInd;
1695 tpPESession psessionEntry;
1696 tANI_U8 sessionId;
1697 tANI_U32 *pMsg;
1698
1699 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1700 switch (deauthTrigger)
1701 {
1702 case eLIM_PEER_ENTITY_DEAUTH:
1703 return;
1704
1705 case eLIM_HOST_DEAUTH:
1706 /**
1707 * Deauthentication response to host triggered
1708 * deauthentication.
1709 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301710 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1711 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 {
1713 // Log error
1714 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301715 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001716
1717 return;
1718 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301719 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1720 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1721 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1723 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 pSirSmeDeauthRsp->statusCode = reasonCode;
1725 pSirSmeDeauthRsp->sessionId = smesessionId;
1726 pSirSmeDeauthRsp->transactionId = smetransactionId;
1727
1728 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301729 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001730
Jeff Johnson295189b2012-06-20 16:38:30 -07001731#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1732 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1733 psessionEntry, 0, (tANI_U16)reasonCode);
1734#endif
1735 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1736
1737 break;
1738
1739 default:
1740 /**
1741 * Deauthentication indication due to Deauthentication
1742 * frame reception from peer entity or due to
1743 * loss of link with peer entity.
1744 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301745 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1746 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 {
1748 // Log error
1749 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301750 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001751
1752 return;
1753 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301754 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1755 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1756 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001757 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1758 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001759 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Jeff Johnson295189b2012-06-20 16:38:30 -07001760
1761 // sessionId
1762 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1763 *pBuf++ = smesessionId;
1764
1765 //transaction ID
1766 limCopyU16(pBuf, smetransactionId);
1767 pBuf += sizeof(tANI_U16);
1768
1769 // status code
1770 limCopyU32(pBuf, reasonCode);
1771 pBuf += sizeof(tSirResultCodes);
1772
1773 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301774 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 pBuf += sizeof(tSirMacAddr);
1776
1777 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301778 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001779
Jeff Johnson295189b2012-06-20 16:38:30 -07001780#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1781 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1782 psessionEntry, 0, (tANI_U16)reasonCode);
1783#endif //FEATURE_WLAN_DIAG_SUPPORT
1784 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1785
1786 break;
1787 }
1788
1789 /*Delete the PE session created */
1790 if(psessionEntry != NULL)
1791 {
1792 peDeleteSession(pMac,psessionEntry);
1793 }
1794
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001795 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1796 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001797
Jeff Johnson295189b2012-06-20 16:38:30 -07001798} /*** end limSendSmeDeauthNtf() ***/
1799
1800
1801/**
1802 * limSendSmeWmStatusChangeNtf()
1803 *
1804 *FUNCTION:
1805 * This function is called by limProcessSmeMessages() to send
1806 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1807 *
1808 *PARAMS:
1809 *
1810 *LOGIC:
1811 *
1812 *ASSUMPTIONS:
1813 * NA
1814 *
1815 *NOTE:
1816 *
1817 * @param statusChangeCode Indicates the change in the wireless medium.
1818 * @param statusChangeInfo Indicates the information associated with
1819 * change in the wireless medium.
1820 * @param infoLen Indicates the length of status change information
1821 * being sent.
1822 *
1823 * @return None
1824 */
1825void
1826limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1827 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1828{
1829 tSirMsgQ mmhMsg;
1830 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301831 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1832 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 {
1834 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301835 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001836 return;
1837 }
1838
Jeff Johnson295189b2012-06-20 16:38:30 -07001839
1840 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1841 mmhMsg.bodyval = 0;
1842 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1843
1844 switch(statusChangeCode)
1845 {
1846 case eSIR_SME_RADAR_DETECTED:
1847
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 break;
1849
1850 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 break;
1852
1853 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1854 limPackBkgndScanFailNotify(pMac,
1855 statusChangeCode,
1856 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1857 pSirSmeWmStatusChangeNtf, sessionId);
1858 break;
1859
1860 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1862 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1863 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1864 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1866 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301867 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1868 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001870 limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 statusChangeCode, infoLen);
1872 break;
1873 }
1874
1875
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001876 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1878 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301879 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001880 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 }
1882
1883} /*** end limSendSmeWmStatusChangeNtf() ***/
1884
1885
1886/**
1887 * limSendSmeSetContextRsp()
1888 *
1889 *FUNCTION:
1890 * This function is called by limProcessSmeMessages() to send
1891 * eWNI_SME_SETCONTEXT_RSP message to host
1892 *
1893 *PARAMS:
1894 *
1895 *LOGIC:
1896 *
1897 *ASSUMPTIONS:
1898 * NA
1899 *
1900 *NOTE:
1901 *
1902 * @param pMac Pointer to Global MAC structure
1903 * @param peerMacAddr Indicates the peer MAC addr to which
1904 * setContext was performed
1905 * @param aid Indicates the aid corresponding to the peer MAC
1906 * address
1907 * @param resultCode Indicates the result of previously issued
1908 * eWNI_SME_SETCONTEXT_RSP message
1909 *
1910 * @return None
1911 */
1912void
1913limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1914 tSirMacAddr peerMacAddr, tANI_U16 aid,
1915 tSirResultCodes resultCode,
1916 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1917{
1918
1919 tANI_U8 *pBuf;
1920 tSirMsgQ mmhMsg;
1921 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1922
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301923 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
1924 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 {
1926 // Log error
1927 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301928 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001929
1930 return;
1931 }
1932
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1934 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 pSirSmeSetContextRsp->statusCode = resultCode;
1936
1937 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1938
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301939 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 pBuf += sizeof(tSirMacAddr);
1941
Jeff Johnson295189b2012-06-20 16:38:30 -07001942
1943 /* Update SME session and transaction Id*/
1944 pSirSmeSetContextRsp->sessionId = smesessionId;
1945 pSirSmeSetContextRsp->transactionId = smetransactionId;
1946
1947 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1948 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1949 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08001950 if(NULL == psessionEntry)
1951 {
1952 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
1953 }
1954 else
1955 {
1956 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1957 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001958
1959#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1960 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1961#endif //FEATURE_WLAN_DIAG_SUPPORT
1962
1963 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1964} /*** end limSendSmeSetContextRsp() ***/
1965
1966/**
1967 * limSendSmeRemoveKeyRsp()
1968 *
1969 *FUNCTION:
1970 * This function is called by limProcessSmeMessages() to send
1971 * eWNI_SME_REMOVEKEY_RSP message to host
1972 *
1973 *PARAMS:
1974 *
1975 *LOGIC:
1976 *
1977 *ASSUMPTIONS:
1978 * NA
1979 *
1980 *NOTE:
1981 *
1982 * @param pMac Pointer to Global MAC structure
1983 * @param peerMacAddr Indicates the peer MAC addr to which
1984 * Removekey was performed
1985 * @param aid Indicates the aid corresponding to the peer MAC
1986 * address
1987 * @param resultCode Indicates the result of previously issued
1988 * eWNI_SME_REMOVEKEY_RSP message
1989 *
1990 * @return None
1991 */
1992void
1993limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1994 tSirMacAddr peerMacAddr,
1995 tSirResultCodes resultCode,
1996 tpPESession psessionEntry,tANI_U8 smesessionId,
1997 tANI_U16 smetransactionId)
1998{
1999 tANI_U8 *pBuf;
2000 tSirMsgQ mmhMsg;
2001 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2002
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302003 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
2004 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 {
2006 // Log error
2007 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302008 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002009
2010 return;
2011 }
2012
Jeff Johnson295189b2012-06-20 16:38:30 -07002013
2014
2015 if(psessionEntry != NULL)
2016 {
2017 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302018 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 }
2020
2021 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2022 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2023 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2024
2025 /* Update SME session and transaction Id*/
2026 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2027 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2028
2029 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2030 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2031 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002032 if(NULL == psessionEntry)
2033 {
2034 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2035 }
2036 else
2037 {
2038 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2039 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2041} /*** end limSendSmeSetContextRsp() ***/
2042
2043
2044/**
2045 * limSendSmePromiscuousModeRsp()
2046 *
2047 *FUNCTION:
2048 * This function is called by limProcessSmeMessages() to send
2049 * eWNI_PROMISCUOUS_MODE_RSP message to host
2050 *
2051 *PARAMS:
2052 *
2053 *LOGIC:
2054 *
2055 *ASSUMPTIONS:
2056 * NA
2057 *
2058 *NOTE:
2059 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2060 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2061 *
2062 * @param None
2063 * @return None
2064 */
2065void
2066limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2067{
2068#if 0
2069 tSirMsgQ mmhMsg;
2070 tSirMbMsg *pMbMsg;
2071
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302072 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2073 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 {
2075 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302076 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002077
2078 return;
2079 }
2080
2081 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2082 pMbMsg->msgLen = 4;
2083
2084 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2085 mmhMsg.bodyptr = pMbMsg;
2086 mmhMsg.bodyval = 0;
2087 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2088 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2089#endif
2090} /*** end limSendSmePromiscuousModeRsp() ***/
2091
2092
2093
2094/**
2095 * limSendSmeNeighborBssInd()
2096 *
2097 *FUNCTION:
2098 * This function is called by limLookupNaddHashEntry() to send
2099 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2100 *
2101 *PARAMS:
2102 *
2103 *LOGIC:
2104 *
2105 *ASSUMPTIONS:
2106 * NA
2107 *
2108 *NOTE:
2109 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2110 * host upon detecting new BSS during background scanning if CFG
2111 * option is enabled for sending such indication
2112 *
2113 * @param pMac - Pointer to Global MAC structure
2114 * @return None
2115 */
2116
2117void
2118limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2119 tLimScanResultNode *pBssDescr)
2120{
2121 tSirMsgQ msgQ;
2122 tANI_U32 val;
2123 tSirSmeNeighborBssInd *pNewBssInd;
2124
2125 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2126 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2127 pMac->lim.gLimRspReqd))
2128 {
2129 // LIM is not in background scan state OR
2130 // current scan is initiated by HDD.
2131 // No need to send new BSS indication to HDD
2132 return;
2133 }
2134
2135 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2136 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002137 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002138
2139 return;
2140 }
2141
2142 if (val == 0)
2143 return;
2144
2145 /**
2146 * Need to indicate new BSSs found during
2147 * background scanning to host.
2148 * Allocate buffer for sending indication.
2149 * Length of buffer is length of BSS description
2150 * and length of header itself
2151 */
2152 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302153 pNewBssInd = vos_mem_malloc(val);
2154 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 {
2156 // Log error
2157 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302158 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002159
2160 return;
2161 }
2162
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2164 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 pNewBssInd->sessionId = 0;
2166
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302167 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 (tANI_U8 *) &pBssDescr->bssDescription,
2169 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002170
2171 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2172 msgQ.bodyptr = pNewBssInd;
2173 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002174 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2176} /*** end limSendSmeNeighborBssInd() ***/
2177
2178/** -----------------------------------------------------------------
2179 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2180 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2181 \ SME only looks at rc and tspec field.
2182 \param pMac - global mac structure
2183 \param rspReqd - is SmeAddTsRsp required
2184 \param status - status code of SME_ADD_TS_RSP
2185 \return tspec
2186 \sa
2187 ----------------------------------------------------------------- */
2188void
2189limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2190 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2191{
2192 tpSirAddtsRsp rsp;
2193 tSirMsgQ mmhMsg;
2194
2195 if (! rspReqd)
2196 return;
2197
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302198 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2199 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302201 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 return;
2203 }
2204
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302205 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 rsp->messageType = eWNI_SME_ADDTS_RSP;
2207 rsp->rc = status;
2208 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302209 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 /* Update SME session Id and transcation Id */
2212 rsp->sessionId = smesessionId;
2213 rsp->transactionId = smetransactionId;
2214
2215 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2216 mmhMsg.bodyptr = rsp;
2217 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002218 if(NULL == psessionEntry)
2219 {
2220 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2221 }
2222 else
2223 {
2224 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2225 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002226#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2227 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2228#endif //FEATURE_WLAN_DIAG_SUPPORT
2229
2230 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2231 return;
2232}
2233
2234void
2235limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2236{
2237 tpSirAddtsRsp rsp;
2238 tSirMsgQ mmhMsg;
2239
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002240 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 addts->dialogToken,
2242 addts->tspec.tsinfo.traffic.tsid,
2243 addts->tspec.tsinfo.traffic.userPrio);
2244
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302245 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2246 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 {
2248 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302249 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 return;
2251 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302252 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
2254 rsp->messageType = eWNI_SME_ADDTS_IND;
2255
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302256 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002257
2258 mmhMsg.type = eWNI_SME_ADDTS_IND;
2259 mmhMsg.bodyptr = rsp;
2260 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002261 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2263}
2264
2265void
2266limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2267{
2268 tpSirDeltsRsp rsp;
2269 tSirMsgQ mmhMsg;
2270
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002271 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 delts->aid,
2273 delts->req.tsinfo.traffic.tsid,
2274 delts->req.tsinfo.traffic.userPrio,
2275 status);
2276 if (! delts->rspReqd)
2277 return;
2278
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302279 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2280 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 {
2282 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302283 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 return;
2285 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302286 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002287
2288 if(psessionEntry != NULL)
2289 {
2290
2291 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302292 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2293 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 }
2295
2296
2297 rsp->messageType = eWNI_SME_DELTS_RSP;
2298 rsp->rc = status;
2299
2300 /* Update SME session Id and transcation Id */
2301 rsp->sessionId = smesessionId;
2302 rsp->transactionId = smetransactionId;
2303
2304 mmhMsg.type = eWNI_SME_DELTS_RSP;
2305 mmhMsg.bodyptr = rsp;
2306 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002307 if(NULL == psessionEntry)
2308 {
2309 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2310 }
2311 else
2312 {
2313 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2314 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002315#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2316 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2317#endif //FEATURE_WLAN_DIAG_SUPPORT
2318
2319 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2320}
2321
2322void
2323limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2324{
2325 tpSirDeltsRsp rsp;
2326 tSirMsgQ mmhMsg;
2327
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002328 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 aid,
2330 delts->tsinfo.traffic.tsid,
2331 delts->tsinfo.traffic.userPrio);
2332
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302333 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2334 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 {
2336 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302337 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 return;
2339 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302340 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002341
2342 rsp->messageType = eWNI_SME_DELTS_IND;
2343 rsp->rc = eSIR_SUCCESS;
2344 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302345 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002346
2347 /* Update SME session Id and SME transaction Id */
2348
2349 rsp->sessionId = psessionEntry->smeSessionId;
2350 rsp->transactionId = psessionEntry->transactionId;
2351
2352 mmhMsg.type = eWNI_SME_DELTS_IND;
2353 mmhMsg.bodyptr = rsp;
2354 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002355 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002356#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2357 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2358#endif //FEATURE_WLAN_DIAG_SUPPORT
2359
2360 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2361}
2362
2363/**
2364 * limSendSmeStatsRsp()
2365 *
2366 *FUNCTION:
2367 * This function is called to send 802.11 statistics response to HDD.
2368 * This function posts the result back to HDD. This is a response to
2369 * HDD's request for statistics.
2370 *
2371 *PARAMS:
2372 *
2373 *LOGIC:
2374 *
2375 *ASSUMPTIONS:
2376 * NA
2377 *
2378 *NOTE:
2379 * NA
2380 *
2381 * @param pMac Pointer to Global MAC structure
2382 * @param p80211Stats Statistics sent in response
2383 * @param resultCode TODO:
2384 *
2385 *
2386 * @return none
2387 */
2388
2389void
2390limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2391{
2392 tSirMsgQ mmhMsg;
2393 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2394
2395 switch(msgType)
2396 {
2397 case WDA_STA_STAT_RSP:
2398 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2399 break;
2400 case WDA_AGGR_STAT_RSP:
2401 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2402 break;
2403 case WDA_GLOBAL_STAT_RSP:
2404 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2405 break;
2406 case WDA_STAT_SUMM_RSP:
2407 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2408 break;
2409 default:
2410 mmhMsg.type = msgType; //Response from within PE
2411 break;
2412 }
2413
2414 pMsgHdr->messageType = mmhMsg.type;
2415
2416 mmhMsg.bodyptr = stats;
2417 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002418 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2420
2421 return;
2422
2423} /*** end limSendSmeStatsRsp() ***/
2424
2425/**
2426 * limSendSmePEStatisticsRsp()
2427 *
2428 *FUNCTION:
2429 * This function is called to send 802.11 statistics response to HDD.
2430 * This function posts the result back to HDD. This is a response to
2431 * HDD's request for statistics.
2432 *
2433 *PARAMS:
2434 *
2435 *LOGIC:
2436 *
2437 *ASSUMPTIONS:
2438 * NA
2439 *
2440 *NOTE:
2441 * NA
2442 *
2443 * @param pMac Pointer to Global MAC structure
2444 * @param p80211Stats Statistics sent in response
2445 * @param resultCode TODO:
2446 *
2447 *
2448 * @return none
2449 */
2450
2451void
2452limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2453{
2454 tSirMsgQ mmhMsg;
2455 tANI_U8 sessionId;
2456 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2457 tpPESession pPeSessionEntry;
2458
2459 //Get the Session Id based on Sta Id
2460 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2461
2462 //Fill the Session Id
2463 if(NULL != pPeSessionEntry)
2464 {
2465 //Fill the Session Id
2466 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2467 }
2468
2469 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2470
2471
2472 //msgType should be WDA_GET_STATISTICS_RSP
2473 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2474
2475 mmhMsg.bodyptr = stats;
2476 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002477 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2479
2480 return;
2481
2482} /*** end limSendSmePEStatisticsRsp() ***/
2483
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002484#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002485/**
2486 * limSendSmePEGetRoamRssiRsp()
2487 *
2488 *FUNCTION:
2489 * This function is called to send roam rssi response to HDD.
2490 * This function posts the result back to HDD. This is a response to
2491 * HDD's request to get roam rssi.
2492 *
2493 *PARAMS:
2494 *
2495 *LOGIC:
2496 *
2497 *ASSUMPTIONS:
2498 * NA
2499 *
2500 *NOTE:
2501 * NA
2502 *
2503 * @param pMac Pointer to Global MAC structure
2504 * @param p80211Stats Statistics sent in response
2505 * @param resultCode TODO:
2506 *
2507 *
2508 * @return none
2509 */
2510
2511void
2512limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2513{
2514 tSirMsgQ mmhMsg;
2515 tANI_U8 sessionId;
2516 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2517 tpPESession pPeSessionEntry = NULL;
2518
2519 //Get the Session Id based on Sta Id
2520 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2521
2522 //Fill the Session Id
2523 if(NULL != pPeSessionEntry)
2524 {
2525 //Fill the Session Id
2526 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2527 }
2528
2529 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2530
2531 //msgType should be WDA_GET_STATISTICS_RSP
2532 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2533
2534 mmhMsg.bodyptr = stats;
2535 mmhMsg.bodyval = 0;
2536 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2537 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2538
2539 return;
2540
2541} /*** end limSendSmePEGetRoamRssiRsp() ***/
2542
2543#endif
2544
Jeff Johnson295189b2012-06-20 16:38:30 -07002545
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002546#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002547/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002548 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002549 *
2550 *FUNCTION:
2551 * This function is called to send tsm stats response to HDD.
2552 * This function posts the result back to HDD. This is a response to
2553 * HDD's request to get tsm stats.
2554 *
2555 *PARAMS:
2556 * @param pMac - Pointer to global pMac structure
2557 * @param pStats - Pointer to TSM Stats
2558 *
2559 * @return none
2560 */
2561
2562void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002563limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002564{
2565 tSirMsgQ mmhMsg;
2566 tANI_U8 sessionId;
2567 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2568 tpPESession pPeSessionEntry = NULL;
2569
2570 //Get the Session Id based on Sta Id
2571 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2572
2573 //Fill the Session Id
2574 if(NULL != pPeSessionEntry)
2575 {
2576 //Fill the Session Id
2577 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2578 }
2579 else
2580 {
2581 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2582 pPeStats->staId);)
2583 return;
2584 }
2585
2586 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002587 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2588 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002589
2590 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2591 mmhMsg.bodyptr = pStats;
2592 mmhMsg.bodyval = 0;
2593 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2594 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2595
2596 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002597} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002598
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002599#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002600
2601
Jeff Johnson295189b2012-06-20 16:38:30 -07002602void
2603limSendSmeIBSSPeerInd(
2604 tpAniSirGlobal pMac,
2605 tSirMacAddr peerMacAddr,
2606 tANI_U16 staIndex,
2607 tANI_U8 ucastIdx,
2608 tANI_U8 bcastIdx,
2609 tANI_U8 *beacon,
2610 tANI_U16 beaconLen,
2611 tANI_U16 msgType,
2612 tANI_U8 sessionId)
2613{
2614 tSirMsgQ mmhMsg;
2615 tSmeIbssPeerInd *pNewPeerInd;
2616
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302617 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2618 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002619 {
2620 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2621 return;
2622 }
2623
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302624 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002625
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302626 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 peerMacAddr, sizeof(tSirMacAddr));
2628 pNewPeerInd->staId= staIndex;
2629 pNewPeerInd->ucastSig = ucastIdx;
2630 pNewPeerInd->bcastSig = bcastIdx;
2631 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2632 pNewPeerInd->mesgType = msgType;
2633 pNewPeerInd->sessionId = sessionId;
2634
2635 if ( beacon != NULL )
2636 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302637 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2638 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 }
2640
2641 mmhMsg.type = msgType;
2642// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2643 mmhMsg.bodyptr = pNewPeerInd;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002644 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2646
2647}
2648
2649
2650/** -----------------------------------------------------------------
2651 \brief limSendExitBmpsInd() - sends exit bmps indication
2652
2653 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2654 code to SME. This will trigger SME to get out of BMPS mode.
2655
2656 \param pMac - global mac structure
2657 \param reasonCode - reason for which PE wish to exit BMPS
2658 \return none
2659 \sa
2660 ----------------------------------------------------------------- */
2661void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2662{
2663 tSirMsgQ mmhMsg;
2664 tANI_U16 msgLen = 0;
2665 tpSirSmeExitBmpsInd pExitBmpsInd;
2666
2667 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302668 pExitBmpsInd = vos_mem_malloc(msgLen);
2669 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302671 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 return;
2673 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302674 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002675
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2677 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 pExitBmpsInd->exitBmpsReason = reasonCode;
2679 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2680
2681 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2682 mmhMsg.bodyptr = pExitBmpsInd;
2683 mmhMsg.bodyval = 0;
2684
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002685 PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002686 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002687#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2688 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2689#endif //FEATURE_WLAN_DIAG_SUPPORT
2690
2691 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2692 return;
2693
2694} /*** end limSendExitBmpsInd() ***/
2695
2696
2697
2698
2699/*--------------------------------------------------------------------------
2700 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2701
2702
2703 \param pMac - pointer to global adapter context
2704 \param sessionId - Message pointer.
2705
2706 \sa
2707 --------------------------------------------------------------------------*/
2708
2709void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2710{
2711 tpPESession psessionEntry;
2712 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2713 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2714 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002715 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 return;
2717 }
2718 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2719 {
2720 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2721 }
2722 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2723 {
2724 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2725 }
2726
2727 else
2728 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2729
2730}
2731
2732#ifdef WLAN_FEATURE_VOWIFI_11R
2733/** -----------------------------------------------------------------
2734 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2735 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2736 \ SME only looks at rc and tspec field.
2737 \param pMac - global mac structure
2738 \param rspReqd - is SmeAddTsRsp required
2739 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2740 \return tspec
2741 \sa
2742 ----------------------------------------------------------------- */
2743void
2744limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2745 tANI_U8 smesessionId)
2746{
2747 tSirMsgQ mmhMsg;
2748
2749 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2750 mmhMsg.bodyptr = aggrQosRsp;
2751 mmhMsg.bodyval = 0;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302752 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002753 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2754
2755 return;
2756}
2757#endif
2758
2759/** -----------------------------------------------------------------
2760 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2761 before switching channels for spectrum manangement.
2762
2763 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2764
2765 \param pMac - global mac structure
2766 \return none
2767 \sa
2768 ----------------------------------------------------------------- */
2769void
2770limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2771{
2772 tSirMsgQ mmhMsg;
2773
2774 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2775 mmhMsg.bodyptr = NULL;
2776 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002777 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002778 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2779
2780 return;
2781}
2782
2783/** -----------------------------------------------------------------
2784 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2785 after channel switch for spectrum manangement is complete.
2786
2787 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2788
2789 \param pMac - global mac structure
2790 \return none
2791 \sa
2792 ----------------------------------------------------------------- */
2793void
2794limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2795{
2796 tSirMsgQ mmhMsg;
2797
2798 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2799 mmhMsg.bodyptr = NULL;
2800 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002801 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002802 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2803
2804 return;
2805}
2806
2807void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2808 tANI_U8 smesessionId)
2809{
2810 tSirMsgQ mmhMsg;
2811 tSmeMaxAssocInd *pSmeMaxAssocInd;
2812
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302813 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2814 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002815 {
2816 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2817 return;
2818 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302819 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2820 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2821 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2823 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2824 pSmeMaxAssocInd->sessionId = smesessionId;
2825 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2826 mmhMsg.bodyptr = pSmeMaxAssocInd;
Arif Hussain24bafea2013-11-15 15:10:03 -08002827 PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2828 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr));)
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002829 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2831
2832 return;
2833}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002834#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2835/** -----------------------------------------------------------------
2836 \brief limSendSmeCandidateFoundInd() - sends
2837 eWNI_SME_CANDIDATE_FOUND_IND
2838
2839 After receiving candidate found indication frame from FW, this
2840 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2841 roam candidate(s) are available.
2842
2843 \param pMac - global mac structure
2844 \param psessionEntry - session info
2845 \return none
2846 \sa
2847 ----------------------------------------------------------------- */
2848void
2849limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2850{
2851 tSirMsgQ mmhMsg;
2852 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2853
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302854 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2855 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002856 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302857 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002858 return;
2859 }
2860
2861 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
2862 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeDisassocInd);
2863
2864 pSirSmeCandidateFoundInd->sessionId = sessionId;
2865
2866
2867 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2868 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2869 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2870 mmhMsg.bodyval = 0;
2871
2872 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2873
2874} /*** end limSendSmeCandidateFoundInd() ***/
2875#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD