blob: 677c7c49d2a991a460a3ec056f8aa10d211660a6 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limSendSmeRspMessages.cc contains the functions
45 * for sending SME response/notification messages to applications
46 * above MAC software.
47 * Author: Chandra Modumudi
48 * Date: 02/13/02
49 * History:-
50 * Date Modified by Modification Information
51 * --------------------------------------------------------------------
52 */
53
54#include "vos_types.h"
55#include "wniApi.h"
56#include "sirCommon.h"
57#include "aniGlobal.h"
58
59#if (WNI_POLARIS_FW_PRODUCT == AP)
60#include "wniCfgAp.h"
61#else
62#include "wniCfgSta.h"
63#endif
64#include "sysDef.h"
65#include "cfgApi.h"
66
Jeff Johnson295189b2012-06-20 16:38:30 -070067
68#include "schApi.h"
69#include "utilsApi.h"
70#include "limUtils.h"
71#include "limSecurityUtils.h"
72#include "limSerDesUtils.h"
73#include "limSendSmeRspMessages.h"
74#include "limIbssPeerMgmt.h"
75#include "limSessionUtils.h"
76
77
78/**
79 * limSendSmeRsp()
80 *
81 *FUNCTION:
82 * This function is called by limProcessSmeReqMessages() to send
83 * eWNI_SME_START_RSP, eWNI_SME_MEASUREMENT_RSP, eWNI_SME_STOP_BSS_RSP
84 * or eWNI_SME_SWITCH_CHL_RSP messages to applications above MAC
85 * Software.
86 *
87 *PARAMS:
88 *
89 *LOGIC:
90 *
91 *ASSUMPTIONS:
92 * NA
93 *
94 *NOTE:
95 * NA
96 *
97 * @param pMac Pointer to Global MAC structure
98 * @param msgType Indicates message type
99 * @param resultCode Indicates the result of previously issued
100 * eWNI_SME_msgType_REQ message
101 *
102 * @return None
103 */
104
105void
106limSendSmeRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
107 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
108{
109 tSirMsgQ mmhMsg;
110 tSirSmeRsp *pSirSmeRsp;
111
112 PELOG1(limLog(pMac, LOG1,
113 FL("Sending message %s with reasonCode %s\n"),
114 limMsgStr(msgType), limResultCodeStr(resultCode));)
115
116 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, sizeof(tSirSmeRsp)))
117 {
118 /// Buffer not available. Log error
119 limLog(pMac, LOGP,
120 FL("call to palAllocateMemory failed for eWNI_SME_*_RSP\n"));
121
122 return;
123 }
124
125#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
126 sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
127 sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, sizeof(tSirSmeRsp));
128#else
129 pSirSmeRsp->messageType = msgType;
130 pSirSmeRsp->length = sizeof(tSirSmeRsp);
131#endif
132 pSirSmeRsp->statusCode = resultCode;
133
134 /* Update SME session Id and Transaction Id */
135 pSirSmeRsp->sessionId = smesessionId;
136 pSirSmeRsp->transactionId = smetransactionId;
137
138
139 mmhMsg.type = msgType;
140 mmhMsg.bodyptr = pSirSmeRsp;
141 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -0800142 MTRACE(macTraceMsgTx(pMac, smesessionId , mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700143
144#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
145 {
146 tpPESession psessionEntry = peGetValidPowerSaveSession(pMac);
147 switch(msgType)
148 {
149 case eWNI_PMC_ENTER_BMPS_RSP:
150 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
151 break;
152 case eWNI_PMC_EXIT_BMPS_RSP:
153 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
154 break;
155 case eWNI_PMC_ENTER_IMPS_RSP:
156 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
157 break;
158 case eWNI_PMC_EXIT_IMPS_RSP:
159 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
160 break;
161 case eWNI_PMC_ENTER_UAPSD_RSP:
162 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
163 break;
164 case eWNI_PMC_EXIT_UAPSD_RSP:
165 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
166 break;
167 case eWNI_SME_SWITCH_CHL_RSP:
168 limDiagEventReport(pMac, WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
169 break;
170 case eWNI_SME_STOP_BSS_RSP:
171 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
172 break;
173 case eWNI_PMC_ENTER_WOWL_RSP:
174 limDiagEventReport(pMac, WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
175 break;
176 case eWNI_PMC_EXIT_WOWL_RSP:
177 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
178 break;
179 }
180 }
181#endif //FEATURE_WLAN_DIAG_SUPPORT
182
183 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
184} /*** end limSendSmeRsp() ***/
185
186
187/**
188 * limSendSmeJoinReassocRspAfterResume()
189 *
190 *FUNCTION:
191 * This function is called to send Join/Reassoc rsp
192 * message to SME after the resume link.
193 *
194 *PARAMS:
195 *
196 *LOGIC:
197 *
198 *ASSUMPTIONS:
199 * NA
200 *
201 *NOTE:
202 * NA
203 *
204 * @param pMac Pointer to Global MAC structure
205 * @param status Resume link status
206 * @param ctx context passed while calling resmune link.
207 * (join response to be sent)
208 *
209 * @return None
210 */
211static void limSendSmeJoinReassocRspAfterResume( tpAniSirGlobal pMac,
212 eHalStatus status, tANI_U32 *ctx)
213{
214 tSirMsgQ mmhMsg;
215 tpSirSmeJoinRsp pSirSmeJoinRsp = (tpSirSmeJoinRsp) ctx;
216
217 mmhMsg.type = pSirSmeJoinRsp->messageType;
218 mmhMsg.bodyptr = pSirSmeJoinRsp;
219 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700220 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700221 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
222}
223
224
225/**
226 * limSendSmeJoinReassocRsp()
227 *
228 *FUNCTION:
229 * This function is called by limProcessSmeReqMessages() to send
230 * eWNI_SME_JOIN_RSP or eWNI_SME_REASSOC_RSP messages to applications
231 * above MAC Software.
232 *
233 *PARAMS:
234 *
235 *LOGIC:
236 *
237 *ASSUMPTIONS:
238 * NA
239 *
240 *NOTE:
241 * NA
242 *
243 * @param pMac Pointer to Global MAC structure
244 * @param msgType Indicates message type
245 * @param resultCode Indicates the result of previously issued
246 * eWNI_SME_msgType_REQ message
247 *
248 * @return None
249 */
250
251void
252limSendSmeJoinReassocRsp(tpAniSirGlobal pMac, tANI_U16 msgType,
253 tSirResultCodes resultCode, tANI_U16 protStatusCode,
254 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
255{
256 tpSirSmeJoinRsp pSirSmeJoinRsp;
257 tANI_U32 rspLen;
258 tpDphHashNode pStaDs = NULL;
259
260#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
261 if (msgType == eWNI_SME_REASSOC_RSP)
262 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
263 else
264 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
265#endif //FEATURE_WLAN_DIAG_SUPPORT
266
267 PELOG1(limLog(pMac, LOG1,
268 FL("Sending message %s with reasonCode %s\n"),
269 limMsgStr(msgType), limResultCodeStr(resultCode));)
270
271 if(psessionEntry == NULL)
272 {
273
274 rspLen = sizeof(tSirSmeJoinRsp);
275
276 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeJoinRsp, rspLen))
277 {
278 /// Buffer not available. Log error
279 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
280 return;
281 }
282
283 palZeroMemory(pMac, (tANI_U8*)pSirSmeJoinRsp, rspLen);
284
285
286 pSirSmeJoinRsp->beaconLength = 0;
287 pSirSmeJoinRsp->assocReqLength = 0;
288 pSirSmeJoinRsp->assocRspLength = 0;
289 }
290
291 else
292 {
293 rspLen = psessionEntry->assocReqLen + psessionEntry->assocRspLen +
294 psessionEntry->bcnLen +
295#ifdef WLAN_FEATURE_VOWIFI_11R
296 psessionEntry->RICDataLen +
297#endif
298#ifdef FEATURE_WLAN_CCX
299 psessionEntry->tspecLen +
300#endif
301 sizeof(tSirSmeJoinRsp) - sizeof(tANI_U8) ;
302
303 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeJoinRsp, rspLen))
304 {
305 /// Buffer not available. Log error
306 limLog(pMac, LOGP,
307 FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
308
309 return;
310 }
311
312 palZeroMemory(pMac, (tANI_U8*)pSirSmeJoinRsp, rspLen);
313
314#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
315 sirStoreU16N((tANI_U8*)&pSirSmeJoinRsp->messageType, msgType);
316 sirStoreU16N((tANI_U8*)&pSirSmeJoinRsp->length, rspLen);
317#endif
318
319#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
320 if (resultCode == eSIR_SME_SUCCESS)
321 {
322 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
323 if (pStaDs == NULL)
324 {
325 PELOGE(limLog(pMac, LOGE, FL("could not Get Self Entry for the station\n"));)
326 }
327 else
328 {
329 //Pass the peer's staId
330 pSirSmeJoinRsp->staId = pStaDs->staIndex;
331 pSirSmeJoinRsp->ucastSig = pStaDs->ucUcastSig;
332 pSirSmeJoinRsp->bcastSig = pStaDs->ucBcastSig;
333 }
334 }
335#endif
336
337#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
338 if (resultCode == eSIR_SME_TRANSFER_STA)
339 {
340 palCopyMemory( pMac->hHdd, pSirSmeJoinRsp->alternateBssId,
341 pMac->lim.gLimAlternateRadio.bssId,
342 sizeof(tSirMacAddr));
343 pSirSmeJoinRsp->alternateChannelId =
344 pMac->lim.gLimAlternateRadio.channelId;
345 }
346#endif
347
348 pSirSmeJoinRsp->beaconLength = 0;
349 pSirSmeJoinRsp->assocReqLength = 0;
350 pSirSmeJoinRsp->assocRspLength = 0;
351#ifdef WLAN_FEATURE_VOWIFI_11R
352 pSirSmeJoinRsp->parsedRicRspLen = 0;
353#endif
354#ifdef FEATURE_WLAN_CCX
355 pSirSmeJoinRsp->tspecIeLen = 0;
356#endif
357
358 if(resultCode == eSIR_SME_SUCCESS)
359 {
360
361 if(psessionEntry->beacon != NULL)
362 {
363 pSirSmeJoinRsp->beaconLength = psessionEntry->bcnLen;
364 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames, psessionEntry->beacon, pSirSmeJoinRsp->beaconLength);
365 palFreeMemory(pMac->hHdd, psessionEntry->beacon);
366 psessionEntry->beacon = NULL;
367#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
368 PELOG1(limLog(pMac, LOG1, FL("Beacon=%d\n"), psessionEntry->bcnLen);)
369#endif
370 }
371
372 if(psessionEntry->assocReq != NULL)
373 {
374 pSirSmeJoinRsp->assocReqLength = psessionEntry->assocReqLen;
375 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen, psessionEntry->assocReq, pSirSmeJoinRsp->assocReqLength);
376 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
377 psessionEntry->assocReq = NULL;
378#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
379 PELOG1(limLog(pMac, LOG1, FL("AssocReq=%d\n"), psessionEntry->assocReqLen);)
380#endif
381 }
382 if(psessionEntry->assocRsp != NULL)
383 {
384 pSirSmeJoinRsp->assocRspLength = psessionEntry->assocRspLen;
385 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen, psessionEntry->assocRsp, pSirSmeJoinRsp->assocRspLength);
386 palFreeMemory(pMac->hHdd, psessionEntry->assocRsp);
387 psessionEntry->assocRsp = NULL;
388 }
389#ifdef WLAN_FEATURE_VOWIFI_11R
390 if(psessionEntry->ricData != NULL)
391 {
392 pSirSmeJoinRsp->parsedRicRspLen = psessionEntry->RICDataLen;
393 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen, psessionEntry->ricData, pSirSmeJoinRsp->parsedRicRspLen);
394 palFreeMemory(pMac->hHdd, psessionEntry->ricData);
395 psessionEntry->ricData = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -0700396 PELOG1(limLog(pMac, LOG1, FL("RicLength=%d\n"), pSirSmeJoinRsp->parsedRicRspLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 }
398#endif
399#ifdef FEATURE_WLAN_CCX
400 if(psessionEntry->tspecIes != NULL)
401 {
402 pSirSmeJoinRsp->tspecIeLen = psessionEntry->tspecLen;
403 palCopyMemory(pMac->hHdd, pSirSmeJoinRsp->frames + psessionEntry->bcnLen + psessionEntry->assocReqLen + psessionEntry->assocRspLen + psessionEntry->RICDataLen, psessionEntry->tspecIes, pSirSmeJoinRsp->tspecIeLen);
404 palFreeMemory(pMac->hHdd, psessionEntry->tspecIes);
405 psessionEntry->tspecIes = NULL;
406 PELOG1(limLog(pMac, LOG1, FL("CCX-TspecLen=%d\n"), psessionEntry->tspecLen);)
407 }
408#endif
409 pSirSmeJoinRsp->aid = psessionEntry->limAID;
410#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
411 PELOG1(limLog(pMac, LOG1, FL("AssocRsp=%d\n"), psessionEntry->assocRspLen);)
412#endif
413 }
Madan Mohan Koyyalamudib666eb12012-09-18 17:29:47 -0700414 else
415 {
416
417 if(psessionEntry->beacon != NULL)
418 {
419 palFreeMemory(pMac->hHdd, psessionEntry->beacon);
420 psessionEntry->beacon = NULL;
421 }
422
423 if(psessionEntry->assocReq != NULL)
424 {
425 palFreeMemory(pMac->hHdd, psessionEntry->assocReq);
426 psessionEntry->assocReq = NULL;
427 }
428
429 if(psessionEntry->assocRsp != NULL)
430 {
431 palFreeMemory(pMac->hHdd, psessionEntry->assocRsp);
432 psessionEntry->assocRsp = NULL;
433 }
434
435 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 }
437
438
439 pSirSmeJoinRsp->messageType = msgType;
440 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
441 pSirSmeJoinRsp->statusCode = resultCode;
442 pSirSmeJoinRsp->protStatusCode = protStatusCode;
443
444 /* Update SME session ID and transaction Id */
445 pSirSmeJoinRsp->sessionId = smesessionId;
446 pSirSmeJoinRsp->transactionId = smetransactionId;
447
448 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
449 {
450 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
451 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700452
453#ifdef WLAN_FEATURE_11AC
454 if (psessionEntry->vhtCapability)
455 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700456 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700457 /*Get 11ac cbState from 11n cbState*/
458 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
459 psessionEntry->currentOperChannel,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700460 psessionEntry->htSecondaryChannelOffset,
461 psessionEntry->apCenterChan,
462 psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700463 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
464 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700465 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700466#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700467 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 }
469 else
470 {
471 peSetResumeChannel( pMac, 0, 0);
472 }
473 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
474 (tANI_U32*) pSirSmeJoinRsp );
475 }
476 else
477 {
478 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
479 (tANI_U32*) pSirSmeJoinRsp );
480 }
481} /*** end limSendSmeJoinReassocRsp() ***/
482
483
484
485/**
486 * limSendSmeStartBssRsp()
487 *
488 *FUNCTION:
489 * This function is called to send eWNI_SME_START_BSS_RSP
490 * message to applications above MAC Software.
491 *
492 *PARAMS:
493 *
494 *LOGIC:
495 *
496 *ASSUMPTIONS:
497 * NA
498 *
499 *NOTE:
500 * NA
501 *
502 * @param pMac Pointer to Global MAC structure
503 * @param msgType Indicates message type
504 * @param resultCode Indicates the result of previously issued
505 * eWNI_SME_msgType_REQ message
506 *
507 * @return None
508 */
509
510void
511limSendSmeStartBssRsp(tpAniSirGlobal pMac,
512 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
513 tANI_U8 smesessionId,tANI_U16 smetransactionId)
514{
515
516
517 tANI_U16 size = 0;
518 tSirMsgQ mmhMsg;
519 tSirSmeStartBssRsp *pSirSmeRsp;
520 tANI_U16 ieLen;
521 tANI_U16 ieOffset, curLen;
522
523 PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s\n"),
524 limMsgStr(msgType), limResultCodeStr(resultCode));)
525
526 size = sizeof(tSirSmeStartBssRsp);
527
528 if(psessionEntry == NULL)
529 {
530
531 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
532 {
533 /// Buffer not available. Log error
534 limLog(pMac, LOGP,FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
535 return;
536 }
537 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
538
539 }
540 else
541 {
542 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
543 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
544 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
545 //calculate the memory size to allocate
546 size += ieLen;
547
548 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
549 {
550 /// Buffer not available. Log error
551 limLog(pMac, LOGP,
552 FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
553
554 return;
555 }
556 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
557 size = sizeof(tSirSmeStartBssRsp);
558 if (resultCode == eSIR_SME_SUCCESS)
559 {
560
561 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
562
563 /* Read beacon interval from session */
564 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
565 pSirSmeRsp->bssType = psessionEntry->bssType;
566
567 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
568 != eSIR_SUCCESS)
569 limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
570
571 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
572
573#if 0
574 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
575 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG\n"));
576
577#endif// TO SUPPORT BT-AMP
578
579 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
580
581 pSirSmeRsp->bssDescription.aniIndicator = 1;
582
583 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
584 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
585 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
586 (tANI_U32)curLen);
587
588 palCopyMemory( pMac->hHdd, ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
589 pMac->sch.schObject.gSchBeaconFrameEnd,
590 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
591
592
593 //subtracting size of length indicator itself and size of pointer to ieFields
594 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
595 sizeof(tANI_U16) - sizeof(tANI_U32) +
596 ieLen;
597 //This is the size of the message, subtracting the size of the pointer to ieFields
598 size += ieLen - sizeof(tANI_U32);
599 }
600
601
602
603#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
604 sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
605 sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, size);
606
607#endif
608
609 }
610
611 pSirSmeRsp->messageType = msgType;
612 pSirSmeRsp->length = size;
613
614 /* Update SME session Id and transaction Id */
615 pSirSmeRsp->sessionId = smesessionId;
616 pSirSmeRsp->transactionId = smetransactionId;
617 pSirSmeRsp->statusCode = resultCode;
618#ifdef WLAN_SOFTAP_FEATURE
619 if(psessionEntry != NULL )
620 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
621
622#endif
623
624 mmhMsg.type = msgType;
625 mmhMsg.bodyptr = pSirSmeRsp;
626 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700627 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700628
629#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
630 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
631#endif //FEATURE_WLAN_DIAG_SUPPORT
632
633 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
634} /*** end limSendSmeStartBssRsp() ***/
635
636
637
638
639
640#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
641#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
642
643
644/**
645 * limSendSmeScanRsp()
646 *
647 *FUNCTION:
648 * This function is called by limProcessSmeReqMessages() to send
649 * eWNI_SME_SCAN_RSP message to applications above MAC
650 * Software.
651 *
652 *PARAMS:
653 *
654 *LOGIC:
655 *
656 *ASSUMPTIONS:
657 * NA
658 *
659 *NOTE:
660 * NA
661 *
662 * @param pMac Pointer to Global MAC structure
663 * @param length Indicates length of message
664 * @param resultCode Indicates the result of previously issued
665 * eWNI_SME_SCAN_REQ message
666 *
667 * @return None
668 */
669
670void
671limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
672 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
673{
674 tSirMsgQ mmhMsg;
675 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
676 tLimScanResultNode *ptemp = NULL;
677 tANI_U16 msgLen, allocLength, curMsgLen = 0;
678 tANI_U16 i, bssCount;
679 tANI_U8 *pbBuf;
680 tSirBssDescription *pDesc;
681
682 PELOG1(limLog(pMac, LOG1,
683 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
684 length, limResultCodeStr(resultCode));)
685
686 if (resultCode != eSIR_SME_SUCCESS)
687 {
688 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
689 return;
690 }
691
692 mmhMsg.type = eWNI_SME_SCAN_RSP;
693 i = 0;
694 bssCount = 0;
695 msgLen = 0;
696 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
697 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
698 {
699 // Log error
700 limLog(pMac, LOGP,
701 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
702
703 return;
704 }
705 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
706 {
707 //when ptemp is not NULL it is a left over
708 ptemp = pMac->lim.gLimCachedScanHashTable[i];
709 while(ptemp)
710 {
711 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
712 if(0 == bssCount)
713 {
714 msgLen = sizeof(tSirSmeScanRsp) -
715 sizeof(tSirBssDescription) +
716 ptemp->bssDescription.length +
717 sizeof(ptemp->bssDescription.length);
718 pDesc = pSirSmeScanRsp->bssDescription;
719 }
720 else
721 {
722 msgLen += ptemp->bssDescription.length +
723 sizeof(ptemp->bssDescription.length);
724 pDesc = (tSirBssDescription *)pbBuf;
725 }
726 if( (allocLength < msgLen) ||
727 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
728 {
729 pSirSmeScanRsp->statusCode =
730 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
731#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
732 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
733 eWNI_SME_SCAN_RSP);
734 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
735#else
736 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
737 pSirSmeScanRsp->length = curMsgLen;
738#endif
739 mmhMsg.bodyptr = pSirSmeScanRsp;
740 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700741 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
743 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
744 {
745 // Log error
746 limLog(pMac, LOGP,
747 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
748 return;
749 }
750 msgLen = sizeof(tSirSmeScanRsp) -
751 sizeof(tSirBssDescription) +
752 ptemp->bssDescription.length +
753 sizeof(ptemp->bssDescription.length);
754 pDesc = pSirSmeScanRsp->bssDescription;
755 bssCount = 1;
756 }
757 curMsgLen = msgLen;
758
759 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
760 msgLen, ptemp->bssDescription.length);)
761#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
762 sirStoreU16N((tANI_U8*)&pDesc->length,
763 ptemp->bssDescription.length);
764#else
765 pDesc->length
766 = ptemp->bssDescription.length;
767#endif
768 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pDesc->bssId,
769 (tANI_U8 *) &ptemp->bssDescription.bssId,
770 ptemp->bssDescription.length);
771
772 PELOG2(limLog(pMac, LOG2, FL("BssId "));
773 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
774
775 pSirSmeScanRsp->sessionId = smesessionId;
776 pSirSmeScanRsp->transcationId = smetranscationId;
777
778 ptemp = ptemp->next;
779 } //while(ptemp)
780 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
781
782 if(0 == bssCount)
783 {
784 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700785 if (NULL != pSirSmeScanRsp)
786 {
787 palFreeMemory( pMac->hHdd, pSirSmeScanRsp);
788 pSirSmeScanRsp = NULL;
789 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700790 }
791 else
792 {
793 // send last message
794 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
795#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
796 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
797 eWNI_SME_SCAN_RSP);
798 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
799#else
800 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
801 pSirSmeScanRsp->length = curMsgLen;
802#endif
803
804 /* Update SME session Id and SME transcation Id */
805 pSirSmeScanRsp->sessionId = smesessionId;
806 pSirSmeScanRsp->transcationId = smetranscationId;
807
808 mmhMsg.type = eWNI_SME_SCAN_RSP;
809 mmhMsg.bodyptr = pSirSmeScanRsp;
810 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700811 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
813 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
814 }
815
816 return;
817
818} /*** end limSendSmeScanRsp() ***/
819
820
821/**
822 * limPostSmeScanRspMessage()
823 *
824 *FUNCTION:
825 * This function is called by limSendSmeScanRsp() to send
826 * eWNI_SME_SCAN_RSP message with failed result code
827 *
828 *NOTE:
829 * NA
830 *
831 * @param pMac Pointer to Global MAC structure
832 * @param length Indicates length of message
833 * @param resultCode failed result code
834 *
835 * @return None
836 */
837
838void
839limPostSmeScanRspMessage(tpAniSirGlobal pMac,
840 tANI_U16 length,
841 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
842{
843 tpSirSmeScanRsp pSirSmeScanRsp;
844 tSirMsgQ mmhMsg;
845
846 PELOG1(limLog(pMac, LOG1,
847 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). \n"),
848 length, limResultCodeStr(resultCode));)
849
850 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, length))
851 {
852 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
853 return;
854 }
855 palZeroMemory(pMac->hHdd, (void*)pSirSmeScanRsp, length);
856
857#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
858 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType, eWNI_SME_SCAN_RSP);
859 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, length);
860#else
861 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
862 pSirSmeScanRsp->length = length;
863#endif
864
865 if(sizeof(tSirSmeScanRsp) <= length)
866 {
867 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
868 }
869
870 pSirSmeScanRsp->statusCode = resultCode;
871
872 /*Update SME session Id and transaction Id */
873 pSirSmeScanRsp->sessionId = smesessionId;
874 pSirSmeScanRsp->transcationId = smetransactionId;
875
876 mmhMsg.type = eWNI_SME_SCAN_RSP;
877 mmhMsg.bodyptr = pSirSmeScanRsp;
878 mmhMsg.bodyval = 0;
879
Jeff Johnsone7245742012-09-05 17:12:55 -0700880 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700881#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
882 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
883#endif //FEATURE_WLAN_DIAG_SUPPORT
884
885 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
886 return;
887
888} /*** limPostSmeScanRspMessage ***/
889
Jeff Johnsone7245742012-09-05 17:12:55 -0700890#ifdef FEATURE_OEM_DATA_SUPPORT
891
892/**
893 * limSendSmeOemDataRsp()
894 *
895 *FUNCTION:
896 * This function is called by limProcessSmeReqMessages() to send
897 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
898 * Software.
899 *
900 *PARAMS:
901 *
902 *LOGIC:
903 *
904 *ASSUMPTIONS:
905 * NA
906 *
907 *NOTE:
908 * NA
909 *
910 * @param pMac Pointer to Global MAC structure
911 * @param pMsgBuf Indicates the mlm message
912 * @param resultCode Indicates the result of previously issued
913 * eWNI_SME_OEM_DATA_RSP message
914 *
915 * @return None
916 */
917
918void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
919{
920 tSirMsgQ mmhMsg;
921 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
922 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
923 tANI_U16 msgLength;
924
925
926 //get the pointer to the mlm message
927 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
928
929 msgLength = sizeof(tSirOemDataRsp);
930
931 //now allocate memory for the char buffer
932 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pSirSmeOemDataRsp, msgLength))
933 {
934 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSirSmeOemDataRsp\n"));
935 return;
936 }
937
938#if defined (ANI_LITTLE_BYTE_ENDIAN)
939 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
940 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
941#else
942 pSirSmeOemDataRsp->length = msgLength;
943 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
944#endif
945
946 palCopyMemory(pMac->hHdd, pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
947
948 //Now free the memory from MLM Rsp Message
949 palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
950
951 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
952 mmhMsg.bodyptr = pSirSmeOemDataRsp;
953 mmhMsg.bodyval = 0;
954
955 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
956
957 return;
958} /*** limSendSmeOemDataRsp ***/
959
960#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700961
962
963/**
964 * limSendSmeAuthRsp()
965 *
966 *FUNCTION:
967 * This function is called by limProcessSmeMessages() to send
968 * eWNI_SME_AUTH_RSP message to host
969 *
970 *PARAMS:
971 *
972 *LOGIC:
973 *
974 *ASSUMPTIONS:
975 * NA
976 *
977 *NOTE:
978 * NA
979 *
980 * @param pMac Pointer to Global MAC structure
981 * @param statusCode Indicates the result of previously issued
982 * eWNI_SME_AUTH_REQ message
983 *
984 * @return None
985 */
986void
987limSendSmeAuthRsp(tpAniSirGlobal pMac,
988 tSirResultCodes statusCode,
989 tSirMacAddr peerMacAddr,
990 tAniAuthType authType,
991 tANI_U16 protStatusCode,
992 tpPESession psessionEntry,tANI_U8 smesessionId,
993 tANI_U16 smetransactionId)
994{
995#if 0
996 tSirMsgQ mmhMsg;
997 tSirSmeAuthRsp *pSirSmeAuthRsp;
998
999
1000 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthRsp, sizeof(tSirSmeAuthRsp)))
1001 {
1002 // Log error
1003 limLog(pMac, LOGP,
1004 FL("call to palAllocateMemory failed for eWNI_SME_AUTH_RSP\n"));
1005
1006 return;
1007 }
1008
1009#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1010 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->messageType, eWNI_SME_AUTH_RSP);
1011 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->length, sizeof(tSirSmeAuthRsp));
1012
1013#endif
1014
1015
1016 if(psessionEntry != NULL)
1017 {
1018 palCopyMemory( pMac->hHdd, (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
1019 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1020 pSirSmeAuthRsp->authType = authType;
1021
1022 }
1023
1024 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
1025 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
1026 pSirSmeAuthRsp->statusCode = statusCode;
1027 pSirSmeAuthRsp->protStatusCode = protStatusCode;
1028
1029 /* Update SME session and transaction Id*/
1030 pSirSmeAuthRsp->sessionId = smesessionId;
1031 pSirSmeAuthRsp->transactionId = smetransactionId;
1032
1033 mmhMsg.type = eWNI_SME_AUTH_RSP;
1034 mmhMsg.bodyptr = pSirSmeAuthRsp;
1035 mmhMsg.bodyval = 0;
1036 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1037 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1038#endif
1039} /*** end limSendSmeAuthRsp() ***/
1040
1041
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001042void limSendSmeDisassocDeauthNtf( tpAniSirGlobal pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 eHalStatus status, tANI_U32 *pCtx )
1044{
1045 tSirMsgQ mmhMsg;
1046 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1047
1048 mmhMsg.type = pMsg->type;
1049 mmhMsg.bodyptr = pMsg;
1050 mmhMsg.bodyval = 0;
1051
Jeff Johnsone7245742012-09-05 17:12:55 -07001052 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001053
1054 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1055}
1056/**
1057 * limSendSmeDisassocNtf()
1058 *
1059 *FUNCTION:
1060 * This function is called by limProcessSmeMessages() to send
1061 * eWNI_SME_DISASSOC_RSP/IND message to host
1062 *
1063 *PARAMS:
1064 *
1065 *LOGIC:
1066 *
1067 *ASSUMPTIONS:
1068 * NA
1069 *
1070 *NOTE:
1071 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1072 * or eWNI_SME_DISASSOC_IND to host depending on
1073 * disassociation trigger.
1074 *
1075 * @param peerMacAddr Indicates the peer MAC addr to which
1076 * disassociate was initiated
1077 * @param reasonCode Indicates the reason for Disassociation
1078 * @param disassocTrigger Indicates the trigger for Disassociation
1079 * @param aid Indicates the STAID. This parameter is
1080 * present only on AP.
1081 *
1082 * @return None
1083 */
1084void
1085limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1086 tSirMacAddr peerMacAddr,
1087 tSirResultCodes reasonCode,
1088 tANI_U16 disassocTrigger,
1089 tANI_U16 aid,
1090 tANI_U8 smesessionId,
1091 tANI_U16 smetransactionId,
1092 tpPESession psessionEntry)
1093{
1094
1095 tANI_U8 *pBuf;
1096 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1097 tSirSmeDisassocInd *pSirSmeDisassocInd;
1098 tANI_U32 *pMsg;
1099
1100 switch (disassocTrigger)
1101 {
1102 case eLIM_PEER_ENTITY_DISASSOC:
1103 return;
1104
1105 case eLIM_HOST_DISASSOC:
1106 /**
1107 * Disassociation response due to
1108 * host triggered disassociation
1109 */
1110
1111 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocRsp, sizeof(tSirSmeDisassocRsp)))
1112 {
1113 // Log error
1114 limLog(pMac, LOGP,
1115 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_RSP\n"));
1116
1117 return;
1118 }
1119
1120#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1121 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->messageType,
1122 eWNI_SME_DISASSOC_RSP);
1123 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->length,
1124 sizeof(tSirSmeDisassocRsp));
1125#else
1126 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1127 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
1128#endif
1129 //sessionId
1130 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1131 *pBuf = smesessionId;
1132 pBuf++;
1133
1134 //transactionId
1135 limCopyU16(pBuf, smetransactionId);
1136 pBuf += sizeof(tANI_U16);
1137
1138 //statusCode
1139 limCopyU32(pBuf, reasonCode);
1140 pBuf += sizeof(tSirResultCodes);
1141
1142 //peerMacAddr
1143 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1144 pBuf += sizeof(tSirMacAddr);
1145
1146#if (WNI_POLARIS_FW_PRODUCT == AP)
1147 limCopyU16(pBuf, aid);
1148 pBuf += sizeof(tANI_U16);
1149
1150 // perStaStats
1151 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1152#else
1153 // Clear Station Stats
1154 //for sta, it is always 1, IBSS is handled at halInitSta
1155
1156#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1157
1158
1159#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1160 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1161 psessionEntry, (tANI_U16)reasonCode, 0);
1162#endif
1163 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1164 break;
1165
1166 default:
1167 /**
1168 * Disassociation indication due to Disassociation
1169 * frame reception from peer entity or due to
1170 * loss of link with peer entity.
1171 */
1172 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1173 {
1174 // Log error
1175 limLog(pMac, LOGP,
1176 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1177
1178 return;
1179 }
1180
1181#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1182 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType,
1183 eWNI_SME_DISASSOC_IND);
1184 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length,
1185 sizeof(tSirSmeDisassocInd));
1186#else
1187 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1188 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1189
1190 /* Update SME session Id and Transaction Id */
1191 pSirSmeDisassocInd->sessionId = smesessionId;
1192 pSirSmeDisassocInd->transactionId = smetransactionId;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001193 pSirSmeDisassocInd->reasonCode = reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001194#endif
1195 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1196
1197 limCopyU32(pBuf, reasonCode);
1198 pBuf += sizeof(tSirResultCodes);
1199
1200 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1201 pBuf += sizeof(tSirMacAddr);
1202
1203 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1204#if (WNI_POLARIS_FW_PRODUCT == AP)
1205 pBuf += sizeof(tSirMacAddr);
1206 limCopyU16(pBuf, aid);
1207 pBuf += sizeof(tANI_U16);
1208
1209 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1210
1211#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1212
1213
1214#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1215 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1216 psessionEntry, (tANI_U16)reasonCode, 0);
1217#endif
1218 pMsg = (tANI_U32*) pSirSmeDisassocInd;
1219#if (WNI_POLARIS_FW_PRODUCT == AP)
1220 PELOG1(limLog(pMac, LOG1,
1221 FL("*** Sending DisAssocInd staId=%d, reasonCode=%d ***\n"),
1222 aid, reasonCode);)
1223#endif
1224
1225 break;
1226 }
1227
1228 /* Delete the PE session Created */
1229 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1230 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1231 {
1232 peDeleteSession(pMac,psessionEntry);
1233 }
1234
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001235 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001237} /*** end limSendSmeDisassocNtf() ***/
1238
1239
1240/** -----------------------------------------------------------------
1241 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1242
1243 After receiving disassociation frame from peer entity, this
1244 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1245 reason code.
1246
1247 \param pMac - global mac structure
1248 \param pStaDs - station dph hash node
1249 \return none
1250 \sa
1251 ----------------------------------------------------------------- */
1252void
1253limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1254{
1255 tSirMsgQ mmhMsg;
1256 tSirSmeDisassocInd *pSirSmeDisassocInd;
1257
1258 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1259 {
1260 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1261 return;
1262 }
1263
1264 //psessionEntry = peFindSessionByBssid(pMac,pStaDs->staAddr,&sessionId);
1265#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1266 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType, eWNI_SME_DISASSOC_IND);
1267 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length, sizeof(tSirSmeDisassocInd));
1268#else
1269 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1270 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1271#endif
1272
1273#if 0 //Commenting out all the serialization
1274 //statusCode
1275 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1276 limCopyU32(pBuf, pStaDs->mlmStaContext.disassocReason);
1277 pBuf += sizeof(tSirResultCodes);
1278
1279 //peerMacAddr
1280 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1281
1282#ifdef ANI_PRODUCT_TYPE_AP
1283 pBuf += sizeof(tSirMacAddr);
1284 //aid
1285 limCopyU16(pBuf, pStaDs->assocId);
1286 pBuf += sizeof(tANI_U16);
1287
1288 //perStaStats
1289 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat, pBuf);
1290#endif
1291#endif
1292 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1293 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1294 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001295 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001296
1297 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
1298
1299 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->peerMacAddr , pStaDs->staAddr, sizeof(tSirMacAddr));
1300
1301#ifdef ANI_PRODUCT_TYPE_AP
1302 pSirSmeDisassocInd->aid = pStaDs->assocId;
1303 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat,(tANI_U8*)&pSirSmeDisassocInd-> perStaStats );
1304#endif
1305#ifdef WLAN_SOFTAP_FEATURE
1306 pSirSmeDisassocInd->staId = pStaDs->staIndex;
1307#endif
1308
1309 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1310 mmhMsg.bodyptr = pSirSmeDisassocInd;
1311 mmhMsg.bodyval = 0;
1312
Jeff Johnsone7245742012-09-05 17:12:55 -07001313 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001314#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1315 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1316#endif //FEATURE_WLAN_DIAG_SUPPORT
1317
1318 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1319
1320} /*** end limSendSmeDisassocInd() ***/
1321
1322
1323/** -----------------------------------------------------------------
1324 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1325
1326 After receiving deauthentication frame from peer entity, this
1327 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1328 reason code.
1329
1330 \param pMac - global mac structure
1331 \param pStaDs - station dph hash node
1332 \return none
1333 \sa
1334 ----------------------------------------------------------------- */
1335void
1336limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1337{
1338#ifndef WLAN_SOFTAP_FEATURE
1339 tANI_U8 *pBuf;
1340#endif
1341 tSirMsgQ mmhMsg;
1342 tSirSmeDeauthInd *pSirSmeDeauthInd;
1343
1344 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1345 {
1346 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_IND \n"));
1347 return;
1348 }
1349
1350#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1351 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType, eWNI_SME_DEAUTH_IND);
1352 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length, sizeof(tSirSmeDeauthInd));
1353#else
1354 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1355 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1356#endif
1357
1358#ifdef WLAN_SOFTAP_FEATURE
1359 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1360 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1361 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1362 {
1363 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1364 }
1365 else
1366 {
1367 //Need to indicatet he reascon code over the air
1368 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1369 }
1370 //BSSID
1371 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1372 //peerMacAddr
1373 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001374 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001375#else
1376
1377 //sessionId
1378 pBuf = (tANI_U8 *) &pSirSmeDeauthInd->sessionId;
1379 *pBuf++ = psessionEntry->smeSessionId;
1380
1381 //transactionId
1382 limCopyU16(pBuf, 0);
1383 pBuf += sizeof(tANI_U16);
1384
1385 // status code
1386 limCopyU32(pBuf, pStaDs->mlmStaContext.cleanupTrigger);
1387 pBuf += sizeof(tSirResultCodes);
1388
1389 //bssid
1390 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1391 pBuf += sizeof(tSirMacAddr);
1392
1393 //peerMacAddr
1394 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1395#endif
1396
1397#if (WNI_POLARIS_FW_PRODUCT == AP)
1398 pBuf += sizeof(tSirMacAddr);
1399 limCopyU16(pBuf, pStaDs->staAddr);
1400#endif
1401
1402#ifdef WLAN_SOFTAP_FEATURE
1403 pSirSmeDeauthInd->staId = pStaDs->staIndex;
1404#endif
1405
1406 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1407 mmhMsg.bodyptr = pSirSmeDeauthInd;
1408 mmhMsg.bodyval = 0;
1409
Jeff Johnsone7245742012-09-05 17:12:55 -07001410 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001411#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1412 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1413#endif //FEATURE_WLAN_DIAG_SUPPORT
1414
1415 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1416 return;
1417} /*** end limSendSmeDeauthInd() ***/
1418
Hoonki Leee6bfe942013-02-05 15:01:19 -08001419#ifdef FEATURE_WLAN_TDLS
1420/**
1421 * limSendSmeTDLSDelStaInd()
1422 *
1423 *FUNCTION:
1424 * This function is called to send the TDLS STA context deletion to SME.
1425 *
1426 *LOGIC:
1427 *
1428 *ASSUMPTIONS:
1429 *
1430 *NOTE:
1431 * NA
1432 *
1433 * @param pMac - Pointer to global MAC structure
1434 * @param pStaDs - Pointer to internal STA Datastructure
1435 * @param psessionEntry - Pointer to the session entry
1436 * @param reasonCode - Reason for TDLS sta deletion
1437 * @return None
1438 */
1439void
1440limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode)
1441{
1442 tSirMsgQ mmhMsg;
1443 tSirTdlsDelStaInd *pSirTdlsDelStaInd;
1444
1445 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirTdlsDelStaInd, sizeof(tSirTdlsDelStaInd)))
1446 {
1447 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_TDLS_DEL_STA_IND \n"));
1448 return;
1449 }
1450
1451 //messageType
1452 pSirTdlsDelStaInd->messageType = eWNI_SME_TDLS_DEL_STA_IND;
1453 pSirTdlsDelStaInd->length = sizeof(tSirTdlsDelStaInd);
1454
1455 //sessionId
1456 pSirTdlsDelStaInd->sessionId = psessionEntry->smeSessionId;
1457
1458 //peerMacAddr
1459 palCopyMemory( pMac->hHdd, pSirTdlsDelStaInd->peerMac, pStaDs->staAddr, sizeof(tSirMacAddr));
1460
1461 //staId
1462 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->staId), (tANI_U16)pStaDs->staIndex);
1463
1464 //reasonCode
1465 limCopyU16((tANI_U8*)(&pSirTdlsDelStaInd->reasonCode), reasonCode);
1466
1467 mmhMsg.type = eWNI_SME_TDLS_DEL_STA_IND;
1468 mmhMsg.bodyptr = pSirTdlsDelStaInd;
1469 mmhMsg.bodyval = 0;
1470
1471
1472 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1473 return;
1474}/*** end limSendSmeTDLSDelStaInd() ***/
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001475
1476/**
1477 * limSendSmeTDLSDeleteAllPeerInd()
1478 *
1479 *FUNCTION:
1480 * This function is called to send the eWNI_SME_TDLS_DEL_ALL_PEER_IND
1481 * message to SME.
1482 *
1483 *LOGIC:
1484 *
1485 *ASSUMPTIONS:
1486 *
1487 *NOTE:
1488 * NA
1489 *
1490 * @param pMac - Pointer to global MAC structure
1491 * @param psessionEntry - Pointer to the session entry
1492 * @return None
1493 */
1494void
1495limSendSmeTDLSDeleteAllPeerInd(tpAniSirGlobal pMac, tpPESession psessionEntry)
1496{
1497 tSirMsgQ mmhMsg;
1498 tSirTdlsDelAllPeerInd *pSirTdlsDelAllPeerInd;
1499
1500 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirTdlsDelAllPeerInd, sizeof(tSirTdlsDelAllPeerInd)))
1501 {
1502 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_TDLS_DEL_ALL_PEER_IND"));
1503 return;
1504 }
1505
1506 //messageType
1507 pSirTdlsDelAllPeerInd->messageType = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1508 pSirTdlsDelAllPeerInd->length = sizeof(tSirTdlsDelAllPeerInd);
1509
1510 //sessionId
1511 pSirTdlsDelAllPeerInd->sessionId = psessionEntry->smeSessionId;
1512
1513 mmhMsg.type = eWNI_SME_TDLS_DEL_ALL_PEER_IND;
1514 mmhMsg.bodyptr = pSirTdlsDelAllPeerInd;
1515 mmhMsg.bodyval = 0;
1516
1517
1518 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1519 return;
1520}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001521
1522/**
1523 * limSendSmeMgmtTXCompletion()
1524 *
1525 *FUNCTION:
1526 * This function is called to send the eWNI_SME_MGMT_FRM_TX_COMPLETION_IND
1527 * message to SME.
1528 *
1529 *LOGIC:
1530 *
1531 *ASSUMPTIONS:
1532 *
1533 *NOTE:
1534 * NA
1535 *
1536 * @param pMac - Pointer to global MAC structure
1537 * @param psessionEntry - Pointer to the session entry
1538 * @param txCompleteStatus - TX Complete Status of Mgmt Frames
1539 * @return None
1540 */
1541void
1542limSendSmeMgmtTXCompletion(tpAniSirGlobal pMac,
1543 tpPESession psessionEntry,
1544 tANI_U32 txCompleteStatus)
1545{
1546 tSirMsgQ mmhMsg;
1547 tSirMgmtTxCompletionInd *pSirMgmtTxCompletionInd;
1548
1549 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirMgmtTxCompletionInd, sizeof(tSirMgmtTxCompletionInd)))
1550 {
1551 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_MGMT_FRM_TX_COMPLETION_IND"));
1552 return;
1553 }
1554
1555 //messageType
1556 pSirMgmtTxCompletionInd->messageType = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1557 pSirMgmtTxCompletionInd->length = sizeof(tSirMgmtTxCompletionInd);
1558
1559 //sessionId
1560 pSirMgmtTxCompletionInd->sessionId = psessionEntry->smeSessionId;
1561
1562 pSirMgmtTxCompletionInd->txCompleteStatus = txCompleteStatus;
1563
1564 mmhMsg.type = eWNI_SME_MGMT_FRM_TX_COMPLETION_IND;
1565 mmhMsg.bodyptr = pSirMgmtTxCompletionInd;
1566 mmhMsg.bodyval = 0;
1567
1568
1569 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1570 return;
1571}/*** end limSendSmeTDLSDeleteAllPeerInd() ***/
Hoonki Leee6bfe942013-02-05 15:01:19 -08001572#endif
1573
Jeff Johnson295189b2012-06-20 16:38:30 -07001574
1575/**
1576 * limSendSmeDeauthNtf()
1577 *
1578 *FUNCTION:
1579 * This function is called by limProcessSmeMessages() to send
1580 * eWNI_SME_DISASSOC_RSP/IND message to host
1581 *
1582 *PARAMS:
1583 *
1584 *LOGIC:
1585 *
1586 *ASSUMPTIONS:
1587 * NA
1588 *
1589 *NOTE:
1590 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1591 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1592 *
1593 * @param peerMacAddr Indicates the peer MAC addr to which
1594 * deauthentication was initiated
1595 * @param reasonCode Indicates the reason for Deauthetication
1596 * @param deauthTrigger Indicates the trigger for Deauthetication
1597 * @param aid Indicates the STAID. This parameter is present
1598 * only on AP.
1599 *
1600 * @return None
1601 */
1602void
1603limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1604 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1605{
1606 tANI_U8 *pBuf;
1607 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1608 tSirSmeDeauthInd *pSirSmeDeauthInd;
1609 tpPESession psessionEntry;
1610 tANI_U8 sessionId;
1611 tANI_U32 *pMsg;
1612
1613 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1614 switch (deauthTrigger)
1615 {
1616 case eLIM_PEER_ENTITY_DEAUTH:
1617 return;
1618
1619 case eLIM_HOST_DEAUTH:
1620 /**
1621 * Deauthentication response to host triggered
1622 * deauthentication.
1623 */
1624 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthRsp, sizeof(tSirSmeDeauthRsp)))
1625 {
1626 // Log error
1627 limLog(pMac, LOGP,
1628 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_RSP\n"));
1629
1630 return;
1631 }
1632
1633#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1634 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->messageType),
1635 eWNI_SME_DEAUTH_RSP);
1636 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->length),
1637 sizeof(tSirSmeDeauthRsp));
1638#else
1639 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1640 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
1641#endif
1642 pSirSmeDeauthRsp->statusCode = reasonCode;
1643 pSirSmeDeauthRsp->sessionId = smesessionId;
1644 pSirSmeDeauthRsp->transactionId = smetransactionId;
1645
1646 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
1647 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1648
1649#if (WNI_POLARIS_FW_PRODUCT == AP)
1650 pBuf += sizeof(tSirMacAddr);
1651 limCopyU16(pBuf, aid);
1652#endif
1653#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1654 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1655 psessionEntry, 0, (tANI_U16)reasonCode);
1656#endif
1657 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1658
1659 break;
1660
1661 default:
1662 /**
1663 * Deauthentication indication due to Deauthentication
1664 * frame reception from peer entity or due to
1665 * loss of link with peer entity.
1666 */
1667 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1668 {
1669 // Log error
1670 limLog(pMac, LOGP,
1671 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_Ind\n"));
1672
1673 return;
1674 }
1675
1676#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1677 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType,
1678 eWNI_SME_DEAUTH_IND);
1679 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length,
1680 sizeof(tSirSmeDeauthInd));
1681#else
1682 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1683 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001684 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Jeff Johnson295189b2012-06-20 16:38:30 -07001685#endif
1686
1687 // sessionId
1688 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1689 *pBuf++ = smesessionId;
1690
1691 //transaction ID
1692 limCopyU16(pBuf, smetransactionId);
1693 pBuf += sizeof(tANI_U16);
1694
1695 // status code
1696 limCopyU32(pBuf, reasonCode);
1697 pBuf += sizeof(tSirResultCodes);
1698
1699 //bssId
1700 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1701 pBuf += sizeof(tSirMacAddr);
1702
1703 //peerMacAddr
1704 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
1705
1706#if (WNI_POLARIS_FW_PRODUCT == AP)
1707 pBuf += sizeof(tSirMacAddr);
1708 limCopyU16(pBuf, aid);
1709#endif
1710#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1711 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1712 psessionEntry, 0, (tANI_U16)reasonCode);
1713#endif //FEATURE_WLAN_DIAG_SUPPORT
1714 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1715
1716 break;
1717 }
1718
1719 /*Delete the PE session created */
1720 if(psessionEntry != NULL)
1721 {
1722 peDeleteSession(pMac,psessionEntry);
1723 }
1724
Madan Mohan Koyyalamudi27ecc282012-11-06 15:07:28 -08001725 limSendSmeDisassocDeauthNtf( pMac, eHAL_STATUS_SUCCESS,
1726 (tANI_U32*) pMsg );
Jeff Johnson295189b2012-06-20 16:38:30 -07001727
Jeff Johnson295189b2012-06-20 16:38:30 -07001728} /*** end limSendSmeDeauthNtf() ***/
1729
1730
1731/**
1732 * limSendSmeWmStatusChangeNtf()
1733 *
1734 *FUNCTION:
1735 * This function is called by limProcessSmeMessages() to send
1736 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1737 *
1738 *PARAMS:
1739 *
1740 *LOGIC:
1741 *
1742 *ASSUMPTIONS:
1743 * NA
1744 *
1745 *NOTE:
1746 *
1747 * @param statusChangeCode Indicates the change in the wireless medium.
1748 * @param statusChangeInfo Indicates the information associated with
1749 * change in the wireless medium.
1750 * @param infoLen Indicates the length of status change information
1751 * being sent.
1752 *
1753 * @return None
1754 */
1755void
1756limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1757 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1758{
1759 tSirMsgQ mmhMsg;
1760 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
1761 eHalStatus status;
1762#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1763 tANI_U32 bufLen;
1764 tANI_U16 length=0;
1765 tANI_U8 *pBuf;
1766#endif
1767
1768
1769
1770 status = palAllocateMemory( pMac->hHdd, (void **)&pSirSmeWmStatusChangeNtf,
1771 sizeof(tSirSmeWmStatusChangeNtf));
1772 if (status != eHAL_STATUS_SUCCESS)
1773 {
1774 limLog(pMac, LOGE,
1775 FL("call to palAllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF, status = %d\n"),
1776 status);
1777 return;
1778 }
1779
1780#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1781 pBuf = (tANI_U8 *)pSirSmeWmStatusChangeNtf;
1782#endif
1783
1784 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1785 mmhMsg.bodyval = 0;
1786 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1787
1788 switch(statusChangeCode)
1789 {
1790 case eSIR_SME_RADAR_DETECTED:
1791
1792#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1793 bufLen = sizeof(tSirSmeWmStatusChangeNtf);
1794 if ((limSmeWmStatusChangeHeaderSerDes(pMac,
1795 statusChangeCode,
1796 pBuf,
1797 &length,
1798 bufLen,
1799 sessionId) != eSIR_SUCCESS))
1800 {
1801 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1802 limLog(pMac, LOGP, FL("Header SerDes failed \n"));
1803 return;
1804 }
1805 pBuf += length;
1806 bufLen -= length;
1807 if ((limRadioInfoSerDes(pMac,
1808 (tpSirRadarInfo)pStatusChangeInfo,
1809 pBuf,
1810 &length,
1811 bufLen) != eSIR_SUCCESS))
1812 {
1813 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1814 limLog(pMac, LOGP, FL("Radio Info SerDes failed \n"));
1815 return;
1816 }
1817
1818 pBuf = (tANI_U8 *) pSirSmeWmStatusChangeNtf;
1819 pBuf += sizeof(tANI_U16);
1820 limCopyU16(pBuf, length);
1821#endif
1822 break;
1823
1824 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
1825#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1826
1827 if( eSIR_SUCCESS != nonTitanBssFoundSerDes( pMac,
1828 (tpSirNeighborBssWdsInfo) pStatusChangeInfo,
1829 pBuf,
1830 &length,
1831 sessionId))
1832 {
1833 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1834 limLog( pMac, LOGP,
1835 FL("Unable to serialize nonTitanBssFoundSerDes!\n"));
1836 return;
1837 }
1838#endif
1839 break;
1840
1841 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1842 limPackBkgndScanFailNotify(pMac,
1843 statusChangeCode,
1844 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1845 pSirSmeWmStatusChangeNtf, sessionId);
1846 break;
1847
1848 default:
1849#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1850 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->messageType,
1851 eWNI_SME_WM_STATUS_CHANGE_NTF );
1852 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->length,
1853 (sizeof(tSirSmeWmStatusChangeNtf)));
1854 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1855 sirStoreU32N((tANI_U8*)&pSirSmeWmStatusChangeNtf->statusChangeCode,
1856 statusChangeCode);
1857#else
1858 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1859 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1860 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1861 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1862#endif
1863 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1864 {
1865 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo, (tANI_U8 *)pStatusChangeInfo, infoLen);
1866 }
1867 limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***\n"),
1868 statusChangeCode, infoLen);
1869 break;
1870 }
1871
1872
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001873 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1875 {
1876 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1877 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed\n"));
1878 }
1879
1880} /*** end limSendSmeWmStatusChangeNtf() ***/
1881
1882
1883/**
1884 * limSendSmeSetContextRsp()
1885 *
1886 *FUNCTION:
1887 * This function is called by limProcessSmeMessages() to send
1888 * eWNI_SME_SETCONTEXT_RSP message to host
1889 *
1890 *PARAMS:
1891 *
1892 *LOGIC:
1893 *
1894 *ASSUMPTIONS:
1895 * NA
1896 *
1897 *NOTE:
1898 *
1899 * @param pMac Pointer to Global MAC structure
1900 * @param peerMacAddr Indicates the peer MAC addr to which
1901 * setContext was performed
1902 * @param aid Indicates the aid corresponding to the peer MAC
1903 * address
1904 * @param resultCode Indicates the result of previously issued
1905 * eWNI_SME_SETCONTEXT_RSP message
1906 *
1907 * @return None
1908 */
1909void
1910limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1911 tSirMacAddr peerMacAddr, tANI_U16 aid,
1912 tSirResultCodes resultCode,
1913 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1914{
1915
1916 tANI_U8 *pBuf;
1917 tSirMsgQ mmhMsg;
1918 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1919
1920 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSetContextRsp, sizeof(tSirSmeSetContextRsp)))
1921 {
1922 // Log error
1923 limLog(pMac, LOGP,
1924 FL("call to palAllocateMemory failed for SmeSetContextRsp\n"));
1925
1926 return;
1927 }
1928
1929#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1930 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->messageType,
1931 eWNI_SME_SETCONTEXT_RSP);
1932 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->length,
1933 sizeof(tSirSmeSetContextRsp));
1934#else
1935 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1936 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
1937#endif
1938 pSirSmeSetContextRsp->statusCode = resultCode;
1939
1940 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1941
1942 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1943 pBuf += sizeof(tSirMacAddr);
1944
1945#if (WNI_POLARIS_FW_PRODUCT == AP)
1946 limCopyU16(pBuf, aid);
1947 pBuf += sizeof(tANI_U16);
1948#endif
1949
1950 /* Update SME session and transaction Id*/
1951 pSirSmeSetContextRsp->sessionId = smesessionId;
1952 pSirSmeSetContextRsp->transactionId = smetransactionId;
1953
1954 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1955 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1956 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001957 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001958
1959#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1960 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1961#endif //FEATURE_WLAN_DIAG_SUPPORT
1962
1963 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1964} /*** end limSendSmeSetContextRsp() ***/
1965
1966/**
1967 * limSendSmeRemoveKeyRsp()
1968 *
1969 *FUNCTION:
1970 * This function is called by limProcessSmeMessages() to send
1971 * eWNI_SME_REMOVEKEY_RSP message to host
1972 *
1973 *PARAMS:
1974 *
1975 *LOGIC:
1976 *
1977 *ASSUMPTIONS:
1978 * NA
1979 *
1980 *NOTE:
1981 *
1982 * @param pMac Pointer to Global MAC structure
1983 * @param peerMacAddr Indicates the peer MAC addr to which
1984 * Removekey was performed
1985 * @param aid Indicates the aid corresponding to the peer MAC
1986 * address
1987 * @param resultCode Indicates the result of previously issued
1988 * eWNI_SME_REMOVEKEY_RSP message
1989 *
1990 * @return None
1991 */
1992void
1993limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1994 tSirMacAddr peerMacAddr,
1995 tSirResultCodes resultCode,
1996 tpPESession psessionEntry,tANI_U8 smesessionId,
1997 tANI_U16 smetransactionId)
1998{
1999 tANI_U8 *pBuf;
2000 tSirMsgQ mmhMsg;
2001 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
2002
2003 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRemoveKeyRsp, sizeof(tSirSmeRemoveKeyRsp)))
2004 {
2005 // Log error
2006 limLog(pMac, LOGP,
2007 FL("call to palAllocateMemory failed for SmeRemoveKeyRsp\n"));
2008
2009 return;
2010 }
2011
2012#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
2013 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->messageType,
2014 eWNI_SME_REMOVEKEY_RSP);
2015 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->length,
2016 sizeof(tSirSmeRemoveKeyRsp));
2017
2018#endif
2019
2020
2021 if(psessionEntry != NULL)
2022 {
2023 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
2024 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
2025 pBuf += sizeof(tSirMacAddr);
2026 limCopyU32(pBuf, resultCode);
2027 }
2028
2029 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
2030 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
2031 pSirSmeRemoveKeyRsp->statusCode = resultCode;
2032
2033 /* Update SME session and transaction Id*/
2034 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
2035 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
2036
2037 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
2038 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
2039 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002040 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2042} /*** end limSendSmeSetContextRsp() ***/
2043
2044
2045/**
2046 * limSendSmePromiscuousModeRsp()
2047 *
2048 *FUNCTION:
2049 * This function is called by limProcessSmeMessages() to send
2050 * eWNI_PROMISCUOUS_MODE_RSP message to host
2051 *
2052 *PARAMS:
2053 *
2054 *LOGIC:
2055 *
2056 *ASSUMPTIONS:
2057 * NA
2058 *
2059 *NOTE:
2060 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
2061 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
2062 *
2063 * @param None
2064 * @return None
2065 */
2066void
2067limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
2068{
2069#if 0
2070 tSirMsgQ mmhMsg;
2071 tSirMbMsg *pMbMsg;
2072
2073 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbMsg, sizeof(tSirMbMsg)))
2074 {
2075 // Log error
2076 limLog(pMac, LOGP, FL("call to palAllocateMemory failed\n"));
2077
2078 return;
2079 }
2080
2081 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2082 pMbMsg->msgLen = 4;
2083
2084 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
2085 mmhMsg.bodyptr = pMbMsg;
2086 mmhMsg.bodyval = 0;
2087 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
2088 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2089#endif
2090} /*** end limSendSmePromiscuousModeRsp() ***/
2091
2092
2093
2094/**
2095 * limSendSmeNeighborBssInd()
2096 *
2097 *FUNCTION:
2098 * This function is called by limLookupNaddHashEntry() to send
2099 * eWNI_SME_NEIGHBOR_BSS_IND message to host
2100 *
2101 *PARAMS:
2102 *
2103 *LOGIC:
2104 *
2105 *ASSUMPTIONS:
2106 * NA
2107 *
2108 *NOTE:
2109 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
2110 * host upon detecting new BSS during background scanning if CFG
2111 * option is enabled for sending such indication
2112 *
2113 * @param pMac - Pointer to Global MAC structure
2114 * @return None
2115 */
2116
2117void
2118limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
2119 tLimScanResultNode *pBssDescr)
2120{
2121 tSirMsgQ msgQ;
2122 tANI_U32 val;
2123 tSirSmeNeighborBssInd *pNewBssInd;
2124
2125 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
2126 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
2127 pMac->lim.gLimRspReqd))
2128 {
2129 // LIM is not in background scan state OR
2130 // current scan is initiated by HDD.
2131 // No need to send new BSS indication to HDD
2132 return;
2133 }
2134
2135 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
2136 {
2137 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG\n"));
2138
2139 return;
2140 }
2141
2142 if (val == 0)
2143 return;
2144
2145 /**
2146 * Need to indicate new BSSs found during
2147 * background scanning to host.
2148 * Allocate buffer for sending indication.
2149 * Length of buffer is length of BSS description
2150 * and length of header itself
2151 */
2152 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
2153 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pNewBssInd, val))
2154 {
2155 // Log error
2156 limLog(pMac, LOGP,
2157 FL("call to palAllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND\n"));
2158
2159 return;
2160 }
2161
2162#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
2163 sirStoreU16N((tANI_U8*) &pNewBssInd->messageType,
2164 eWNI_SME_NEIGHBOR_BSS_IND);
2165 sirStoreU16N((tANI_U8*)&pNewBssInd->length, (tANI_U16)val );
2166#else
2167 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2168 pNewBssInd->length = (tANI_U16) val;
2169#endif
2170 pNewBssInd->sessionId = 0;
2171
2172#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
2173 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewBssInd->bssDescription,
2174 (tANI_U8 *) &pBssDescr->bssDescription,
2175 pBssDescr->bssDescription.length + sizeof(tANI_U16));
2176#endif
2177
2178 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2179 msgQ.bodyptr = pNewBssInd;
2180 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002181 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2183} /*** end limSendSmeNeighborBssInd() ***/
2184
2185/** -----------------------------------------------------------------
2186 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2187 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2188 \ SME only looks at rc and tspec field.
2189 \param pMac - global mac structure
2190 \param rspReqd - is SmeAddTsRsp required
2191 \param status - status code of SME_ADD_TS_RSP
2192 \return tspec
2193 \sa
2194 ----------------------------------------------------------------- */
2195void
2196limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2197 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2198{
2199 tpSirAddtsRsp rsp;
2200 tSirMsgQ mmhMsg;
2201
2202 if (! rspReqd)
2203 return;
2204
2205 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2206 {
2207 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_RSP"));
2208 return;
2209 }
2210
2211 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2212 rsp->messageType = eWNI_SME_ADDTS_RSP;
2213 rsp->rc = status;
2214 rsp->rsp.status = (enum eSirMacStatusCodes) status;
2215 //palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
2216 rsp->rsp.tspec = tspec;
2217
2218 /* Update SME session Id and transcation Id */
2219 rsp->sessionId = smesessionId;
2220 rsp->transactionId = smetransactionId;
2221
2222 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2223 mmhMsg.bodyptr = rsp;
2224 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002225 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002226#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2227 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2228#endif //FEATURE_WLAN_DIAG_SUPPORT
2229
2230 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2231 return;
2232}
2233
2234void
2235limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2236{
2237 tpSirAddtsRsp rsp;
2238 tSirMsgQ mmhMsg;
2239
2240 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)\n",
2241 addts->dialogToken,
2242 addts->tspec.tsinfo.traffic.tsid,
2243 addts->tspec.tsinfo.traffic.userPrio);
2244
2245 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2246 {
2247 // Log error
2248 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_IND\n"));
2249 return;
2250 }
2251 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2252
2253 rsp->messageType = eWNI_SME_ADDTS_IND;
2254
2255 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
2256
2257 mmhMsg.type = eWNI_SME_ADDTS_IND;
2258 mmhMsg.bodyptr = rsp;
2259 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002260 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2262}
2263
2264void
2265limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2266{
2267 tpSirDeltsRsp rsp;
2268 tSirMsgQ mmhMsg;
2269
2270 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d\n",
2271 delts->aid,
2272 delts->req.tsinfo.traffic.tsid,
2273 delts->req.tsinfo.traffic.userPrio,
2274 status);
2275 if (! delts->rspReqd)
2276 return;
2277
2278 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2279 {
2280 // Log error
2281 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_RSP\n"));
2282 return;
2283 }
2284 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2285
2286 if(psessionEntry != NULL)
2287 {
2288
2289 rsp->aid = delts->aid;
2290 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2291 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
2292 }
2293
2294
2295 rsp->messageType = eWNI_SME_DELTS_RSP;
2296 rsp->rc = status;
2297
2298 /* Update SME session Id and transcation Id */
2299 rsp->sessionId = smesessionId;
2300 rsp->transactionId = smetransactionId;
2301
2302 mmhMsg.type = eWNI_SME_DELTS_RSP;
2303 mmhMsg.bodyptr = rsp;
2304 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002305 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002306#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2307 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2308#endif //FEATURE_WLAN_DIAG_SUPPORT
2309
2310 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2311}
2312
2313void
2314limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2315{
2316 tpSirDeltsRsp rsp;
2317 tSirMsgQ mmhMsg;
2318
2319 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)\n",
2320 aid,
2321 delts->tsinfo.traffic.tsid,
2322 delts->tsinfo.traffic.userPrio);
2323
2324 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2325 {
2326 // Log error
2327 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_IND\n"));
2328 return;
2329 }
2330 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2331
2332 rsp->messageType = eWNI_SME_DELTS_IND;
2333 rsp->rc = eSIR_SUCCESS;
2334 rsp->aid = aid;
2335 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
2336
2337 /* Update SME session Id and SME transaction Id */
2338
2339 rsp->sessionId = psessionEntry->smeSessionId;
2340 rsp->transactionId = psessionEntry->transactionId;
2341
2342 mmhMsg.type = eWNI_SME_DELTS_IND;
2343 mmhMsg.bodyptr = rsp;
2344 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002345 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002346#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2347 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2348#endif //FEATURE_WLAN_DIAG_SUPPORT
2349
2350 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2351}
2352
2353/**
2354 * limSendSmeStatsRsp()
2355 *
2356 *FUNCTION:
2357 * This function is called to send 802.11 statistics response to HDD.
2358 * This function posts the result back to HDD. This is a response to
2359 * HDD's request for statistics.
2360 *
2361 *PARAMS:
2362 *
2363 *LOGIC:
2364 *
2365 *ASSUMPTIONS:
2366 * NA
2367 *
2368 *NOTE:
2369 * NA
2370 *
2371 * @param pMac Pointer to Global MAC structure
2372 * @param p80211Stats Statistics sent in response
2373 * @param resultCode TODO:
2374 *
2375 *
2376 * @return none
2377 */
2378
2379void
2380limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2381{
2382 tSirMsgQ mmhMsg;
2383 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2384
2385 switch(msgType)
2386 {
2387 case WDA_STA_STAT_RSP:
2388 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2389 break;
2390 case WDA_AGGR_STAT_RSP:
2391 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2392 break;
2393 case WDA_GLOBAL_STAT_RSP:
2394 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2395 break;
2396 case WDA_STAT_SUMM_RSP:
2397 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2398 break;
2399 default:
2400 mmhMsg.type = msgType; //Response from within PE
2401 break;
2402 }
2403
2404 pMsgHdr->messageType = mmhMsg.type;
2405
2406 mmhMsg.bodyptr = stats;
2407 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002408 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002409 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2410
2411 return;
2412
2413} /*** end limSendSmeStatsRsp() ***/
2414
2415/**
2416 * limSendSmePEStatisticsRsp()
2417 *
2418 *FUNCTION:
2419 * This function is called to send 802.11 statistics response to HDD.
2420 * This function posts the result back to HDD. This is a response to
2421 * HDD's request for statistics.
2422 *
2423 *PARAMS:
2424 *
2425 *LOGIC:
2426 *
2427 *ASSUMPTIONS:
2428 * NA
2429 *
2430 *NOTE:
2431 * NA
2432 *
2433 * @param pMac Pointer to Global MAC structure
2434 * @param p80211Stats Statistics sent in response
2435 * @param resultCode TODO:
2436 *
2437 *
2438 * @return none
2439 */
2440
2441void
2442limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2443{
2444 tSirMsgQ mmhMsg;
2445 tANI_U8 sessionId;
2446 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2447 tpPESession pPeSessionEntry;
2448
2449 //Get the Session Id based on Sta Id
2450 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2451
2452 //Fill the Session Id
2453 if(NULL != pPeSessionEntry)
2454 {
2455 //Fill the Session Id
2456 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2457 }
2458
2459 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2460
2461
2462 //msgType should be WDA_GET_STATISTICS_RSP
2463 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2464
2465 mmhMsg.bodyptr = stats;
2466 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002467 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2469
2470 return;
2471
2472} /*** end limSendSmePEStatisticsRsp() ***/
2473
2474
2475void
2476limSendSmeIBSSPeerInd(
2477 tpAniSirGlobal pMac,
2478 tSirMacAddr peerMacAddr,
2479 tANI_U16 staIndex,
2480 tANI_U8 ucastIdx,
2481 tANI_U8 bcastIdx,
2482 tANI_U8 *beacon,
2483 tANI_U16 beaconLen,
2484 tANI_U16 msgType,
2485 tANI_U8 sessionId)
2486{
2487 tSirMsgQ mmhMsg;
2488 tSmeIbssPeerInd *pNewPeerInd;
2489
Jeff Johnson43971f52012-07-17 12:26:56 -07002490 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 palAllocateMemory(pMac->hHdd,(void * *) &pNewPeerInd,(sizeof(tSmeIbssPeerInd) + beaconLen)))
2492 {
2493 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2494 return;
2495 }
2496
2497 palZeroMemory(pMac->hHdd, (void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen));
2498
2499 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewPeerInd->peerAddr,
2500 peerMacAddr, sizeof(tSirMacAddr));
2501 pNewPeerInd->staId= staIndex;
2502 pNewPeerInd->ucastSig = ucastIdx;
2503 pNewPeerInd->bcastSig = bcastIdx;
2504 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2505 pNewPeerInd->mesgType = msgType;
2506 pNewPeerInd->sessionId = sessionId;
2507
2508 if ( beacon != NULL )
2509 {
2510 palCopyMemory(pMac->hHdd, (void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)), (void*)beacon, beaconLen);
2511 }
2512
2513 mmhMsg.type = msgType;
2514// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2515 mmhMsg.bodyptr = pNewPeerInd;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002516 MTRACE(macTraceMsgTx(pMac, sessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2518
2519}
2520
2521
2522/** -----------------------------------------------------------------
2523 \brief limSendExitBmpsInd() - sends exit bmps indication
2524
2525 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2526 code to SME. This will trigger SME to get out of BMPS mode.
2527
2528 \param pMac - global mac structure
2529 \param reasonCode - reason for which PE wish to exit BMPS
2530 \return none
2531 \sa
2532 ----------------------------------------------------------------- */
2533void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2534{
2535 tSirMsgQ mmhMsg;
2536 tANI_U16 msgLen = 0;
2537 tpSirSmeExitBmpsInd pExitBmpsInd;
2538
2539 msgLen = sizeof(tSirSmeExitBmpsInd);
2540 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsInd, msgLen ))
2541 {
2542 limLog(pMac, LOGP, FL("palAllocateMemory failed for PMC_EXIT_BMPS_IND \n"));
2543 return;
2544 }
2545 palZeroMemory(pMac->hHdd, pExitBmpsInd, msgLen);
2546
2547#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
2548 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgType, eWNI_PMC_EXIT_BMPS_IND);
2549 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgLen, msgLen);
2550#else
2551 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2552 pExitBmpsInd->mesgLen = msgLen;
2553#endif
2554 pExitBmpsInd->exitBmpsReason = reasonCode;
2555 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2556
2557 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2558 mmhMsg.bodyptr = pExitBmpsInd;
2559 mmhMsg.bodyval = 0;
2560
2561 PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002562 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002563#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2564 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2565#endif //FEATURE_WLAN_DIAG_SUPPORT
2566
2567 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2568 return;
2569
2570} /*** end limSendExitBmpsInd() ***/
2571
2572
2573
2574
2575/*--------------------------------------------------------------------------
2576 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2577
2578
2579 \param pMac - pointer to global adapter context
2580 \param sessionId - Message pointer.
2581
2582 \sa
2583 --------------------------------------------------------------------------*/
2584
2585void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2586{
2587 tpPESession psessionEntry;
2588 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2589 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2590 {
2591 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
2592 return;
2593 }
2594 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2595 {
2596 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2597 }
2598 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2599 {
2600 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2601 }
2602
2603 else
2604 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2605
2606}
2607
2608#ifdef WLAN_FEATURE_VOWIFI_11R
2609/** -----------------------------------------------------------------
2610 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2611 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2612 \ SME only looks at rc and tspec field.
2613 \param pMac - global mac structure
2614 \param rspReqd - is SmeAddTsRsp required
2615 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2616 \return tspec
2617 \sa
2618 ----------------------------------------------------------------- */
2619void
2620limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2621 tANI_U8 smesessionId)
2622{
2623 tSirMsgQ mmhMsg;
2624
2625 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2626 mmhMsg.bodyptr = aggrQosRsp;
2627 mmhMsg.bodyval = 0;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002628 MTRACE(macTraceMsgTx(pMac, smesessionId , mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2630
2631 return;
2632}
2633#endif
2634
2635/** -----------------------------------------------------------------
2636 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2637 before switching channels for spectrum manangement.
2638
2639 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2640
2641 \param pMac - global mac structure
2642 \return none
2643 \sa
2644 ----------------------------------------------------------------- */
2645void
2646limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2647{
2648 tSirMsgQ mmhMsg;
2649
2650 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2651 mmhMsg.bodyptr = NULL;
2652 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002653 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2655
2656 return;
2657}
2658
2659/** -----------------------------------------------------------------
2660 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2661 after channel switch for spectrum manangement is complete.
2662
2663 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2664
2665 \param pMac - global mac structure
2666 \return none
2667 \sa
2668 ----------------------------------------------------------------- */
2669void
2670limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2671{
2672 tSirMsgQ mmhMsg;
2673
2674 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2675 mmhMsg.bodyptr = NULL;
2676 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002677 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2679
2680 return;
2681}
2682
2683void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2684 tANI_U8 smesessionId)
2685{
2686 tSirMsgQ mmhMsg;
2687 tSmeMaxAssocInd *pSmeMaxAssocInd;
2688
Jeff Johnson43971f52012-07-17 12:26:56 -07002689 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 palAllocateMemory(pMac->hHdd,(void **)&pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd)))
2691 {
2692 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2693 return;
2694 }
2695 palZeroMemory(pMac->hHdd, (void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd));
2696 palCopyMemory( pMac->hHdd, (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2697 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
2698 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2699 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2700 pSmeMaxAssocInd->sessionId = smesessionId;
2701 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2702 mmhMsg.bodyptr = pSmeMaxAssocInd;
2703 PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
2704 "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
2705 peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08002706 MTRACE(macTraceMsgTx(pMac, smesessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2708
2709 return;
2710}