blob: 4fa7b6105624eaaf9ed0635e5259148e7900be7a [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
201
202/**
203 * limSendSmeJoinReassocRsp()
204 *
205 *FUNCTION:
206 * This function is called by limProcessSmeReqMessages() to send
207 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
208 * above MAC Software.
209 *
210 *PARAMS:
211 *
212 *LOGIC:
213 *
214 *ASSUMPTIONS:
215 * NA
216 *
217 *NOTE:
218 * NA
219 *
220 * @param pMac Pointer to Global MAC structure
221 * @param msgType Indicates message type
222 * @param resultCode Indicates the result of previously issued
223 * eWNI_SME_msgType_REQ message
224 *
225 * @return None
226 */
227
228void
229limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
230 tSirResultCodes resultCode, tANI_U16 protStatusCode,
231 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
232{
233 tpSirSmeJoinRsp pSirSmeJoinRsp;
234 tANI_U32 rspLen;
235 tpDphHashNode pStaDs = NULL;
236
237#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
238 if (msgType == eWNI_SME_REASSOC_RSP)
239 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
240 else
241 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
242#endif //FEATURE_WLAN_DIAG_SUPPORT
243
244 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700245 FL("Sending message %s with reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700246 limMsgStr(msgType), limResultCodeStr(resultCode));)
247
248 if(psessionEntry == NULL)
249 {
250
251 rspLen = sizeof(tSirSmeJoinRsp);
252
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530253 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
254 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700255 {
256 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530257 limLog(pMac, LOGP, FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 return;
259 }
260
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530261 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700262
263
264 pSirSmeJoinRsp->beaconLength = 0;
265 pSirSmeJoinRsp->assocReqLength = 0;
266 pSirSmeJoinRsp->assocRspLength = 0;
267 }
268
269 else
270 {
271 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
272 psessionEntry->bcnLen +
273#ifdef WLAN_FEATURE_VOWIFI_11R
274 psessionEntry->RICDataLen +
275#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800276#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 psessionEntry->tspecLen +
278#endif
279 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530280
281 pSirSmeJoinRsp = vos_mem_malloc(rspLen);
282 if ( NULL == pSirSmeJoinRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 {
284 /// Buffer not available. Log error
285 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530286 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700287
288 return;
289 }
290
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530291 vos_mem_set((tANI_U8*)pSirSmeJoinRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700292
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 if (resultCode == eSIR_SME_SUCCESS)
294 {
295 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
296 if (pStaDs == NULL)
297 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700298 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 }
300 else
301 {
Jeff Johnson62c27982013-02-27 17:53:55 -0800302 //Pass the peer's staId
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 pSirSmeJoinRsp->staId = pStaDs->staIndex;
Jeff Johnson62c27982013-02-27 17:53:55 -0800304 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
305 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 }
307 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700308
309 pSirSmeJoinRsp->beaconLength = 0;
310 pSirSmeJoinRsp->assocReqLength = 0;
311 pSirSmeJoinRsp->assocRspLength = 0;
312#ifdef WLAN_FEATURE_VOWIFI_11R
313 pSirSmeJoinRsp->parsedRicRspLen = 0;
314#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800315#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 pSirSmeJoinRsp->tspecIeLen = 0;
317#endif
318
319 if(resultCode == eSIR_SME_SUCCESS)
320 {
321
322 if(psessionEntry->beacon != NULL)
323 {
324 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530325 vos_mem_copy( pSirSmeJoinRsp->frames, psessionEntry->beacon,
326 pSirSmeJoinRsp->beaconLength);
327 vos_mem_free( psessionEntry->beacon);
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 psessionEntry->beacon = NULL;
329#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700330 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d"), psessionEntry->bcnLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331#endif
332 }
333
334 if(psessionEntry->assocReq != NULL)
335 {
336 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530337 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen,
338 psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
339 vos_mem_free( psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 psessionEntry->assocReq = NULL;
341#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700342 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d"), psessionEntry->assocReqLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700343#endif
344 }
345 if(psessionEntry->assocRsp != NULL)
346 {
347 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530348 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
349 psessionEntry->assocReqLen,
350 psessionEntry->assocRsp,
351 pSirSmeJoinRsp->assocRspLength);
352 vos_mem_free( psessionEntry->assocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 psessionEntry->assocRsp = NULL;
354 }
355#ifdef WLAN_FEATURE_VOWIFI_11R
356 if(psessionEntry->ricData != NULL)
357 {
358 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530359 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
360 psessionEntry->assocReqLen + psessionEntry->assocRspLen,
361 psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
362 vos_mem_free(psessionEntry->ricData);
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 psessionEntry->ricData = NULL;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700364 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 }
366#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800367#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 if(psessionEntry->tspecIes != NULL)
369 {
370 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530371 vos_mem_copy( pSirSmeJoinRsp->frames + psessionEntry->bcnLen +
372 psessionEntry->assocReqLen + psessionEntry->assocRspLen +
373 psessionEntry->RICDataLen,
374 psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
375 vos_mem_free(psessionEntry->tspecIes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 psessionEntry->tspecIes = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800377 PELOG1(limLog(pMac, LOG1, FL("ESE-TspecLen=%d"), psessionEntry->tspecLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 }
379#endif
380 pSirSmeJoinRsp->aid = psessionEntry->limAID;
381#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700382 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d"), psessionEntry->assocRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700383#endif
384 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700385 else
386 {
387
388 if(psessionEntry->beacon != NULL)
389 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530390 vos_mem_free(psessionEntry->beacon);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700391 psessionEntry->beacon = NULL;
392 }
393
394 if(psessionEntry->assocReq != NULL)
395 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530396 vos_mem_free( psessionEntry->assocReq);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700397 psessionEntry->assocReq = NULL;
398 }
399
400 if(psessionEntry->assocRsp != NULL)
401 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530402 vos_mem_free( psessionEntry->assocRsp);
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700403 psessionEntry->assocRsp = NULL;
404 }
405
406 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 }
408
409
410 pSirSmeJoinRsp->messageType = msgType;
411 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
412 pSirSmeJoinRsp->statusCode = resultCode;
413 pSirSmeJoinRsp->protStatusCode = protStatusCode;
414
415 /* Update SME session ID and transaction Id */
416 pSirSmeJoinRsp->sessionId = smesessionId;
417 pSirSmeJoinRsp->transactionId = smetransactionId;
418
419 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
420 {
421 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
422 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700423
424#ifdef WLAN_FEATURE_11AC
425 if (psessionEntry->vhtCapability)
426 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700427 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700428 /*Get 11ac cbState from 11n cbState*/
429 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
430 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700431 psessionEntry->htSecondaryChannelOffset,
432 psessionEntry->apCenterChan,
433 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700434 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
435 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700436 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700437#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700438 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 }
440 else
441 {
442 peSetResumeChannel( pMac, 0, 0);
443 }
444 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
445 (tANI_U32*) pSirSmeJoinRsp );
446 }
447 else
448 {
449 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
450 (tANI_U32*) pSirSmeJoinRsp );
451 }
452} /*** end limSendSmeJoinReassocRsp() ***/
453
454
455
456/**
457 * limSendSmeStartBssRsp()
458 *
459 *FUNCTION:
460 * This function is called to send eWNI_SME_START_BSS_RSP
461 * message to applications above MAC Software.
462 *
463 *PARAMS:
464 *
465 *LOGIC:
466 *
467 *ASSUMPTIONS:
468 * NA
469 *
470 *NOTE:
471 * NA
472 *
473 * @param pMac Pointer to Global MAC structure
474 * @param msgType Indicates message type
475 * @param resultCode Indicates the result of previously issued
476 * eWNI_SME_msgType_REQ message
477 *
478 * @return None
479 */
480
481void
482limSendSmeStartBssRsp(tpAniSirGlobal pMac,
483 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
484 tANI_U8 smesessionId,tANI_U16 smetransactionId)
485{
486
487
488 tANI_U16 size = 0;
489 tSirMsgQ mmhMsg;
490 tSirSmeStartBssRsp *pSirSmeRsp;
491 tANI_U16 ieLen;
492 tANI_U16 ieOffset, curLen;
493
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700494 PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 limMsgStr(msgType), limResultCodeStr(resultCode));)
496
497 size = sizeof(tSirSmeStartBssRsp);
498
499 if(psessionEntry == NULL)
500 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530501 pSirSmeRsp = vos_mem_malloc(size);
502 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 {
504 /// Buffer not available. Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530505 limLog(pMac, LOGP,FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 return;
507 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530508 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700509
510 }
511 else
512 {
513 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
514 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
515 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
516 //calculate the memory size to allocate
517 size += ieLen;
518
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530519 pSirSmeRsp = vos_mem_malloc(size);
520 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 {
522 /// Buffer not available. Log error
523 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530524 FL("call to AllocateMemory failed for eWNI_SME_START_BSS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700525
526 return;
527 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530528 vos_mem_set((tANI_U8*)pSirSmeRsp, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 size = sizeof(tSirSmeStartBssRsp);
530 if (resultCode == eSIR_SME_SUCCESS)
531 {
532
533 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
534
535 /* Read beacon interval from session */
536 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
537 pSirSmeRsp->bssType = psessionEntry->bssType;
538
539 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
540 != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700541 limLog(pMac, LOGP, FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700542
543 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
544
545#if 0
546 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700547 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700548
549#endif// TO SUPPORT BT-AMP
550
551 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
552
553 pSirSmeRsp->bssDescription.aniIndicator = 1;
554
555 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530556 vos_mem_copy( (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
558 (tANI_U32)curLen);
559
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530560 vos_mem_copy( ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 pMac->sch.schObject.gSchBeaconFrameEnd,
562 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
563
564
565 //subtracting size of length indicator itself and size of pointer to ieFields
566 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
567 sizeof(tANI_U16) - sizeof(tANI_U32) +
568 ieLen;
569 //This is the size of the message, subtracting the size of the pointer to ieFields
570 size += ieLen - sizeof(tANI_U32);
571 }
572
573
574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575
576 }
577
578 pSirSmeRsp->messageType = msgType;
579 pSirSmeRsp->length = size;
580
581 /* Update SME session Id and transaction Id */
582 pSirSmeRsp->sessionId = smesessionId;
583 pSirSmeRsp->transactionId = smetransactionId;
584 pSirSmeRsp->statusCode = resultCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 if(psessionEntry != NULL )
586 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
587
Jeff Johnson295189b2012-06-20 16:38:30 -0700588
589 mmhMsg.type = msgType;
590 mmhMsg.bodyptr = pSirSmeRsp;
591 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800592 if(psessionEntry == NULL)
593 {
594 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
595 }
596 else
597 {
598 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
599 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700600#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
601 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
602#endif //FEATURE_WLAN_DIAG_SUPPORT
603
604 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
605} /*** end limSendSmeStartBssRsp() ***/
606
607
608
609
610
611#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
612#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
613
614
615/**
616 * limSendSmeScanRsp()
617 *
618 *FUNCTION:
619 * This function is called by limProcessSmeReqMessages() to send
620 * eWNI_SME_SCAN_RSP message to applications above MAC
621 * Software.
622 *
623 *PARAMS:
624 *
625 *LOGIC:
626 *
627 *ASSUMPTIONS:
628 * NA
629 *
630 *NOTE:
631 * NA
632 *
633 * @param pMac Pointer to Global MAC structure
634 * @param length Indicates length of message
635 * @param resultCode Indicates the result of previously issued
636 * eWNI_SME_SCAN_REQ message
637 *
638 * @return None
639 */
640
641void
642limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
643 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
644{
645 tSirMsgQ mmhMsg;
646 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
647 tLimScanResultNode *ptemp = NULL;
648 tANI_U16 msgLen, allocLength, curMsgLen = 0;
649 tANI_U16 i, bssCount;
650 tANI_U8 *pbBuf;
651 tSirBssDescription *pDesc;
652
653 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700654 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 length, limResultCodeStr(resultCode));)
656
657 if (resultCode != eSIR_SME_SUCCESS)
658 {
659 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
660 return;
661 }
662
663 mmhMsg.type = eWNI_SME_SCAN_RSP;
664 i = 0;
665 bssCount = 0;
666 msgLen = 0;
667 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530668 pSirSmeScanRsp = vos_mem_malloc(allocLength);
669 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 {
671 // Log error
672 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530673 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700674
675 return;
676 }
677 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
678 {
679 //when ptemp is not NULL it is a left over
680 ptemp = pMac->lim.gLimCachedScanHashTable[i];
681 while(ptemp)
682 {
683 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
684 if(0 == bssCount)
685 {
686 msgLen = sizeof(tSirSmeScanRsp) -
687 sizeof(tSirBssDescription) +
688 ptemp->bssDescription.length +
689 sizeof(ptemp->bssDescription.length);
690 pDesc = pSirSmeScanRsp->bssDescription;
691 }
692 else
693 {
694 msgLen += ptemp->bssDescription.length +
695 sizeof(ptemp->bssDescription.length);
696 pDesc = (tSirBssDescription *)pbBuf;
697 }
698 if( (allocLength < msgLen) ||
699 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
700 {
701 pSirSmeScanRsp->statusCode =
702 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
704 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 mmhMsg.bodyptr = pSirSmeScanRsp;
706 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700707 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530709 pSirSmeScanRsp = vos_mem_malloc(allocLength);
710 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 {
712 // Log error
713 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530714 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 return;
716 }
717 msgLen = sizeof(tSirSmeScanRsp) -
718 sizeof(tSirBssDescription) +
719 ptemp->bssDescription.length +
720 sizeof(ptemp->bssDescription.length);
721 pDesc = pSirSmeScanRsp->bssDescription;
722 bssCount = 1;
723 }
724 curMsgLen = msgLen;
725
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700726 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 msgLen, ptemp->bssDescription.length);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 pDesc->length
729 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530730 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
731 (tANI_U8 *) &ptemp->bssDescription.bssId,
732 ptemp->bssDescription.length);
Jeff Johnson295189b2012-06-20 16:38:30 -0700733
734 PELOG2(limLog(pMac, LOG2, FL("BssId "));
735 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
736
737 pSirSmeScanRsp->sessionId = smesessionId;
738 pSirSmeScanRsp->transcationId = smetranscationId;
739
740 ptemp = ptemp->next;
741 } //while(ptemp)
742 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
743
744 if(0 == bssCount)
745 {
746 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700747 if (NULL != pSirSmeScanRsp)
748 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530749 vos_mem_free( pSirSmeScanRsp);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700750 pSirSmeScanRsp = NULL;
751 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 }
753 else
754 {
755 // send last message
756 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
758 pSirSmeScanRsp->length = curMsgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -0700759
760 /* Update SME session Id and SME transcation Id */
761 pSirSmeScanRsp->sessionId = smesessionId;
762 pSirSmeScanRsp->transcationId = smetranscationId;
763
764 mmhMsg.type = eWNI_SME_SCAN_RSP;
765 mmhMsg.bodyptr = pSirSmeScanRsp;
766 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700767 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700769 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 }
771
772 return;
773
774} /*** end limSendSmeScanRsp() ***/
775
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700776#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
777/**
778 * limSendSmeLfrScanRsp()
779 *
780 *FUNCTION:
781 * This function is called by limProcessSmeReqMessages() to send
782 * eWNI_SME_SCAN_RSP message to applications above MAC Software
783 * only for sending up the roam candidates.
784 *
785 *PARAMS:
786 *
787 *LOGIC:
788 *
789 *ASSUMPTIONS:
790 * NA
791 *
792 *NOTE:
793 * NA
794 *
795 * @param pMac Pointer to Global MAC structure
796 * @param length Indicates length of message
797 * @param resultCode Indicates the result of previously issued
798 * eWNI_SME_SCAN_REQ message
799 *
800 * @return None
801 */
802
803void
804limSendSmeLfrScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
805 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
806{
807 tSirMsgQ mmhMsg;
808 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
809 tLimScanResultNode *ptemp = NULL;
810 tANI_U16 msgLen, allocLength, curMsgLen = 0;
811 tANI_U16 i, bssCount;
812 tANI_U8 *pbBuf;
813 tSirBssDescription *pDesc;
814
815 PELOG1(limLog(pMac, LOG1,
816 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
817 length, limResultCodeStr(resultCode));)
818
819 if (resultCode != eSIR_SME_SUCCESS)
820 {
821 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
822 return;
823 }
824
825 mmhMsg.type = eWNI_SME_SCAN_RSP;
826 i = 0;
827 bssCount = 0;
828 msgLen = 0;
829 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530830 pSirSmeScanRsp = vos_mem_malloc(allocLength);
831 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700832 {
833 // Log error
834 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530835 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700836
837 return;
838 }
839 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
840 {
841 //when ptemp is not NULL it is a left over
842 ptemp = pMac->lim.gLimCachedLfrScanHashTable[i];
843 while(ptemp)
844 {
845 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
846 if(0 == bssCount)
847 {
848 msgLen = sizeof(tSirSmeScanRsp) -
849 sizeof(tSirBssDescription) +
850 ptemp->bssDescription.length +
851 sizeof(ptemp->bssDescription.length);
852 pDesc = pSirSmeScanRsp->bssDescription;
853 }
854 else
855 {
856 msgLen += ptemp->bssDescription.length +
857 sizeof(ptemp->bssDescription.length);
858 pDesc = (tSirBssDescription *)pbBuf;
859 }
860 if ( (allocLength < msgLen) ||
861 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
862 {
863 pSirSmeScanRsp->statusCode =
864 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
865 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
866 pSirSmeScanRsp->length = curMsgLen;
867 mmhMsg.bodyptr = pSirSmeScanRsp;
868 mmhMsg.bodyval = 0;
869 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
870 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530871 pSirSmeScanRsp = vos_mem_malloc(allocLength);
872 if ( NULL == pSirSmeScanRsp )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700873 {
874 // Log error
875 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530876 FL("call to AllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700877 return;
878 }
879 msgLen = sizeof(tSirSmeScanRsp) -
880 sizeof(tSirBssDescription) +
881 ptemp->bssDescription.length +
882 sizeof(ptemp->bssDescription.length);
883 pDesc = pSirSmeScanRsp->bssDescription;
884 bssCount = 1;
885 }
886 curMsgLen = msgLen;
887
888 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
889 msgLen, ptemp->bssDescription.length);)
890 pDesc->length
891 = ptemp->bssDescription.length;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530892 vos_mem_copy( (tANI_U8 *) &pDesc->bssId,
893 (tANI_U8 *) &ptemp->bssDescription.bssId,
894 ptemp->bssDescription.length);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700895
896 PELOG2(limLog(pMac, LOG2, FL("BssId "));
897 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
898
899 pSirSmeScanRsp->sessionId = smesessionId;
900 pSirSmeScanRsp->transcationId = smetranscationId;
901
902 ptemp = ptemp->next;
903 } //while(ptemp)
904 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
905
906 if (0 == bssCount)
907 {
908 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
909 if (NULL != pSirSmeScanRsp)
910 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530911 vos_mem_free( pSirSmeScanRsp);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700912 pSirSmeScanRsp = NULL;
913 }
914 }
915 else
916 {
917 // send last message
918 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
919 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
920 pSirSmeScanRsp->length = curMsgLen;
921
922 /* Update SME session Id and SME transcation Id */
923 pSirSmeScanRsp->sessionId = smesessionId;
924 pSirSmeScanRsp->transcationId = smetranscationId;
925
926 mmhMsg.type = eWNI_SME_SCAN_RSP;
927 mmhMsg.bodyptr = pSirSmeScanRsp;
928 mmhMsg.bodyval = 0;
929 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
930 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
931 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
932 }
933
934 return;
935
936} /*** end limSendSmeLfrScanRsp() ***/
937#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -0700938
939/**
940 * limPostSmeScanRspMessage()
941 *
942 *FUNCTION:
943 * This function is called by limSendSmeScanRsp() to send
944 * eWNI_SME_SCAN_RSP message with failed result code
945 *
946 *NOTE:
947 * NA
948 *
949 * @param pMac Pointer to Global MAC structure
950 * @param length Indicates length of message
951 * @param resultCode failed result code
952 *
953 * @return None
954 */
955
956void
957limPostSmeScanRspMessage(tpAniSirGlobal pMac,
958 tANI_U16 length,
959 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
960{
961 tpSirSmeScanRsp pSirSmeScanRsp;
962 tSirMsgQ mmhMsg;
963
964 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700965 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 length, limResultCodeStr(resultCode));)
967
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530968 pSirSmeScanRsp = vos_mem_malloc(length);
969 if ( NULL == pSirSmeScanRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530971 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_SCAN_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 return;
973 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530974 vos_mem_set((void*)pSirSmeScanRsp, length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700975
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
977 pSirSmeScanRsp->length = length;
Jeff Johnson295189b2012-06-20 16:38:30 -0700978
979 if(sizeof(tSirSmeScanRsp) <= length)
980 {
981 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
982 }
983
984 pSirSmeScanRsp->statusCode = resultCode;
985
986 /*Update SME session Id and transaction Id */
987 pSirSmeScanRsp->sessionId = smesessionId;
988 pSirSmeScanRsp->transcationId = smetransactionId;
989
990 mmhMsg.type = eWNI_SME_SCAN_RSP;
991 mmhMsg.bodyptr = pSirSmeScanRsp;
992 mmhMsg.bodyval = 0;
993
Jeff Johnsone7245742012-09-05 17:12:55 -0700994 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700995#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
996 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
997#endif //FEATURE_WLAN_DIAG_SUPPORT
998
999 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1000 return;
1001
1002} /*** limPostSmeScanRspMessage ***/
1003
Jeff Johnsone7245742012-09-05 17:12:55 -07001004#ifdef FEATURE_OEM_DATA_SUPPORT
1005
1006/**
1007 * limSendSmeOemDataRsp()
1008 *
1009 *FUNCTION:
1010 * This function is called by limProcessSmeReqMessages() to send
1011 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
1012 * Software.
1013 *
1014 *PARAMS:
1015 *
1016 *LOGIC:
1017 *
1018 *ASSUMPTIONS:
1019 * NA
1020 *
1021 *NOTE:
1022 * NA
1023 *
1024 * @param pMac Pointer to Global MAC structure
1025 * @param pMsgBuf Indicates the mlm message
1026 * @param resultCode Indicates the result of previously issued
1027 * eWNI_SME_OEM_DATA_RSP message
1028 *
1029 * @return None
1030 */
1031
1032void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
1033{
1034 tSirMsgQ mmhMsg;
1035 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
1036 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
1037 tANI_U16 msgLength;
1038
1039
1040 //get the pointer to the mlm message
1041 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
1042
1043 msgLength = sizeof(tSirOemDataRsp);
1044
1045 //now allocate memory for the char buffer
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301046 pSirSmeOemDataRsp = vos_mem_malloc(msgLength);
1047 if (NULL == pSirSmeOemDataRsp)
Jeff Johnsone7245742012-09-05 17:12:55 -07001048 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301049 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSirSmeOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001050 return;
1051 }
1052
1053#if defined (ANI_LITTLE_BYTE_ENDIAN)
1054 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
1055 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
1056#else
1057 pSirSmeOemDataRsp->length = msgLength;
1058 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
1059#endif
1060
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301061 vos_mem_copy(pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001062
1063 //Now free the memory from MLM Rsp Message
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301064 vos_mem_free(pMlmOemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001065
1066 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
1067 mmhMsg.bodyptr = pSirSmeOemDataRsp;
1068 mmhMsg.bodyval = 0;
1069
1070 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1071
1072 return;
1073} /*** limSendSmeOemDataRsp ***/
1074
1075#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001076
1077
1078/**
1079 * limSendSmeAuthRsp()
1080 *
1081 *FUNCTION:
1082 * This function is called by limProcessSmeMessages() to send
1083 * eWNI_SME_AUTH_RSP message to host
1084 *
1085 *PARAMS:
1086 *
1087 *LOGIC:
1088 *
1089 *ASSUMPTIONS:
1090 * NA
1091 *
1092 *NOTE:
1093 * NA
1094 *
1095 * @param pMac Pointer to Global MAC structure
1096 * @param statusCode Indicates the result of previously issued
1097 * eWNI_SME_AUTH_REQ message
1098 *
1099 * @return None
1100 */
1101void
1102limSendSmeAuthRsp(tpAniSirGlobal pMac,
1103 tSirResultCodes statusCode,
1104 tSirMacAddr peerMacAddr,
1105 tAniAuthType authType,
1106 tANI_U16 protStatusCode,
1107 tpPESession psessionEntry,tANI_U8 smesessionId,
1108 tANI_U16 smetransactionId)
1109{
1110#if 0
1111 tSirMsgQ mmhMsg;
1112 tSirSmeAuthRsp *pSirSmeAuthRsp;
1113
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301114 pSirSmeAuthRsp = vos_mem_malloc(sizeof(tSirSmeAuthRsp));
1115 if (NULL == pSirSmeAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 {
1117 // Log error
1118 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301119 FL("call to AllocateMemory failed for eWNI_SME_AUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001120
1121 return;
1122 }
1123
Jeff Johnson295189b2012-06-20 16:38:30 -07001124
1125
1126 if(psessionEntry != NULL)
1127 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301128 vos_mem_copy( (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1130 pSirSmeAuthRsp->authType = authType;
1131
1132 }
1133
1134 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1135 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1136 pSirSmeAuthRsp->statusCode = statusCode;
1137 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1138
1139 /* Update SME session and transaction Id*/
1140 pSirSmeAuthRsp->sessionId = smesessionId;
1141 pSirSmeAuthRsp->transactionId = smetransactionId;
1142
1143 mmhMsg.type = eWNI_SME_AUTH_RSP;
1144 mmhMsg.bodyptr = pSirSmeAuthRsp;
1145 mmhMsg.bodyval = 0;
1146 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1147 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1148#endif
1149} /*** end limSendSmeAuthRsp() ***/
1150
1151
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001152void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 eHalStatus status, tANI_U32 *pCtx )
1154{
1155 tSirMsgQ mmhMsg;
1156 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1157
1158 mmhMsg.type = pMsg->type;
1159 mmhMsg.bodyptr = pMsg;
1160 mmhMsg.bodyval = 0;
1161
Jeff Johnsone7245742012-09-05 17:12:55 -07001162 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001163
1164 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1165}
1166/**
1167 * limSendSmeDisassocNtf()
1168 *
1169 *FUNCTION:
1170 * This function is called by limProcessSmeMessages() to send
1171 * eWNI_SME_DISASSOC_RSP/IND message to host
1172 *
1173 *PARAMS:
1174 *
1175 *LOGIC:
1176 *
1177 *ASSUMPTIONS:
1178 * NA
1179 *
1180 *NOTE:
1181 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1182 * or eWNI_SME_DISASSOC_IND to host depending on
1183 * disassociation trigger.
1184 *
1185 * @param peerMacAddr Indicates the peer MAC addr to which
1186 * disassociate was initiated
1187 * @param reasonCode Indicates the reason for Disassociation
1188 * @param disassocTrigger Indicates the trigger for Disassociation
1189 * @param aid Indicates the STAID. This parameter is
1190 * present only on AP.
1191 *
1192 * @return None
1193 */
1194void
1195limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1196 tSirMacAddr peerMacAddr,
1197 tSirResultCodes reasonCode,
1198 tANI_U16 disassocTrigger,
1199 tANI_U16 aid,
1200 tANI_U8 smesessionId,
1201 tANI_U16 smetransactionId,
1202 tpPESession psessionEntry)
1203{
1204
1205 tANI_U8 *pBuf;
1206 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1207 tSirSmeDisassocInd *pSirSmeDisassocInd;
1208 tANI_U32 *pMsg;
1209
1210 switch (disassocTrigger)
1211 {
1212 case eLIM_PEER_ENTITY_DISASSOC:
1213 return;
1214
1215 case eLIM_HOST_DISASSOC:
1216 /**
1217 * Disassociation response due to
1218 * host triggered disassociation
1219 */
1220
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301221 pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp));
1222 if ( NULL == pSirSmeDisassocRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 {
1224 // Log error
1225 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301226 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001227
1228 return;
1229 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301230 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1231 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1232 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1234 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001235 //sessionId
1236 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1237 *pBuf = smesessionId;
1238 pBuf++;
1239
1240 //transactionId
1241 limCopyU16(pBuf, smetransactionId);
1242 pBuf += sizeof(tANI_U16);
1243
1244 //statusCode
1245 limCopyU32(pBuf, reasonCode);
1246 pBuf += sizeof(tSirResultCodes);
1247
1248 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301249 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 pBuf += sizeof(tSirMacAddr);
1251
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 // Clear Station Stats
1253 //for sta, it is always 1, IBSS is handled at halInitSta
1254
Jeff Johnson295189b2012-06-20 16:38:30 -07001255
1256
1257#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301258
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1260 psessionEntry, (tANI_U16)reasonCode, 0);
1261#endif
1262 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1263 break;
1264
1265 default:
1266 /**
1267 * Disassociation indication due to Disassociation
1268 * frame reception from peer entity or due to
1269 * loss of link with peer entity.
1270 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301271 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1272 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 {
1274 // Log error
1275 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301276 FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001277
1278 return;
1279 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301280 limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_IND with "
1281 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1282 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1284 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1285
1286 /* Update SME session Id and Transaction Id */
1287 pSirSmeDisassocInd->sessionId = smesessionId;
1288 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001289 pSirSmeDisassocInd->reasonCode = reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1291
1292 limCopyU32(pBuf, reasonCode);
1293 pBuf += sizeof(tSirResultCodes);
1294
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301295 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 pBuf += sizeof(tSirMacAddr);
1297
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301298 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300
1301#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1302 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1303 psessionEntry, (tANI_U16)reasonCode, 0);
1304#endif
1305 pMsg = (tANI_U32*) pSirSmeDisassocInd;
Jeff Johnson295189b2012-06-20 16:38:30 -07001306
1307 break;
1308 }
1309
1310 /* Delete the PE session Created */
1311 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1312 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1313 {
1314 peDeleteSession(pMac,psessionEntry);
1315 }
1316
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001317 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001319} /*** end limSendSmeDisassocNtf() ***/
1320
1321
1322/** -----------------------------------------------------------------
1323 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1324
1325 After receiving disassociation frame from peer entity, this
1326 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1327 reason code.
1328
1329 \param pMac - global mac structure
1330 \param pStaDs - station dph hash node
1331 \return none
1332 \sa
1333 ----------------------------------------------------------------- */
1334void
1335limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1336{
1337 tSirMsgQ mmhMsg;
1338 tSirSmeDisassocInd *pSirSmeDisassocInd;
1339
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301340 pSirSmeDisassocInd = vos_mem_malloc(sizeof(tSirSmeDisassocInd));
1341 if ( NULL == pSirSmeDisassocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301343 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DISASSOC_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 return;
1345 }
1346
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1348 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001349
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1351 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1352 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001353 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301354
1355 vos_mem_copy( pSirSmeDisassocInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1356
1357 vos_mem_copy( pSirSmeDisassocInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 pSirSmeDisassocInd->staId = pStaDs->staIndex;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301360
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1362 mmhMsg.bodyptr = pSirSmeDisassocInd;
1363 mmhMsg.bodyval = 0;
1364
Jeff Johnsone7245742012-09-05 17:12:55 -07001365 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001366#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1367 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1368#endif //FEATURE_WLAN_DIAG_SUPPORT
1369
1370 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1371
1372} /*** end limSendSmeDisassocInd() ***/
1373
1374
1375/** -----------------------------------------------------------------
1376 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1377
1378 After receiving deauthentication frame from peer entity, this
1379 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1380 reason code.
1381
1382 \param pMac - global mac structure
1383 \param pStaDs - station dph hash node
1384 \return none
1385 \sa
1386 ----------------------------------------------------------------- */
1387void
1388limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1389{
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 tSirMsgQ mmhMsg;
1391 tSirSmeDeauthInd *pSirSmeDeauthInd;
1392
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301393 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1394 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301396 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_DEAUTH_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 return;
1398 }
1399
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1401 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Jeff Johnson295189b2012-06-20 16:38:30 -07001402
Jeff Johnson295189b2012-06-20 16:38:30 -07001403 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1404 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1405 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1406 {
1407 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1408 }
1409 else
1410 {
1411 //Need to indicatet he reascon code over the air
1412 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1413 }
1414 //BSSID
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301415 vos_mem_copy( pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301417 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001418 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 pSirSmeDeauthInd->staId = pStaDs->staIndex;
Jeff Johnson295189b2012-06-20 16:38:30 -07001422
1423 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1424 mmhMsg.bodyptr = pSirSmeDeauthInd;
1425 mmhMsg.bodyval = 0;
1426
Jeff Johnsone7245742012-09-05 17:12:55 -07001427 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001428#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1429 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1430#endif //FEATURE_WLAN_DIAG_SUPPORT
1431
1432 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1433 return;
1434} /*** end limSendSmeDeauthInd() ***/
1435
Hoonki Leee6bfe942013-02-05 15:01:19 -08001436#ifdef FEATURE_WLAN_TDLS
1437/**
1438 * limSendSmeTDLSDelStaInd()
1439 *
1440 *FUNCTION:
1441 * This function is called to send the TDLS STA context deletion to SME.
1442 *
1443 *LOGIC:
1444 *
1445 *ASSUMPTIONS:
1446 *
1447 *NOTE:
1448 * NA
1449 *
1450 * @param pMac - Pointer to global MAC structure
1451 * @param pStaDs - Pointer to internal STA Datastructure
1452 * @param psessionEntry - Pointer to the session entry
1453 * @param reasonCode - Reason for TDLS sta deletion
1454 * @return None
1455 */
1456void
1457limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1458{
1459 tSirMsgQ mmhMsg;
1460 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1461
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301462 pSirTdlsDelStaInd = vos_mem_malloc(sizeof(tSirTdlsDelStaInd));
1463 if ( NULL == pSirTdlsDelStaInd )
Hoonki Leee6bfe942013-02-05 15:01:19 -08001464 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301465 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND "));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001466 return;
1467 }
1468
1469 //messageType
1470 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1471 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1472
1473 //sessionId
1474 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1475
1476 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301477 vos_mem_copy( pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
Hoonki Leee6bfe942013-02-05 15:01:19 -08001478
1479 //staId
1480 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1481
1482 //reasonCode
1483 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1484
1485 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1486 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1487 mmhMsg.bodyval = 0;
1488
1489
1490 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1491 return;
1492}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001493
1494/**
1495 * limSendSmeTDLSDeleteAllPeerInd()
1496 *
1497 *FUNCTION:
1498 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1499 * message to SME.
1500 *
1501 *LOGIC:
1502 *
1503 *ASSUMPTIONS:
1504 *
1505 *NOTE:
1506 * NA
1507 *
1508 * @param pMac - Pointer to global MAC structure
1509 * @param psessionEntry - Pointer to the session entry
1510 * @return None
1511 */
1512void
1513limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1514{
1515 tSirMsgQ mmhMsg;
1516 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1517
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301518 pSirTdlsDelAllPeerInd = vos_mem_malloc(sizeof(tSirTdlsDelAllPeerInd));
1519 if ( NULL == pSirTdlsDelAllPeerInd )
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001520 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301521 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001522 return;
1523 }
1524
1525 //messageType
1526 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1527 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1528
1529 //sessionId
1530 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1531
1532 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1533 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1534 mmhMsg.bodyval = 0;
1535
1536
1537 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1538 return;
1539}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001540
1541/**
1542 * limSendSmeMgmtTXCompletion()
1543 *
1544 *FUNCTION:
1545 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1546 * message to SME.
1547 *
1548 *LOGIC:
1549 *
1550 *ASSUMPTIONS:
1551 *
1552 *NOTE:
1553 * NA
1554 *
1555 * @param pMac - Pointer to global MAC structure
1556 * @param psessionEntry - Pointer to the session entry
1557 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1558 * @return None
1559 */
1560void
1561limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
1562 tpPESession psessionEntry,
1563 tANI_U32 txCompleteStatus)
1564{
1565 tSirMsgQ mmhMsg;
1566 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1567
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301568 pSirMgmtTxCompletionInd = vos_mem_malloc(sizeof(tSirMgmtTxCompletionInd));
1569 if ( NULL == pSirMgmtTxCompletionInd )
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001570 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301571 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001572 return;
1573 }
1574
1575 //messageType
1576 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1577 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1578
1579 //sessionId
1580 pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
1581
1582 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1583
1584 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1585 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1586 mmhMsg.bodyval = 0;
1587
1588
1589 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1590 return;
1591}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001592#endif
1593
Jeff Johnson295189b2012-06-20 16:38:30 -07001594
1595/**
1596 * limSendSmeDeauthNtf()
1597 *
1598 *FUNCTION:
1599 * This function is called by limProcessSmeMessages() to send
1600 * eWNI_SME_DISASSOC_RSP/IND message to host
1601 *
1602 *PARAMS:
1603 *
1604 *LOGIC:
1605 *
1606 *ASSUMPTIONS:
1607 * NA
1608 *
1609 *NOTE:
1610 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1611 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1612 *
1613 * @param peerMacAddr Indicates the peer MAC addr to which
1614 * deauthentication was initiated
1615 * @param reasonCode Indicates the reason for Deauthetication
1616 * @param deauthTrigger Indicates the trigger for Deauthetication
1617 * @param aid Indicates the STAID. This parameter is present
1618 * only on AP.
1619 *
1620 * @return None
1621 */
1622void
1623limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1624 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1625{
1626 tANI_U8 *pBuf;
1627 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1628 tSirSmeDeauthInd *pSirSmeDeauthInd;
1629 tpPESession psessionEntry;
1630 tANI_U8 sessionId;
1631 tANI_U32 *pMsg;
1632
1633 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1634 switch (deauthTrigger)
1635 {
1636 case eLIM_PEER_ENTITY_DEAUTH:
1637 return;
1638
1639 case eLIM_HOST_DEAUTH:
1640 /**
1641 * Deauthentication response to host triggered
1642 * deauthentication.
1643 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301644 pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp));
1645 if ( NULL == pSirSmeDeauthRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 {
1647 // Log error
1648 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301649 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001650
1651 return;
1652 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301653 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with "
1654 "retCode: %d for"MAC_ADDRESS_STR),reasonCode,
1655 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1657 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 pSirSmeDeauthRsp->statusCode = reasonCode;
1659 pSirSmeDeauthRsp->sessionId = smesessionId;
1660 pSirSmeDeauthRsp->transactionId = smetransactionId;
1661
1662 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301663 vos_mem_copy( pBuf, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001664
Jeff Johnson295189b2012-06-20 16:38:30 -07001665#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1666 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1667 psessionEntry, 0, (tANI_U16)reasonCode);
1668#endif
1669 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1670
1671 break;
1672
1673 default:
1674 /**
1675 * Deauthentication indication due to Deauthentication
1676 * frame reception from peer entity or due to
1677 * loss of link with peer entity.
1678 */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301679 pSirSmeDeauthInd = vos_mem_malloc(sizeof(tSirSmeDeauthInd));
1680 if ( NULL == pSirSmeDeauthInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 {
1682 // Log error
1683 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301684 FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001685
1686 return;
1687 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05301688 limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_IND with "
1689 "retCode: %d for "MAC_ADDRESS_STR),reasonCode,
1690 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1692 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001693 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Jeff Johnson295189b2012-06-20 16:38:30 -07001694
1695 // sessionId
1696 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1697 *pBuf++ = smesessionId;
1698
1699 //transaction ID
1700 limCopyU16(pBuf, smetransactionId);
1701 pBuf += sizeof(tANI_U16);
1702
1703 // status code
1704 limCopyU32(pBuf, reasonCode);
1705 pBuf += sizeof(tSirResultCodes);
1706
1707 //bssId
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301708 vos_mem_copy( pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001709 pBuf += sizeof(tSirMacAddr);
1710
1711 //peerMacAddr
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301712 vos_mem_copy( pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001713
Jeff Johnson295189b2012-06-20 16:38:30 -07001714#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1715 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1716 psessionEntry, 0, (tANI_U16)reasonCode);
1717#endif //FEATURE_WLAN_DIAG_SUPPORT
1718 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1719
1720 break;
1721 }
1722
1723 /*Delete the PE session created */
1724 if(psessionEntry != NULL)
1725 {
1726 peDeleteSession(pMac,psessionEntry);
1727 }
1728
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001729 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1730 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001731
Jeff Johnson295189b2012-06-20 16:38:30 -07001732} /*** end limSendSmeDeauthNtf() ***/
1733
1734
1735/**
1736 * limSendSmeWmStatusChangeNtf()
1737 *
1738 *FUNCTION:
1739 * This function is called by limProcessSmeMessages() to send
1740 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1741 *
1742 *PARAMS:
1743 *
1744 *LOGIC:
1745 *
1746 *ASSUMPTIONS:
1747 * NA
1748 *
1749 *NOTE:
1750 *
1751 * @param statusChangeCode Indicates the change in the wireless medium.
1752 * @param statusChangeInfo Indicates the information associated with
1753 * change in the wireless medium.
1754 * @param infoLen Indicates the length of status change information
1755 * being sent.
1756 *
1757 * @return None
1758 */
1759void
1760limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1761 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1762{
1763 tSirMsgQ mmhMsg;
1764 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301765 pSirSmeWmStatusChangeNtf = vos_mem_malloc(sizeof(tSirSmeWmStatusChangeNtf));
1766 if ( NULL == pSirSmeWmStatusChangeNtf )
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 {
1768 limLog(pMac, LOGE,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301769 FL("call to AllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 return;
1771 }
1772
Jeff Johnson295189b2012-06-20 16:38:30 -07001773
1774 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1775 mmhMsg.bodyval = 0;
1776 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1777
1778 switch(statusChangeCode)
1779 {
1780 case eSIR_SME_RADAR_DETECTED:
1781
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 break;
1783
1784 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
Jeff Johnson295189b2012-06-20 16:38:30 -07001785 break;
1786
1787 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1788 limPackBkgndScanFailNotify(pMac,
1789 statusChangeCode,
1790 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1791 pSirSmeWmStatusChangeNtf, sessionId);
1792 break;
1793
1794 default:
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1796 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1797 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1798 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1800 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301801 vos_mem_copy( (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo,
1802 (tANI_U8 *)pStatusChangeInfo, infoLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 }
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001804 limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 statusChangeCode, infoLen);
1806 break;
1807 }
1808
1809
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001810 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1812 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301813 vos_mem_free(pSirSmeWmStatusChangeNtf);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001814 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 }
1816
1817} /*** end limSendSmeWmStatusChangeNtf() ***/
1818
1819
1820/**
1821 * limSendSmeSetContextRsp()
1822 *
1823 *FUNCTION:
1824 * This function is called by limProcessSmeMessages() to send
1825 * eWNI_SME_SETCONTEXT_RSP message to host
1826 *
1827 *PARAMS:
1828 *
1829 *LOGIC:
1830 *
1831 *ASSUMPTIONS:
1832 * NA
1833 *
1834 *NOTE:
1835 *
1836 * @param pMac Pointer to Global MAC structure
1837 * @param peerMacAddr Indicates the peer MAC addr to which
1838 * setContext was performed
1839 * @param aid Indicates the aid corresponding to the peer MAC
1840 * address
1841 * @param resultCode Indicates the result of previously issued
1842 * eWNI_SME_SETCONTEXT_RSP message
1843 *
1844 * @return None
1845 */
1846void
1847limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1848 tSirMacAddr peerMacAddr, tANI_U16 aid,
1849 tSirResultCodes resultCode,
1850 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1851{
1852
1853 tANI_U8 *pBuf;
1854 tSirMsgQ mmhMsg;
1855 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1856
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301857 pSirSmeSetContextRsp = vos_mem_malloc(sizeof(tSirSmeSetContextRsp));
1858 if ( NULL == pSirSmeSetContextRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 {
1860 // Log error
1861 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301862 FL("call to AllocateMemory failed for SmeSetContextRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001863
1864 return;
1865 }
1866
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1868 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 pSirSmeSetContextRsp->statusCode = resultCode;
1870
1871 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1872
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301873 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 pBuf += sizeof(tSirMacAddr);
1875
Jeff Johnson295189b2012-06-20 16:38:30 -07001876
1877 /* Update SME session and transaction Id*/
1878 pSirSmeSetContextRsp->sessionId = smesessionId;
1879 pSirSmeSetContextRsp->transactionId = smetransactionId;
1880
1881 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1882 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1883 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08001884 if(NULL == psessionEntry)
1885 {
1886 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
1887 }
1888 else
1889 {
1890 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1891 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001892
1893#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1894 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1895#endif //FEATURE_WLAN_DIAG_SUPPORT
1896
1897 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1898} /*** end limSendSmeSetContextRsp() ***/
1899
1900/**
1901 * limSendSmeRemoveKeyRsp()
1902 *
1903 *FUNCTION:
1904 * This function is called by limProcessSmeMessages() to send
1905 * eWNI_SME_REMOVEKEY_RSP message to host
1906 *
1907 *PARAMS:
1908 *
1909 *LOGIC:
1910 *
1911 *ASSUMPTIONS:
1912 * NA
1913 *
1914 *NOTE:
1915 *
1916 * @param pMac Pointer to Global MAC structure
1917 * @param peerMacAddr Indicates the peer MAC addr to which
1918 * Removekey was performed
1919 * @param aid Indicates the aid corresponding to the peer MAC
1920 * address
1921 * @param resultCode Indicates the result of previously issued
1922 * eWNI_SME_REMOVEKEY_RSP message
1923 *
1924 * @return None
1925 */
1926void
1927limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1928 tSirMacAddr peerMacAddr,
1929 tSirResultCodes resultCode,
1930 tpPESession psessionEntry,tANI_U8 smesessionId,
1931 tANI_U16 smetransactionId)
1932{
1933 tANI_U8 *pBuf;
1934 tSirMsgQ mmhMsg;
1935 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
1936
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301937 pSirSmeRemoveKeyRsp = vos_mem_malloc(sizeof(tSirSmeRemoveKeyRsp));
1938 if ( NULL == pSirSmeRemoveKeyRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 {
1940 // Log error
1941 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301942 FL("call to AllocateMemory failed for SmeRemoveKeyRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001943
1944 return;
1945 }
1946
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
1948
1949 if(psessionEntry != NULL)
1950 {
1951 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301952 vos_mem_copy( pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 }
1954
1955 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
1956 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
1957 pSirSmeRemoveKeyRsp->statusCode = resultCode;
1958
1959 /* Update SME session and transaction Id*/
1960 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
1961 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
1962
1963 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
1964 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
1965 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08001966 if(NULL == psessionEntry)
1967 {
1968 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
1969 }
1970 else
1971 {
1972 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
1973 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1975} /*** end limSendSmeSetContextRsp() ***/
1976
1977
1978/**
1979 * limSendSmePromiscuousModeRsp()
1980 *
1981 *FUNCTION:
1982 * This function is called by limProcessSmeMessages() to send
1983 * eWNI_PROMISCUOUS_MODE_RSP message to host
1984 *
1985 *PARAMS:
1986 *
1987 *LOGIC:
1988 *
1989 *ASSUMPTIONS:
1990 * NA
1991 *
1992 *NOTE:
1993 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
1994 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
1995 *
1996 * @param None
1997 * @return None
1998 */
1999void
2000limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2001{
2002#if 0
2003 tSirMsgQ mmhMsg;
2004 tSirMbMsg *pMbMsg;
2005
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302006 pMbMsg = vos_mem_malloc(sizeof(tSirMbMsg));
2007 if ( NULL == pMbMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 {
2009 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302010 limLog(pMac, LOGP, FL("call to AllocateMemory failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002011
2012 return;
2013 }
2014
2015 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2016 pMbMsg->msgLen = 4;
2017
2018 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2019 mmhMsg.bodyptr = pMbMsg;
2020 mmhMsg.bodyval = 0;
2021 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2022 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2023#endif
2024} /*** end limSendSmePromiscuousModeRsp() ***/
2025
2026
2027
2028/**
2029 * limSendSmeNeighborBssInd()
2030 *
2031 *FUNCTION:
2032 * This function is called by limLookupNaddHashEntry() to send
2033 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2034 *
2035 *PARAMS:
2036 *
2037 *LOGIC:
2038 *
2039 *ASSUMPTIONS:
2040 * NA
2041 *
2042 *NOTE:
2043 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2044 * host upon detecting new BSS during background scanning if CFG
2045 * option is enabled for sending such indication
2046 *
2047 * @param pMac - Pointer to Global MAC structure
2048 * @return None
2049 */
2050
2051void
2052limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2053 tLimScanResultNode *pBssDescr)
2054{
2055 tSirMsgQ msgQ;
2056 tANI_U32 val;
2057 tSirSmeNeighborBssInd *pNewBssInd;
2058
2059 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2060 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2061 pMac->lim.gLimRspReqd))
2062 {
2063 // LIM is not in background scan state OR
2064 // current scan is initiated by HDD.
2065 // No need to send new BSS indication to HDD
2066 return;
2067 }
2068
2069 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2070 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002071 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002072
2073 return;
2074 }
2075
2076 if (val == 0)
2077 return;
2078
2079 /**
2080 * Need to indicate new BSSs found during
2081 * background scanning to host.
2082 * Allocate buffer for sending indication.
2083 * Length of buffer is length of BSS description
2084 * and length of header itself
2085 */
2086 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302087 pNewBssInd = vos_mem_malloc(val);
2088 if ( NULL == pNewBssInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 {
2090 // Log error
2091 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302092 FL("call to AllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002093
2094 return;
2095 }
2096
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2098 pNewBssInd->length = (tANI_U16) val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 pNewBssInd->sessionId = 0;
2100
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302101 vos_mem_copy( (tANI_U8 *) pNewBssInd->bssDescription,
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 (tANI_U8 *) &pBssDescr->bssDescription,
2103 pBssDescr->bssDescription.length + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07002104
2105 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2106 msgQ.bodyptr = pNewBssInd;
2107 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002108 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2110} /*** end limSendSmeNeighborBssInd() ***/
2111
2112/** -----------------------------------------------------------------
2113 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2114 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2115 \ SME only looks at rc and tspec field.
2116 \param pMac - global mac structure
2117 \param rspReqd - is SmeAddTsRsp required
2118 \param status - status code of SME_ADD_TS_RSP
2119 \return tspec
2120 \sa
2121 ----------------------------------------------------------------- */
2122void
2123limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2124 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2125{
2126 tpSirAddtsRsp rsp;
2127 tSirMsgQ mmhMsg;
2128
2129 if (! rspReqd)
2130 return;
2131
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302132 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2133 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302135 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 return;
2137 }
2138
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302139 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 rsp->messageType = eWNI_SME_ADDTS_RSP;
2141 rsp->rc = status;
2142 rsp->rsp.status = (enum eSirMacStatusCodes) status;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302143 //vos_mem_copy( (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 rsp->rsp.tspec = tspec;
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 /* Update SME session Id and transcation Id */
2146 rsp->sessionId = smesessionId;
2147 rsp->transactionId = smetransactionId;
2148
2149 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2150 mmhMsg.bodyptr = rsp;
2151 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002152 if(NULL == psessionEntry)
2153 {
2154 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2155 }
2156 else
2157 {
2158 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2159 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002160#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2161 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2162#endif //FEATURE_WLAN_DIAG_SUPPORT
2163
2164 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2165 return;
2166}
2167
2168void
2169limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2170{
2171 tpSirAddtsRsp rsp;
2172 tSirMsgQ mmhMsg;
2173
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002174 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 addts->dialogToken,
2176 addts->tspec.tsinfo.traffic.tsid,
2177 addts->tspec.tsinfo.traffic.userPrio);
2178
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302179 rsp = vos_mem_malloc(sizeof(tSirAddtsRsp));
2180 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 {
2182 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302183 limLog(pMac, LOGP, FL("AllocateMemory failed for ADDTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 return;
2185 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302186 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002187
2188 rsp->messageType = eWNI_SME_ADDTS_IND;
2189
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302190 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002191
2192 mmhMsg.type = eWNI_SME_ADDTS_IND;
2193 mmhMsg.bodyptr = rsp;
2194 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002195 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2197}
2198
2199void
2200limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2201{
2202 tpSirDeltsRsp rsp;
2203 tSirMsgQ mmhMsg;
2204
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002205 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 delts->aid,
2207 delts->req.tsinfo.traffic.tsid,
2208 delts->req.tsinfo.traffic.userPrio,
2209 status);
2210 if (! delts->rspReqd)
2211 return;
2212
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302213 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2214 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 {
2216 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302217 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 return;
2219 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302220 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002221
2222 if(psessionEntry != NULL)
2223 {
2224
2225 rsp->aid = delts->aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302226 vos_mem_copy( (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2227 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 }
2229
2230
2231 rsp->messageType = eWNI_SME_DELTS_RSP;
2232 rsp->rc = status;
2233
2234 /* Update SME session Id and transcation Id */
2235 rsp->sessionId = smesessionId;
2236 rsp->transactionId = smetransactionId;
2237
2238 mmhMsg.type = eWNI_SME_DELTS_RSP;
2239 mmhMsg.bodyptr = rsp;
2240 mmhMsg.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08002241 if(NULL == psessionEntry)
2242 {
2243 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
2244 }
2245 else
2246 {
2247 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
2248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002249#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2250 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2251#endif //FEATURE_WLAN_DIAG_SUPPORT
2252
2253 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2254}
2255
2256void
2257limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2258{
2259 tpSirDeltsRsp rsp;
2260 tSirMsgQ mmhMsg;
2261
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002262 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 aid,
2264 delts->tsinfo.traffic.tsid,
2265 delts->tsinfo.traffic.userPrio);
2266
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302267 rsp = vos_mem_malloc(sizeof(tSirDeltsRsp));
2268 if ( NULL == rsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 {
2270 // Log error
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302271 limLog(pMac, LOGP, FL("AllocateMemory failed for DELTS_IND"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 return;
2273 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302274 vos_mem_set( (tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002275
2276 rsp->messageType = eWNI_SME_DELTS_IND;
2277 rsp->rc = eSIR_SUCCESS;
2278 rsp->aid = aid;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302279 vos_mem_copy( (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
Jeff Johnson295189b2012-06-20 16:38:30 -07002280
2281 /* Update SME session Id and SME transaction Id */
2282
2283 rsp->sessionId = psessionEntry->smeSessionId;
2284 rsp->transactionId = psessionEntry->transactionId;
2285
2286 mmhMsg.type = eWNI_SME_DELTS_IND;
2287 mmhMsg.bodyptr = rsp;
2288 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002289 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002290#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2291 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2292#endif //FEATURE_WLAN_DIAG_SUPPORT
2293
2294 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2295}
2296
2297/**
2298 * limSendSmeStatsRsp()
2299 *
2300 *FUNCTION:
2301 * This function is called to send 802.11 statistics response to HDD.
2302 * This function posts the result back to HDD. This is a response to
2303 * HDD's request for statistics.
2304 *
2305 *PARAMS:
2306 *
2307 *LOGIC:
2308 *
2309 *ASSUMPTIONS:
2310 * NA
2311 *
2312 *NOTE:
2313 * NA
2314 *
2315 * @param pMac Pointer to Global MAC structure
2316 * @param p80211Stats Statistics sent in response
2317 * @param resultCode TODO:
2318 *
2319 *
2320 * @return none
2321 */
2322
2323void
2324limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2325{
2326 tSirMsgQ mmhMsg;
2327 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2328
2329 switch(msgType)
2330 {
2331 case WDA_STA_STAT_RSP:
2332 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2333 break;
2334 case WDA_AGGR_STAT_RSP:
2335 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2336 break;
2337 case WDA_GLOBAL_STAT_RSP:
2338 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2339 break;
2340 case WDA_STAT_SUMM_RSP:
2341 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2342 break;
2343 default:
2344 mmhMsg.type = msgType; //Response from within PE
2345 break;
2346 }
2347
2348 pMsgHdr->messageType = mmhMsg.type;
2349
2350 mmhMsg.bodyptr = stats;
2351 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002352 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2354
2355 return;
2356
2357} /*** end limSendSmeStatsRsp() ***/
2358
2359/**
2360 * limSendSmePEStatisticsRsp()
2361 *
2362 *FUNCTION:
2363 * This function is called to send 802.11 statistics response to HDD.
2364 * This function posts the result back to HDD. This is a response to
2365 * HDD's request for statistics.
2366 *
2367 *PARAMS:
2368 *
2369 *LOGIC:
2370 *
2371 *ASSUMPTIONS:
2372 * NA
2373 *
2374 *NOTE:
2375 * NA
2376 *
2377 * @param pMac Pointer to Global MAC structure
2378 * @param p80211Stats Statistics sent in response
2379 * @param resultCode TODO:
2380 *
2381 *
2382 * @return none
2383 */
2384
2385void
2386limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2387{
2388 tSirMsgQ mmhMsg;
2389 tANI_U8 sessionId;
2390 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2391 tpPESession pPeSessionEntry;
2392
2393 //Get the Session Id based on Sta Id
2394 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2395
2396 //Fill the Session Id
2397 if(NULL != pPeSessionEntry)
2398 {
2399 //Fill the Session Id
2400 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2401 }
2402
2403 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2404
2405
2406 //msgType should be WDA_GET_STATISTICS_RSP
2407 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2408
2409 mmhMsg.bodyptr = stats;
2410 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002411 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2413
2414 return;
2415
2416} /*** end limSendSmePEStatisticsRsp() ***/
2417
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002418#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002419/**
2420 * limSendSmePEGetRoamRssiRsp()
2421 *
2422 *FUNCTION:
2423 * This function is called to send roam rssi response to HDD.
2424 * This function posts the result back to HDD. This is a response to
2425 * HDD's request to get roam rssi.
2426 *
2427 *PARAMS:
2428 *
2429 *LOGIC:
2430 *
2431 *ASSUMPTIONS:
2432 * NA
2433 *
2434 *NOTE:
2435 * NA
2436 *
2437 * @param pMac Pointer to Global MAC structure
2438 * @param p80211Stats Statistics sent in response
2439 * @param resultCode TODO:
2440 *
2441 *
2442 * @return none
2443 */
2444
2445void
2446limSendSmePEGetRoamRssiRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2447{
2448 tSirMsgQ mmhMsg;
2449 tANI_U8 sessionId;
2450 tAniGetRoamRssiRsp *pPeStats = (tAniGetRoamRssiRsp *) stats;
2451 tpPESession pPeSessionEntry = NULL;
2452
2453 //Get the Session Id based on Sta Id
2454 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2455
2456 //Fill the Session Id
2457 if(NULL != pPeSessionEntry)
2458 {
2459 //Fill the Session Id
2460 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2461 }
2462
2463 pPeStats->msgType = eWNI_SME_GET_ROAM_RSSI_RSP;
2464
2465 //msgType should be WDA_GET_STATISTICS_RSP
2466 mmhMsg.type = eWNI_SME_GET_ROAM_RSSI_RSP;
2467
2468 mmhMsg.bodyptr = stats;
2469 mmhMsg.bodyval = 0;
2470 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2471 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2472
2473 return;
2474
2475} /*** end limSendSmePEGetRoamRssiRsp() ***/
2476
2477#endif
2478
Jeff Johnson295189b2012-06-20 16:38:30 -07002479
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002480#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002481/**
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002482 * limSendSmePEEseTsmRsp()
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002483 *
2484 *FUNCTION:
2485 * This function is called to send tsm stats response to HDD.
2486 * This function posts the result back to HDD. This is a response to
2487 * HDD's request to get tsm stats.
2488 *
2489 *PARAMS:
2490 * @param pMac - Pointer to global pMac structure
2491 * @param pStats - Pointer to TSM Stats
2492 *
2493 * @return none
2494 */
2495
2496void
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002497limSendSmePEEseTsmRsp(tpAniSirGlobal pMac, tAniGetTsmStatsRsp *pStats)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002498{
2499 tSirMsgQ mmhMsg;
2500 tANI_U8 sessionId;
2501 tAniGetTsmStatsRsp *pPeStats = (tAniGetTsmStatsRsp *) pStats;
2502 tpPESession pPeSessionEntry = NULL;
2503
2504 //Get the Session Id based on Sta Id
2505 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2506
2507 //Fill the Session Id
2508 if(NULL != pPeSessionEntry)
2509 {
2510 //Fill the Session Id
2511 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2512 }
2513 else
2514 {
2515 PELOGE(limLog(pMac, LOGE, FL("Session not found for the Sta id(%d)"),
2516 pPeStats->staId);)
2517 return;
2518 }
2519
2520 pPeStats->msgType = eWNI_SME_GET_TSM_STATS_RSP;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002521 pPeStats->tsmMetrics.RoamingCount = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingCount;
2522 pPeStats->tsmMetrics.RoamingDly = pPeSessionEntry->eseContext.tsm.tsmMetrics.RoamingDly;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002523
2524 mmhMsg.type = eWNI_SME_GET_TSM_STATS_RSP;
2525 mmhMsg.bodyptr = pStats;
2526 mmhMsg.bodyval = 0;
2527 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
2528 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2529
2530 return;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002531} /*** end limSendSmePEEseTsmRsp() ***/
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002532
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002533#endif /* FEATURE_WLAN_ESE) && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002534
2535
Jeff Johnson295189b2012-06-20 16:38:30 -07002536void
2537limSendSmeIBSSPeerInd(
2538 tpAniSirGlobal pMac,
2539 tSirMacAddr peerMacAddr,
2540 tANI_U16 staIndex,
2541 tANI_U8 ucastIdx,
2542 tANI_U8 bcastIdx,
2543 tANI_U8 *beacon,
2544 tANI_U16 beaconLen,
2545 tANI_U16 msgType,
2546 tANI_U8 sessionId)
2547{
2548 tSirMsgQ mmhMsg;
2549 tSmeIbssPeerInd *pNewPeerInd;
2550
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302551 pNewPeerInd = vos_mem_malloc(sizeof(tSmeIbssPeerInd) + beaconLen);
2552 if ( NULL == pNewPeerInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 {
2554 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2555 return;
2556 }
2557
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302558 vos_mem_set((void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002559
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302560 vos_mem_copy( (tANI_U8 *) pNewPeerInd->peerAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 peerMacAddr, sizeof(tSirMacAddr));
2562 pNewPeerInd->staId= staIndex;
2563 pNewPeerInd->ucastSig = ucastIdx;
2564 pNewPeerInd->bcastSig = bcastIdx;
2565 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2566 pNewPeerInd->mesgType = msgType;
2567 pNewPeerInd->sessionId = sessionId;
2568
2569 if ( beacon != NULL )
2570 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302571 vos_mem_copy((void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)),
2572 (void*)beacon, beaconLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 }
2574
2575 mmhMsg.type = msgType;
2576// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2577 mmhMsg.bodyptr = pNewPeerInd;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002578 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2580
2581}
2582
2583
2584/** -----------------------------------------------------------------
2585 \brief limSendExitBmpsInd() - sends exit bmps indication
2586
2587 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2588 code to SME. This will trigger SME to get out of BMPS mode.
2589
2590 \param pMac - global mac structure
2591 \param reasonCode - reason for which PE wish to exit BMPS
2592 \return none
2593 \sa
2594 ----------------------------------------------------------------- */
2595void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2596{
2597 tSirMsgQ mmhMsg;
2598 tANI_U16 msgLen = 0;
2599 tpSirSmeExitBmpsInd pExitBmpsInd;
2600
2601 msgLen = sizeof(tSirSmeExitBmpsInd);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302602 pExitBmpsInd = vos_mem_malloc(msgLen);
2603 if ( NULL == pExitBmpsInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302605 limLog(pMac, LOGP, FL("AllocateMemory failed for PMC_EXIT_BMPS_IND "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 return;
2607 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302608 vos_mem_set(pExitBmpsInd, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2611 pExitBmpsInd->mesgLen = msgLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 pExitBmpsInd->exitBmpsReason = reasonCode;
2613 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2614
2615 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2616 mmhMsg.bodyptr = pExitBmpsInd;
2617 mmhMsg.bodyval = 0;
2618
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002619 PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. "));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002620 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002621#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2622 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2623#endif //FEATURE_WLAN_DIAG_SUPPORT
2624
2625 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2626 return;
2627
2628} /*** end limSendExitBmpsInd() ***/
2629
2630
2631
2632
2633/*--------------------------------------------------------------------------
2634 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2635
2636
2637 \param pMac - pointer to global adapter context
2638 \param sessionId - Message pointer.
2639
2640 \sa
2641 --------------------------------------------------------------------------*/
2642
2643void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2644{
2645 tpPESession psessionEntry;
2646 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2647 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002649 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 return;
2651 }
2652 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2653 {
2654 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2655 }
2656 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2657 {
2658 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2659 }
2660
2661 else
2662 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2663
2664}
2665
2666#ifdef WLAN_FEATURE_VOWIFI_11R
2667/** -----------------------------------------------------------------
2668 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2669 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2670 \ SME only looks at rc and tspec field.
2671 \param pMac - global mac structure
2672 \param rspReqd - is SmeAddTsRsp required
2673 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2674 \return tspec
2675 \sa
2676 ----------------------------------------------------------------- */
2677void
2678limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2679 tANI_U8 smesessionId)
2680{
2681 tSirMsgQ mmhMsg;
2682
2683 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2684 mmhMsg.bodyptr = aggrQosRsp;
2685 mmhMsg.bodyval = 0;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302686 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2688
2689 return;
2690}
2691#endif
2692
2693/** -----------------------------------------------------------------
2694 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2695 before switching channels for spectrum manangement.
2696
2697 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2698
2699 \param pMac - global mac structure
2700 \return none
2701 \sa
2702 ----------------------------------------------------------------- */
2703void
2704limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2705{
2706 tSirMsgQ mmhMsg;
2707
2708 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2709 mmhMsg.bodyptr = NULL;
2710 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2713
2714 return;
2715}
2716
2717/** -----------------------------------------------------------------
2718 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2719 after channel switch for spectrum manangement is complete.
2720
2721 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2722
2723 \param pMac - global mac structure
2724 \return none
2725 \sa
2726 ----------------------------------------------------------------- */
2727void
2728limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2729{
2730 tSirMsgQ mmhMsg;
2731
2732 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2733 mmhMsg.bodyptr = NULL;
2734 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002735 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2737
2738 return;
2739}
2740
2741void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2742 tANI_U8 smesessionId)
2743{
2744 tSirMsgQ mmhMsg;
2745 tSmeMaxAssocInd *pSmeMaxAssocInd;
2746
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302747 pSmeMaxAssocInd = vos_mem_malloc(sizeof(tSmeMaxAssocInd));
2748 if ( NULL == pSmeMaxAssocInd )
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 {
2750 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2751 return;
2752 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302753 vos_mem_set((void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd),0);
2754 vos_mem_copy( (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2755 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2757 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2758 pSmeMaxAssocInd->sessionId = smesessionId;
2759 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2760 mmhMsg.bodyptr = pSmeMaxAssocInd;
Arif Hussain24bafea2013-11-15 15:10:03 -08002761 PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr "MAC_ADDRESS_STR
2762 " sme session id %d"), "eWNI_SME_MAX_ASSOC_EXCEEDED", MAC_ADDR_ARRAY(peerMacAddr));)
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002763 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2765
2766 return;
2767}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002768#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2769/** -----------------------------------------------------------------
2770 \brief limSendSmeCandidateFoundInd() - sends
2771 eWNI_SME_CANDIDATE_FOUND_IND
2772
2773 After receiving candidate found indication frame from FW, this
2774 function sends a eWNI_SME_CANDIDATE_FOUND_IND to SME to notify
2775 roam candidate(s) are available.
2776
2777 \param pMac - global mac structure
2778 \param psessionEntry - session info
2779 \return none
2780 \sa
2781 ----------------------------------------------------------------- */
2782void
2783limSendSmeCandidateFoundInd(tpAniSirGlobal pMac, tANI_U8 sessionId)
2784{
2785 tSirMsgQ mmhMsg;
2786 tSirSmeCandidateFoundInd *pSirSmeCandidateFoundInd;
2787
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302788 pSirSmeCandidateFoundInd = vos_mem_malloc(sizeof(tSirSmeCandidateFoundInd));
2789 if ( NULL == pSirSmeCandidateFoundInd )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002790 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302791 limLog(pMac, LOGP, FL("AllocateMemory failed for eWNI_SME_CANDIDATE_FOUND_IND\n"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002792 return;
2793 }
2794
2795 pSirSmeCandidateFoundInd->messageType = eWNI_SME_CANDIDATE_FOUND_IND;
2796 pSirSmeCandidateFoundInd->length = sizeof(tSirSmeDisassocInd);
2797
2798 pSirSmeCandidateFoundInd->sessionId = sessionId;
2799
2800
2801 limLog( pMac, LOGE, FL("posting candidate ind to SME"));
2802 mmhMsg.type = eWNI_SME_CANDIDATE_FOUND_IND;
2803 mmhMsg.bodyptr = pSirSmeCandidateFoundInd;
2804 mmhMsg.bodyval = 0;
2805
2806 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2807
2808} /*** end limSendSmeCandidateFoundInd() ***/
2809#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD