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