blob: 1ceed6b8409a6a39f4f1028322d215c53adf4f01 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. 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
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 }
398 }
399
400
401 pSirSmeJoinRsp->messageType = msgType;
402 pSirSmeJoinRsp->length = (tANI_U16) rspLen;
403 pSirSmeJoinRsp->statusCode = resultCode;
404 pSirSmeJoinRsp->protStatusCode = protStatusCode;
405
406 /* Update SME session ID and transaction Id */
407 pSirSmeJoinRsp->sessionId = smesessionId;
408 pSirSmeJoinRsp->transactionId = smetransactionId;
409
410 if(IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
411 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700412 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
414 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700415
416#ifdef WLAN_FEATURE_11AC
417 if (psessionEntry->vhtCapability)
418 {
419 /*Get 11ac cbState from 11n cbState*/
420 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
421 psessionEntry->currentOperChannel,
422 psessionEntry->htSecondaryChannelOffset);
423 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
424 }
425 else {
426#endif
427 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
428 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 }
430 else
431 {
432 peSetResumeChannel( pMac, 0, 0);
433 }
434 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
435 (tANI_U32*) pSirSmeJoinRsp );
436 }
437 else
438 {
439 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
440 (tANI_U32*) pSirSmeJoinRsp );
441 }
442} /*** end limSendSmeJoinReassocRsp() ***/
443
444
445
446/**
447 * limSendSmeStartBssRsp()
448 *
449 *FUNCTION:
450 * This function is called to send eWNI_SME_START_BSS_RSP
451 * message to applications above MAC Software.
452 *
453 *PARAMS:
454 *
455 *LOGIC:
456 *
457 *ASSUMPTIONS:
458 * NA
459 *
460 *NOTE:
461 * NA
462 *
463 * @param pMac Pointer to Global MAC structure
464 * @param msgType Indicates message type
465 * @param resultCode Indicates the result of previously issued
466 * eWNI_SME_msgType_REQ message
467 *
468 * @return None
469 */
470
471void
472limSendSmeStartBssRsp(tpAniSirGlobal pMac,
473 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
474 tANI_U8 smesessionId,tANI_U16 smetransactionId)
475{
476
477
478 tANI_U16 size = 0;
479 tSirMsgQ mmhMsg;
480 tSirSmeStartBssRsp *pSirSmeRsp;
481 tANI_U16 ieLen;
482 tANI_U16 ieOffset, curLen;
483
484 PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s\n"),
485 limMsgStr(msgType), limResultCodeStr(resultCode));)
486
487 size = sizeof(tSirSmeStartBssRsp);
488
489 if(psessionEntry == NULL)
490 {
491
492 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
493 {
494 /// Buffer not available. Log error
495 limLog(pMac, LOGP,FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
496 return;
497 }
498 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
499
500 }
501 else
502 {
503 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
504 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
505 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
506 //calculate the memory size to allocate
507 size += ieLen;
508
509 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
510 {
511 /// Buffer not available. Log error
512 limLog(pMac, LOGP,
513 FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
514
515 return;
516 }
517 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
518 size = sizeof(tSirSmeStartBssRsp);
519 if (resultCode == eSIR_SME_SUCCESS)
520 {
521
522 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
523
524 /* Read beacon interval from session */
525 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
526 pSirSmeRsp->bssType = psessionEntry->bssType;
527
528 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
529 != eSIR_SUCCESS)
530 limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
531
532 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
533
534#if 0
535 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
536 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG\n"));
537
538#endif// TO SUPPORT BT-AMP
539
540 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
541
542 pSirSmeRsp->bssDescription.aniIndicator = 1;
543
544 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
545 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
546 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
547 (tANI_U32)curLen);
548
549 palCopyMemory( pMac->hHdd, ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
550 pMac->sch.schObject.gSchBeaconFrameEnd,
551 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
552
553
554 //subtracting size of length indicator itself and size of pointer to ieFields
555 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
556 sizeof(tANI_U16) - sizeof(tANI_U32) +
557 ieLen;
558 //This is the size of the message, subtracting the size of the pointer to ieFields
559 size += ieLen - sizeof(tANI_U32);
560 }
561
562
563
564#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
565 sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
566 sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, size);
567
568#endif
569
570 }
571
572 pSirSmeRsp->messageType = msgType;
573 pSirSmeRsp->length = size;
574
575 /* Update SME session Id and transaction Id */
576 pSirSmeRsp->sessionId = smesessionId;
577 pSirSmeRsp->transactionId = smetransactionId;
578 pSirSmeRsp->statusCode = resultCode;
579#ifdef WLAN_SOFTAP_FEATURE
580 if(psessionEntry != NULL )
581 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
582
583#endif
584
585 mmhMsg.type = msgType;
586 mmhMsg.bodyptr = pSirSmeRsp;
587 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700588 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700589
590#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
591 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
592#endif //FEATURE_WLAN_DIAG_SUPPORT
593
594 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
595} /*** end limSendSmeStartBssRsp() ***/
596
597
598
599
600
601#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
602#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
603
604
605/**
606 * limSendSmeScanRsp()
607 *
608 *FUNCTION:
609 * This function is called by limProcessSmeReqMessages() to send
610 * eWNI_SME_SCAN_RSP message to applications above MAC
611 * Software.
612 *
613 *PARAMS:
614 *
615 *LOGIC:
616 *
617 *ASSUMPTIONS:
618 * NA
619 *
620 *NOTE:
621 * NA
622 *
623 * @param pMac Pointer to Global MAC structure
624 * @param length Indicates length of message
625 * @param resultCode Indicates the result of previously issued
626 * eWNI_SME_SCAN_REQ message
627 *
628 * @return None
629 */
630
631void
632limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
633 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
634{
635 tSirMsgQ mmhMsg;
636 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
637 tLimScanResultNode *ptemp = NULL;
638 tANI_U16 msgLen, allocLength, curMsgLen = 0;
639 tANI_U16 i, bssCount;
640 tANI_U8 *pbBuf;
641 tSirBssDescription *pDesc;
642
643 PELOG1(limLog(pMac, LOG1,
644 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
645 length, limResultCodeStr(resultCode));)
646
647 if (resultCode != eSIR_SME_SUCCESS)
648 {
649 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
650 return;
651 }
652
653 mmhMsg.type = eWNI_SME_SCAN_RSP;
654 i = 0;
655 bssCount = 0;
656 msgLen = 0;
657 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
658 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
659 {
660 // Log error
661 limLog(pMac, LOGP,
662 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
663
664 return;
665 }
666 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
667 {
668 //when ptemp is not NULL it is a left over
669 ptemp = pMac->lim.gLimCachedScanHashTable[i];
670 while(ptemp)
671 {
672 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
673 if(0 == bssCount)
674 {
675 msgLen = sizeof(tSirSmeScanRsp) -
676 sizeof(tSirBssDescription) +
677 ptemp->bssDescription.length +
678 sizeof(ptemp->bssDescription.length);
679 pDesc = pSirSmeScanRsp->bssDescription;
680 }
681 else
682 {
683 msgLen += ptemp->bssDescription.length +
684 sizeof(ptemp->bssDescription.length);
685 pDesc = (tSirBssDescription *)pbBuf;
686 }
687 if( (allocLength < msgLen) ||
688 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
689 {
690 pSirSmeScanRsp->statusCode =
691 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
692#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
693 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
694 eWNI_SME_SCAN_RSP);
695 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
696#else
697 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
698 pSirSmeScanRsp->length = curMsgLen;
699#endif
700 mmhMsg.bodyptr = pSirSmeScanRsp;
701 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700702 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700703 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
704 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
705 {
706 // Log error
707 limLog(pMac, LOGP,
708 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
709 return;
710 }
711 msgLen = sizeof(tSirSmeScanRsp) -
712 sizeof(tSirBssDescription) +
713 ptemp->bssDescription.length +
714 sizeof(ptemp->bssDescription.length);
715 pDesc = pSirSmeScanRsp->bssDescription;
716 bssCount = 1;
717 }
718 curMsgLen = msgLen;
719
720 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
721 msgLen, ptemp->bssDescription.length);)
722#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
723 sirStoreU16N((tANI_U8*)&pDesc->length,
724 ptemp->bssDescription.length);
725#else
726 pDesc->length
727 = ptemp->bssDescription.length;
728#endif
729 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pDesc->bssId,
730 (tANI_U8 *) &ptemp->bssDescription.bssId,
731 ptemp->bssDescription.length);
732
733 PELOG2(limLog(pMac, LOG2, FL("BssId "));
734 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
735
736 pSirSmeScanRsp->sessionId = smesessionId;
737 pSirSmeScanRsp->transcationId = smetranscationId;
738
739 ptemp = ptemp->next;
740 } //while(ptemp)
741 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
742
743 if(0 == bssCount)
744 {
745 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700746 if (NULL != pSirSmeScanRsp)
747 {
748 palFreeMemory( pMac->hHdd, pSirSmeScanRsp);
749 pSirSmeScanRsp = NULL;
750 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 }
752 else
753 {
754 // send last message
755 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
756#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
757 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
758 eWNI_SME_SCAN_RSP);
759 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
760#else
761 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
762 pSirSmeScanRsp->length = curMsgLen;
763#endif
764
765 /* Update SME session Id and SME transcation Id */
766 pSirSmeScanRsp->sessionId = smesessionId;
767 pSirSmeScanRsp->transcationId = smetranscationId;
768
769 mmhMsg.type = eWNI_SME_SCAN_RSP;
770 mmhMsg.bodyptr = pSirSmeScanRsp;
771 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700772 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
774 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
775 }
776
777 return;
778
779} /*** end limSendSmeScanRsp() ***/
780
781
782/**
783 * limPostSmeScanRspMessage()
784 *
785 *FUNCTION:
786 * This function is called by limSendSmeScanRsp() to send
787 * eWNI_SME_SCAN_RSP message with failed result code
788 *
789 *NOTE:
790 * NA
791 *
792 * @param pMac Pointer to Global MAC structure
793 * @param length Indicates length of message
794 * @param resultCode failed result code
795 *
796 * @return None
797 */
798
799void
800limPostSmeScanRspMessage(tpAniSirGlobal pMac,
801 tANI_U16 length,
802 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
803{
804 tpSirSmeScanRsp pSirSmeScanRsp;
805 tSirMsgQ mmhMsg;
806
807 PELOG1(limLog(pMac, LOG1,
808 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). \n"),
809 length, limResultCodeStr(resultCode));)
810
811 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, length))
812 {
813 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
814 return;
815 }
816 palZeroMemory(pMac->hHdd, (void*)pSirSmeScanRsp, length);
817
818#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
819 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType, eWNI_SME_SCAN_RSP);
820 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, length);
821#else
822 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
823 pSirSmeScanRsp->length = length;
824#endif
825
826 if(sizeof(tSirSmeScanRsp) <= length)
827 {
828 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
829 }
830
831 pSirSmeScanRsp->statusCode = resultCode;
832
833 /*Update SME session Id and transaction Id */
834 pSirSmeScanRsp->sessionId = smesessionId;
835 pSirSmeScanRsp->transcationId = smetransactionId;
836
837 mmhMsg.type = eWNI_SME_SCAN_RSP;
838 mmhMsg.bodyptr = pSirSmeScanRsp;
839 mmhMsg.bodyval = 0;
840
Jeff Johnsone7245742012-09-05 17:12:55 -0700841 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700842#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
843 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
844#endif //FEATURE_WLAN_DIAG_SUPPORT
845
846 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
847 return;
848
849} /*** limPostSmeScanRspMessage ***/
850
Jeff Johnsone7245742012-09-05 17:12:55 -0700851#ifdef FEATURE_OEM_DATA_SUPPORT
852
853/**
854 * limSendSmeOemDataRsp()
855 *
856 *FUNCTION:
857 * This function is called by limProcessSmeReqMessages() to send
858 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
859 * Software.
860 *
861 *PARAMS:
862 *
863 *LOGIC:
864 *
865 *ASSUMPTIONS:
866 * NA
867 *
868 *NOTE:
869 * NA
870 *
871 * @param pMac Pointer to Global MAC structure
872 * @param pMsgBuf Indicates the mlm message
873 * @param resultCode Indicates the result of previously issued
874 * eWNI_SME_OEM_DATA_RSP message
875 *
876 * @return None
877 */
878
879void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
880{
881 tSirMsgQ mmhMsg;
882 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
883 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
884 tANI_U16 msgLength;
885
886
887 //get the pointer to the mlm message
888 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
889
890 msgLength = sizeof(tSirOemDataRsp);
891
892 //now allocate memory for the char buffer
893 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pSirSmeOemDataRsp, msgLength))
894 {
895 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSirSmeOemDataRsp\n"));
896 return;
897 }
898
899#if defined (ANI_LITTLE_BYTE_ENDIAN)
900 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
901 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
902#else
903 pSirSmeOemDataRsp->length = msgLength;
904 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
905#endif
906
907 palCopyMemory(pMac->hHdd, pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
908
909 //Now free the memory from MLM Rsp Message
910 palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
911
912 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
913 mmhMsg.bodyptr = pSirSmeOemDataRsp;
914 mmhMsg.bodyval = 0;
915
916 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
917
918 return;
919} /*** limSendSmeOemDataRsp ***/
920
921#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700922
923
924/**
925 * limSendSmeAuthRsp()
926 *
927 *FUNCTION:
928 * This function is called by limProcessSmeMessages() to send
929 * eWNI_SME_AUTH_RSP message to host
930 *
931 *PARAMS:
932 *
933 *LOGIC:
934 *
935 *ASSUMPTIONS:
936 * NA
937 *
938 *NOTE:
939 * NA
940 *
941 * @param pMac Pointer to Global MAC structure
942 * @param statusCode Indicates the result of previously issued
943 * eWNI_SME_AUTH_REQ message
944 *
945 * @return None
946 */
947void
948limSendSmeAuthRsp(tpAniSirGlobal pMac,
949 tSirResultCodes statusCode,
950 tSirMacAddr peerMacAddr,
951 tAniAuthType authType,
952 tANI_U16 protStatusCode,
953 tpPESession psessionEntry,tANI_U8 smesessionId,
954 tANI_U16 smetransactionId)
955{
956#if 0
957 tSirMsgQ mmhMsg;
958 tSirSmeAuthRsp *pSirSmeAuthRsp;
959
960
961 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthRsp, sizeof(tSirSmeAuthRsp)))
962 {
963 // Log error
964 limLog(pMac, LOGP,
965 FL("call to palAllocateMemory failed for eWNI_SME_AUTH_RSP\n"));
966
967 return;
968 }
969
970#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
971 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->messageType, eWNI_SME_AUTH_RSP);
972 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->length, sizeof(tSirSmeAuthRsp));
973
974#endif
975
976
977 if(psessionEntry != NULL)
978 {
979 palCopyMemory( pMac->hHdd, (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
980 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
981 pSirSmeAuthRsp->authType = authType;
982
983 }
984
985 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
986 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
987 pSirSmeAuthRsp->statusCode = statusCode;
988 pSirSmeAuthRsp->protStatusCode = protStatusCode;
989
990 /* Update SME session and transaction Id*/
991 pSirSmeAuthRsp->sessionId = smesessionId;
992 pSirSmeAuthRsp->transactionId = smetransactionId;
993
994 mmhMsg.type = eWNI_SME_AUTH_RSP;
995 mmhMsg.bodyptr = pSirSmeAuthRsp;
996 mmhMsg.bodyval = 0;
997 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
998 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
999#endif
1000} /*** end limSendSmeAuthRsp() ***/
1001
1002
1003void limSendSmeDisassocDeauthNtfPostResume( tpAniSirGlobal pMac,
1004 eHalStatus status, tANI_U32 *pCtx )
1005{
1006 tSirMsgQ mmhMsg;
1007 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1008
1009 mmhMsg.type = pMsg->type;
1010 mmhMsg.bodyptr = pMsg;
1011 mmhMsg.bodyval = 0;
1012
Jeff Johnsone7245742012-09-05 17:12:55 -07001013 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001014
1015 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1016}
1017/**
1018 * limSendSmeDisassocNtf()
1019 *
1020 *FUNCTION:
1021 * This function is called by limProcessSmeMessages() to send
1022 * eWNI_SME_DISASSOC_RSP/IND message to host
1023 *
1024 *PARAMS:
1025 *
1026 *LOGIC:
1027 *
1028 *ASSUMPTIONS:
1029 * NA
1030 *
1031 *NOTE:
1032 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1033 * or eWNI_SME_DISASSOC_IND to host depending on
1034 * disassociation trigger.
1035 *
1036 * @param peerMacAddr Indicates the peer MAC addr to which
1037 * disassociate was initiated
1038 * @param reasonCode Indicates the reason for Disassociation
1039 * @param disassocTrigger Indicates the trigger for Disassociation
1040 * @param aid Indicates the STAID. This parameter is
1041 * present only on AP.
1042 *
1043 * @return None
1044 */
1045void
1046limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1047 tSirMacAddr peerMacAddr,
1048 tSirResultCodes reasonCode,
1049 tANI_U16 disassocTrigger,
1050 tANI_U16 aid,
1051 tANI_U8 smesessionId,
1052 tANI_U16 smetransactionId,
1053 tpPESession psessionEntry)
1054{
1055
1056 tANI_U8 *pBuf;
1057 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1058 tSirSmeDisassocInd *pSirSmeDisassocInd;
1059 tANI_U32 *pMsg;
1060
1061 switch (disassocTrigger)
1062 {
1063 case eLIM_PEER_ENTITY_DISASSOC:
1064 return;
1065
1066 case eLIM_HOST_DISASSOC:
1067 /**
1068 * Disassociation response due to
1069 * host triggered disassociation
1070 */
1071
1072 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocRsp, sizeof(tSirSmeDisassocRsp)))
1073 {
1074 // Log error
1075 limLog(pMac, LOGP,
1076 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_RSP\n"));
1077
1078 return;
1079 }
1080
1081#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1082 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->messageType,
1083 eWNI_SME_DISASSOC_RSP);
1084 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->length,
1085 sizeof(tSirSmeDisassocRsp));
1086#else
1087 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1088 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
1089#endif
1090 //sessionId
1091 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1092 *pBuf = smesessionId;
1093 pBuf++;
1094
1095 //transactionId
1096 limCopyU16(pBuf, smetransactionId);
1097 pBuf += sizeof(tANI_U16);
1098
1099 //statusCode
1100 limCopyU32(pBuf, reasonCode);
1101 pBuf += sizeof(tSirResultCodes);
1102
1103 //peerMacAddr
1104 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1105 pBuf += sizeof(tSirMacAddr);
1106
1107#if (WNI_POLARIS_FW_PRODUCT == AP)
1108 limCopyU16(pBuf, aid);
1109 pBuf += sizeof(tANI_U16);
1110
1111 // perStaStats
1112 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1113#else
1114 // Clear Station Stats
1115 //for sta, it is always 1, IBSS is handled at halInitSta
1116
1117#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1118
1119
1120#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1121 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1122 psessionEntry, (tANI_U16)reasonCode, 0);
1123#endif
1124 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1125 break;
1126
1127 default:
1128 /**
1129 * Disassociation indication due to Disassociation
1130 * frame reception from peer entity or due to
1131 * loss of link with peer entity.
1132 */
1133 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1134 {
1135 // Log error
1136 limLog(pMac, LOGP,
1137 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1138
1139 return;
1140 }
1141
1142#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1143 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType,
1144 eWNI_SME_DISASSOC_IND);
1145 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length,
1146 sizeof(tSirSmeDisassocInd));
1147#else
1148 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1149 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1150
1151 /* Update SME session Id and Transaction Id */
1152 pSirSmeDisassocInd->sessionId = smesessionId;
1153 pSirSmeDisassocInd->transactionId = smetransactionId;
1154#endif
1155 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1156
1157 limCopyU32(pBuf, reasonCode);
1158 pBuf += sizeof(tSirResultCodes);
1159
1160 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1161 pBuf += sizeof(tSirMacAddr);
1162
1163 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1164#if (WNI_POLARIS_FW_PRODUCT == AP)
1165 pBuf += sizeof(tSirMacAddr);
1166 limCopyU16(pBuf, aid);
1167 pBuf += sizeof(tANI_U16);
1168
1169 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1170
1171#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1172
1173
1174#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1175 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1176 psessionEntry, (tANI_U16)reasonCode, 0);
1177#endif
1178 pMsg = (tANI_U32*) pSirSmeDisassocInd;
1179#if (WNI_POLARIS_FW_PRODUCT == AP)
1180 PELOG1(limLog(pMac, LOG1,
1181 FL("*** Sending DisAssocInd staId=%d, reasonCode=%d ***\n"),
1182 aid, reasonCode);)
1183#endif
1184
1185 break;
1186 }
1187
1188 /* Delete the PE session Created */
1189 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1190 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1191 {
1192 peDeleteSession(pMac,psessionEntry);
1193 }
1194
1195 if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
1196 {
1197 //Resume on the first active session channel.
Jeff Johnsone7245742012-09-05 17:12:55 -07001198 tANI_U8 resumeChannel;
1199 ePhyChanBondState resumePhyCbState;
1200 peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
1201 peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
Jeff Johnson295189b2012-06-20 16:38:30 -07001202
1203 limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
1204 (tANI_U32*) pMsg );
1205 }
1206 else
1207 {
1208 limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
1209 (tANI_U32*) pMsg );
1210 }
1211} /*** end limSendSmeDisassocNtf() ***/
1212
1213
1214/** -----------------------------------------------------------------
1215 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1216
1217 After receiving disassociation frame from peer entity, this
1218 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1219 reason code.
1220
1221 \param pMac - global mac structure
1222 \param pStaDs - station dph hash node
1223 \return none
1224 \sa
1225 ----------------------------------------------------------------- */
1226void
1227limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1228{
1229 tSirMsgQ mmhMsg;
1230 tSirSmeDisassocInd *pSirSmeDisassocInd;
1231
1232 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1233 {
1234 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1235 return;
1236 }
1237
1238 //psessionEntry = peFindSessionByBssid(pMac,pStaDs->staAddr,&sessionId);
1239#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1240 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType, eWNI_SME_DISASSOC_IND);
1241 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length, sizeof(tSirSmeDisassocInd));
1242#else
1243 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1244 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1245#endif
1246
1247#if 0 //Commenting out all the serialization
1248 //statusCode
1249 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1250 limCopyU32(pBuf, pStaDs->mlmStaContext.disassocReason);
1251 pBuf += sizeof(tSirResultCodes);
1252
1253 //peerMacAddr
1254 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1255
1256#ifdef ANI_PRODUCT_TYPE_AP
1257 pBuf += sizeof(tSirMacAddr);
1258 //aid
1259 limCopyU16(pBuf, pStaDs->assocId);
1260 pBuf += sizeof(tANI_U16);
1261
1262 //perStaStats
1263 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat, pBuf);
1264#endif
1265#endif
1266 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1267 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1268 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
1269
1270 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
1271
1272 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->peerMacAddr , pStaDs->staAddr, sizeof(tSirMacAddr));
1273
1274#ifdef ANI_PRODUCT_TYPE_AP
1275 pSirSmeDisassocInd->aid = pStaDs->assocId;
1276 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat,(tANI_U8*)&pSirSmeDisassocInd-> perStaStats );
1277#endif
1278#ifdef WLAN_SOFTAP_FEATURE
1279 pSirSmeDisassocInd->staId = pStaDs->staIndex;
1280#endif
1281
1282 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1283 mmhMsg.bodyptr = pSirSmeDisassocInd;
1284 mmhMsg.bodyval = 0;
1285
Jeff Johnsone7245742012-09-05 17:12:55 -07001286 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1288 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1289#endif //FEATURE_WLAN_DIAG_SUPPORT
1290
1291 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1292
1293} /*** end limSendSmeDisassocInd() ***/
1294
1295
1296/** -----------------------------------------------------------------
1297 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1298
1299 After receiving deauthentication frame from peer entity, this
1300 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1301 reason code.
1302
1303 \param pMac - global mac structure
1304 \param pStaDs - station dph hash node
1305 \return none
1306 \sa
1307 ----------------------------------------------------------------- */
1308void
1309limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1310{
1311#ifndef WLAN_SOFTAP_FEATURE
1312 tANI_U8 *pBuf;
1313#endif
1314 tSirMsgQ mmhMsg;
1315 tSirSmeDeauthInd *pSirSmeDeauthInd;
1316
1317 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1318 {
1319 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_IND \n"));
1320 return;
1321 }
1322
1323#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1324 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType, eWNI_SME_DEAUTH_IND);
1325 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length, sizeof(tSirSmeDeauthInd));
1326#else
1327 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1328 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1329#endif
1330
1331#ifdef WLAN_SOFTAP_FEATURE
1332 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1333 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1334 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1335 {
1336 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1337 }
1338 else
1339 {
1340 //Need to indicatet he reascon code over the air
1341 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1342 }
1343 //BSSID
1344 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1345 //peerMacAddr
1346 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
1347#else
1348
1349 //sessionId
1350 pBuf = (tANI_U8 *) &pSirSmeDeauthInd->sessionId;
1351 *pBuf++ = psessionEntry->smeSessionId;
1352
1353 //transactionId
1354 limCopyU16(pBuf, 0);
1355 pBuf += sizeof(tANI_U16);
1356
1357 // status code
1358 limCopyU32(pBuf, pStaDs->mlmStaContext.cleanupTrigger);
1359 pBuf += sizeof(tSirResultCodes);
1360
1361 //bssid
1362 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1363 pBuf += sizeof(tSirMacAddr);
1364
1365 //peerMacAddr
1366 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1367#endif
1368
1369#if (WNI_POLARIS_FW_PRODUCT == AP)
1370 pBuf += sizeof(tSirMacAddr);
1371 limCopyU16(pBuf, pStaDs->staAddr);
1372#endif
1373
1374#ifdef WLAN_SOFTAP_FEATURE
1375 pSirSmeDeauthInd->staId = pStaDs->staIndex;
1376#endif
1377
1378 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1379 mmhMsg.bodyptr = pSirSmeDeauthInd;
1380 mmhMsg.bodyval = 0;
1381
Jeff Johnsone7245742012-09-05 17:12:55 -07001382 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001383#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1384 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1385#endif //FEATURE_WLAN_DIAG_SUPPORT
1386
1387 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1388 return;
1389} /*** end limSendSmeDeauthInd() ***/
1390
1391
1392/**
1393 * limSendSmeDeauthNtf()
1394 *
1395 *FUNCTION:
1396 * This function is called by limProcessSmeMessages() to send
1397 * eWNI_SME_DISASSOC_RSP/IND message to host
1398 *
1399 *PARAMS:
1400 *
1401 *LOGIC:
1402 *
1403 *ASSUMPTIONS:
1404 * NA
1405 *
1406 *NOTE:
1407 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1408 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1409 *
1410 * @param peerMacAddr Indicates the peer MAC addr to which
1411 * deauthentication was initiated
1412 * @param reasonCode Indicates the reason for Deauthetication
1413 * @param deauthTrigger Indicates the trigger for Deauthetication
1414 * @param aid Indicates the STAID. This parameter is present
1415 * only on AP.
1416 *
1417 * @return None
1418 */
1419void
1420limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1421 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1422{
1423 tANI_U8 *pBuf;
1424 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1425 tSirSmeDeauthInd *pSirSmeDeauthInd;
1426 tpPESession psessionEntry;
1427 tANI_U8 sessionId;
1428 tANI_U32 *pMsg;
1429
1430 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1431 switch (deauthTrigger)
1432 {
1433 case eLIM_PEER_ENTITY_DEAUTH:
1434 return;
1435
1436 case eLIM_HOST_DEAUTH:
1437 /**
1438 * Deauthentication response to host triggered
1439 * deauthentication.
1440 */
1441 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthRsp, sizeof(tSirSmeDeauthRsp)))
1442 {
1443 // Log error
1444 limLog(pMac, LOGP,
1445 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_RSP\n"));
1446
1447 return;
1448 }
1449
1450#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1451 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->messageType),
1452 eWNI_SME_DEAUTH_RSP);
1453 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->length),
1454 sizeof(tSirSmeDeauthRsp));
1455#else
1456 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1457 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
1458#endif
1459 pSirSmeDeauthRsp->statusCode = reasonCode;
1460 pSirSmeDeauthRsp->sessionId = smesessionId;
1461 pSirSmeDeauthRsp->transactionId = smetransactionId;
1462
1463 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
1464 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1465
1466#if (WNI_POLARIS_FW_PRODUCT == AP)
1467 pBuf += sizeof(tSirMacAddr);
1468 limCopyU16(pBuf, aid);
1469#endif
1470#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1471 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1472 psessionEntry, 0, (tANI_U16)reasonCode);
1473#endif
1474 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1475
1476 break;
1477
1478 default:
1479 /**
1480 * Deauthentication indication due to Deauthentication
1481 * frame reception from peer entity or due to
1482 * loss of link with peer entity.
1483 */
1484 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1485 {
1486 // Log error
1487 limLog(pMac, LOGP,
1488 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_Ind\n"));
1489
1490 return;
1491 }
1492
1493#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1494 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType,
1495 eWNI_SME_DEAUTH_IND);
1496 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length,
1497 sizeof(tSirSmeDeauthInd));
1498#else
1499 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1500 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1501#endif
1502
1503 // sessionId
1504 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1505 *pBuf++ = smesessionId;
1506
1507 //transaction ID
1508 limCopyU16(pBuf, smetransactionId);
1509 pBuf += sizeof(tANI_U16);
1510
1511 // status code
1512 limCopyU32(pBuf, reasonCode);
1513 pBuf += sizeof(tSirResultCodes);
1514
1515 //bssId
1516 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1517 pBuf += sizeof(tSirMacAddr);
1518
1519 //peerMacAddr
1520 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
1521
1522#if (WNI_POLARIS_FW_PRODUCT == AP)
1523 pBuf += sizeof(tSirMacAddr);
1524 limCopyU16(pBuf, aid);
1525#endif
1526#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1527 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1528 psessionEntry, 0, (tANI_U16)reasonCode);
1529#endif //FEATURE_WLAN_DIAG_SUPPORT
1530 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1531
1532 break;
1533 }
1534
1535 /*Delete the PE session created */
1536 if(psessionEntry != NULL)
1537 {
1538 peDeleteSession(pMac,psessionEntry);
1539 }
1540
1541 if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
1542 {
1543 //Resume on the first active session channel.
Jeff Johnsone7245742012-09-05 17:12:55 -07001544 tANI_U8 resumeChannel;
1545 ePhyChanBondState resumePhyCbState;
1546 peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
1547 peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
Jeff Johnson295189b2012-06-20 16:38:30 -07001548
1549 limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
1550 (tANI_U32*) pMsg );
1551 }
1552 else
1553 {
1554 limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
1555 (tANI_U32*) pMsg );
1556 }
1557} /*** 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}