blob: d7050dd89811666e8cfb22da5520029e1a388fd9 [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 }
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 {
412 if( psessionEntry && psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE )
413 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700414
415#ifdef WLAN_FEATURE_11AC
416 if (psessionEntry->vhtCapability)
417 {
Jeff Johnson32d95a32012-09-10 13:15:23 -0700418 ePhyChanBondState htSecondaryChannelOffset;
Jeff Johnsone7245742012-09-05 17:12:55 -0700419 /*Get 11ac cbState from 11n cbState*/
420 htSecondaryChannelOffset = limGet11ACPhyCBState(pMac,
421 psessionEntry->currentOperChannel,
422 psessionEntry->htSecondaryChannelOffset);
423 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, htSecondaryChannelOffset);
424 }
Jeff Johnson32d95a32012-09-10 13:15:23 -0700425 else
Jeff Johnsone7245742012-09-05 17:12:55 -0700426#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -0700427 peSetResumeChannel( pMac, psessionEntry->currentOperChannel, psessionEntry->htSecondaryChannelOffset);
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 }
429 else
430 {
431 peSetResumeChannel( pMac, 0, 0);
432 }
433 limResumeLink( pMac, limSendSmeJoinReassocRspAfterResume,
434 (tANI_U32*) pSirSmeJoinRsp );
435 }
436 else
437 {
438 limSendSmeJoinReassocRspAfterResume( pMac, eHAL_STATUS_SUCCESS,
439 (tANI_U32*) pSirSmeJoinRsp );
440 }
441} /*** end limSendSmeJoinReassocRsp() ***/
442
443
444
445/**
446 * limSendSmeStartBssRsp()
447 *
448 *FUNCTION:
449 * This function is called to send eWNI_SME_START_BSS_RSP
450 * message to applications above MAC Software.
451 *
452 *PARAMS:
453 *
454 *LOGIC:
455 *
456 *ASSUMPTIONS:
457 * NA
458 *
459 *NOTE:
460 * NA
461 *
462 * @param pMac Pointer to Global MAC structure
463 * @param msgType Indicates message type
464 * @param resultCode Indicates the result of previously issued
465 * eWNI_SME_msgType_REQ message
466 *
467 * @return None
468 */
469
470void
471limSendSmeStartBssRsp(tpAniSirGlobal pMac,
472 tANI_U16 msgType, tSirResultCodes resultCode,tpPESession psessionEntry,
473 tANI_U8 smesessionId,tANI_U16 smetransactionId)
474{
475
476
477 tANI_U16 size = 0;
478 tSirMsgQ mmhMsg;
479 tSirSmeStartBssRsp *pSirSmeRsp;
480 tANI_U16 ieLen;
481 tANI_U16 ieOffset, curLen;
482
483 PELOG1(limLog(pMac, LOG1, FL("Sending message %s with reasonCode %s\n"),
484 limMsgStr(msgType), limResultCodeStr(resultCode));)
485
486 size = sizeof(tSirSmeStartBssRsp);
487
488 if(psessionEntry == NULL)
489 {
490
491 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
492 {
493 /// Buffer not available. Log error
494 limLog(pMac, LOGP,FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
495 return;
496 }
497 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
498
499 }
500 else
501 {
502 //subtract size of beaconLength + Mac Hdr + Fixed Fields before SSID
503 ieOffset = sizeof(tAniBeaconStruct) + SIR_MAC_B_PR_SSID_OFFSET;
504 ieLen = pMac->sch.schObject.gSchBeaconOffsetBegin + pMac->sch.schObject.gSchBeaconOffsetEnd - ieOffset;
505 //calculate the memory size to allocate
506 size += ieLen;
507
508 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, size))
509 {
510 /// Buffer not available. Log error
511 limLog(pMac, LOGP,
512 FL("call to palAllocateMemory failed for eWNI_SME_START_BSS_RSP\n"));
513
514 return;
515 }
516 palZeroMemory(pMac, (tANI_U8*)pSirSmeRsp, size);
517 size = sizeof(tSirSmeStartBssRsp);
518 if (resultCode == eSIR_SME_SUCCESS)
519 {
520
521 sirCopyMacAddr(pSirSmeRsp->bssDescription.bssId, psessionEntry->bssId);
522
523 /* Read beacon interval from session */
524 pSirSmeRsp->bssDescription.beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
525 pSirSmeRsp->bssType = psessionEntry->bssType;
526
527 if (cfgGetCapabilityInfo( pMac, &pSirSmeRsp->bssDescription.capabilityInfo,psessionEntry)
528 != eSIR_SUCCESS)
529 limLog(pMac, LOGP, FL("could not retrieve Capabilities value\n"));
530
531 limGetPhyMode(pMac, (tANI_U32 *)&pSirSmeRsp->bssDescription.nwType, psessionEntry);
532
533#if 0
534 if (wlan_cfgGetInt(pMac, WNI_CFG_CURRENT_CHANNEL, &len) != eSIR_SUCCESS)
535 limLog(pMac, LOGP, FL("could not retrieve CURRENT_CHANNEL from CFG\n"));
536
537#endif// TO SUPPORT BT-AMP
538
539 pSirSmeRsp->bssDescription.channelId = psessionEntry->currentOperChannel;
540
541 pSirSmeRsp->bssDescription.aniIndicator = 1;
542
543 curLen = pMac->sch.schObject.gSchBeaconOffsetBegin - ieOffset;
544 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields,
545 pMac->sch.schObject.gSchBeaconFrameBegin + ieOffset,
546 (tANI_U32)curLen);
547
548 palCopyMemory( pMac->hHdd, ((tANI_U8 *) &pSirSmeRsp->bssDescription.ieFields) + curLen,
549 pMac->sch.schObject.gSchBeaconFrameEnd,
550 (tANI_U32)pMac->sch.schObject.gSchBeaconOffsetEnd);
551
552
553 //subtracting size of length indicator itself and size of pointer to ieFields
554 pSirSmeRsp->bssDescription.length = sizeof(tSirBssDescription) -
555 sizeof(tANI_U16) - sizeof(tANI_U32) +
556 ieLen;
557 //This is the size of the message, subtracting the size of the pointer to ieFields
558 size += ieLen - sizeof(tANI_U32);
559 }
560
561
562
563#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
564 sirStoreU16N((tANI_U8*)&pSirSmeRsp->messageType, msgType);
565 sirStoreU16N((tANI_U8*)&pSirSmeRsp->length, size);
566
567#endif
568
569 }
570
571 pSirSmeRsp->messageType = msgType;
572 pSirSmeRsp->length = size;
573
574 /* Update SME session Id and transaction Id */
575 pSirSmeRsp->sessionId = smesessionId;
576 pSirSmeRsp->transactionId = smetransactionId;
577 pSirSmeRsp->statusCode = resultCode;
578#ifdef WLAN_SOFTAP_FEATURE
579 if(psessionEntry != NULL )
580 pSirSmeRsp->staId = psessionEntry->staId; //else it will be always zero smeRsp StaID = 0
581
582#endif
583
584 mmhMsg.type = msgType;
585 mmhMsg.bodyptr = pSirSmeRsp;
586 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700587 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700588
589#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
590 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
591#endif //FEATURE_WLAN_DIAG_SUPPORT
592
593 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
594} /*** end limSendSmeStartBssRsp() ***/
595
596
597
598
599
600#define LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED 20
601#define LIM_SIZE_OF_EACH_BSS 400 // this is a rough estimate
602
603
604/**
605 * limSendSmeScanRsp()
606 *
607 *FUNCTION:
608 * This function is called by limProcessSmeReqMessages() to send
609 * eWNI_SME_SCAN_RSP message to applications above MAC
610 * Software.
611 *
612 *PARAMS:
613 *
614 *LOGIC:
615 *
616 *ASSUMPTIONS:
617 * NA
618 *
619 *NOTE:
620 * NA
621 *
622 * @param pMac Pointer to Global MAC structure
623 * @param length Indicates length of message
624 * @param resultCode Indicates the result of previously issued
625 * eWNI_SME_SCAN_REQ message
626 *
627 * @return None
628 */
629
630void
631limSendSmeScanRsp(tpAniSirGlobal pMac, tANI_U16 length,
632 tSirResultCodes resultCode,tANI_U8 smesessionId,tANI_U16 smetranscationId)
633{
634 tSirMsgQ mmhMsg;
635 tpSirSmeScanRsp pSirSmeScanRsp=NULL;
636 tLimScanResultNode *ptemp = NULL;
637 tANI_U16 msgLen, allocLength, curMsgLen = 0;
638 tANI_U16 i, bssCount;
639 tANI_U8 *pbBuf;
640 tSirBssDescription *pDesc;
641
642 PELOG1(limLog(pMac, LOG1,
643 FL("Sending message SME_SCAN_RSP with length=%d reasonCode %s\n"),
644 length, limResultCodeStr(resultCode));)
645
646 if (resultCode != eSIR_SME_SUCCESS)
647 {
648 limPostSmeScanRspMessage(pMac, length, resultCode,smesessionId,smetranscationId);
649 return;
650 }
651
652 mmhMsg.type = eWNI_SME_SCAN_RSP;
653 i = 0;
654 bssCount = 0;
655 msgLen = 0;
656 allocLength = LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED * LIM_SIZE_OF_EACH_BSS;
657 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
658 {
659 // Log error
660 limLog(pMac, LOGP,
661 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
662
663 return;
664 }
665 for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
666 {
667 //when ptemp is not NULL it is a left over
668 ptemp = pMac->lim.gLimCachedScanHashTable[i];
669 while(ptemp)
670 {
671 pbBuf = ((tANI_U8 *)pSirSmeScanRsp) + msgLen;
672 if(0 == bssCount)
673 {
674 msgLen = sizeof(tSirSmeScanRsp) -
675 sizeof(tSirBssDescription) +
676 ptemp->bssDescription.length +
677 sizeof(ptemp->bssDescription.length);
678 pDesc = pSirSmeScanRsp->bssDescription;
679 }
680 else
681 {
682 msgLen += ptemp->bssDescription.length +
683 sizeof(ptemp->bssDescription.length);
684 pDesc = (tSirBssDescription *)pbBuf;
685 }
686 if( (allocLength < msgLen) ||
687 (LIM_MAX_NUM_OF_SCAN_RESULTS_REPORTED <= bssCount++) )
688 {
689 pSirSmeScanRsp->statusCode =
690 eSIR_SME_MORE_SCAN_RESULTS_FOLLOW;
691#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
692 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
693 eWNI_SME_SCAN_RSP);
694 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
695#else
696 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
697 pSirSmeScanRsp->length = curMsgLen;
698#endif
699 mmhMsg.bodyptr = pSirSmeScanRsp;
700 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700701 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
703 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, allocLength))
704 {
705 // Log error
706 limLog(pMac, LOGP,
707 FL("call to palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
708 return;
709 }
710 msgLen = sizeof(tSirSmeScanRsp) -
711 sizeof(tSirBssDescription) +
712 ptemp->bssDescription.length +
713 sizeof(ptemp->bssDescription.length);
714 pDesc = pSirSmeScanRsp->bssDescription;
715 bssCount = 1;
716 }
717 curMsgLen = msgLen;
718
719 PELOG2(limLog(pMac, LOG2, FL("ScanRsp : msgLen %d, bssDescr Len=%d\n"),
720 msgLen, ptemp->bssDescription.length);)
721#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
722 sirStoreU16N((tANI_U8*)&pDesc->length,
723 ptemp->bssDescription.length);
724#else
725 pDesc->length
726 = ptemp->bssDescription.length;
727#endif
728 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pDesc->bssId,
729 (tANI_U8 *) &ptemp->bssDescription.bssId,
730 ptemp->bssDescription.length);
731
732 PELOG2(limLog(pMac, LOG2, FL("BssId "));
733 limPrintMacAddr(pMac, ptemp->bssDescription.bssId, LOG2);)
734
735 pSirSmeScanRsp->sessionId = smesessionId;
736 pSirSmeScanRsp->transcationId = smetranscationId;
737
738 ptemp = ptemp->next;
739 } //while(ptemp)
740 } //for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++)
741
742 if(0 == bssCount)
743 {
744 limPostSmeScanRspMessage(pMac, length, resultCode, smesessionId, smetranscationId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700745 if (NULL != pSirSmeScanRsp)
746 {
747 palFreeMemory( pMac->hHdd, pSirSmeScanRsp);
748 pSirSmeScanRsp = NULL;
749 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 }
751 else
752 {
753 // send last message
754 pSirSmeScanRsp->statusCode = eSIR_SME_SUCCESS;
755#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
756 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType,
757 eWNI_SME_SCAN_RSP);
758 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, curMsgLen);
759#else
760 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
761 pSirSmeScanRsp->length = curMsgLen;
762#endif
763
764 /* Update SME session Id and SME transcation Id */
765 pSirSmeScanRsp->sessionId = smesessionId;
766 pSirSmeScanRsp->transcationId = smetranscationId;
767
768 mmhMsg.type = eWNI_SME_SCAN_RSP;
769 mmhMsg.bodyptr = pSirSmeScanRsp;
770 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
773 PELOG2(limLog(pMac, LOG2, FL("statusCode : eSIR_SME_SUCCESS\n"));)
774 }
775
776 return;
777
778} /*** end limSendSmeScanRsp() ***/
779
780
781/**
782 * limPostSmeScanRspMessage()
783 *
784 *FUNCTION:
785 * This function is called by limSendSmeScanRsp() to send
786 * eWNI_SME_SCAN_RSP message with failed result code
787 *
788 *NOTE:
789 * NA
790 *
791 * @param pMac Pointer to Global MAC structure
792 * @param length Indicates length of message
793 * @param resultCode failed result code
794 *
795 * @return None
796 */
797
798void
799limPostSmeScanRspMessage(tpAniSirGlobal pMac,
800 tANI_U16 length,
801 tSirResultCodes resultCode,tANI_U8 smesessionId, tANI_U16 smetransactionId)
802{
803 tpSirSmeScanRsp pSirSmeScanRsp;
804 tSirMsgQ mmhMsg;
805
806 PELOG1(limLog(pMac, LOG1,
807 FL("limPostSmeScanRspMessage: send SME_SCAN_RSP (len %d, reasonCode %s). \n"),
808 length, limResultCodeStr(resultCode));)
809
810 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeScanRsp, length))
811 {
812 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_SCAN_RSP\n"));
813 return;
814 }
815 palZeroMemory(pMac->hHdd, (void*)pSirSmeScanRsp, length);
816
817#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
818 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->messageType, eWNI_SME_SCAN_RSP);
819 sirStoreU16N((tANI_U8*)&pSirSmeScanRsp->length, length);
820#else
821 pSirSmeScanRsp->messageType = eWNI_SME_SCAN_RSP;
822 pSirSmeScanRsp->length = length;
823#endif
824
825 if(sizeof(tSirSmeScanRsp) <= length)
826 {
827 pSirSmeScanRsp->bssDescription->length = sizeof(tSirBssDescription);
828 }
829
830 pSirSmeScanRsp->statusCode = resultCode;
831
832 /*Update SME session Id and transaction Id */
833 pSirSmeScanRsp->sessionId = smesessionId;
834 pSirSmeScanRsp->transcationId = smetransactionId;
835
836 mmhMsg.type = eWNI_SME_SCAN_RSP;
837 mmhMsg.bodyptr = pSirSmeScanRsp;
838 mmhMsg.bodyval = 0;
839
Jeff Johnsone7245742012-09-05 17:12:55 -0700840 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700841#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
842 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_RSP_EVENT, NULL, (tANI_U16)resultCode, 0);
843#endif //FEATURE_WLAN_DIAG_SUPPORT
844
845 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
846 return;
847
848} /*** limPostSmeScanRspMessage ***/
849
Jeff Johnsone7245742012-09-05 17:12:55 -0700850#ifdef FEATURE_OEM_DATA_SUPPORT
851
852/**
853 * limSendSmeOemDataRsp()
854 *
855 *FUNCTION:
856 * This function is called by limProcessSmeReqMessages() to send
857 * eWNI_SME_OEM_DATA_RSP message to applications above MAC
858 * Software.
859 *
860 *PARAMS:
861 *
862 *LOGIC:
863 *
864 *ASSUMPTIONS:
865 * NA
866 *
867 *NOTE:
868 * NA
869 *
870 * @param pMac Pointer to Global MAC structure
871 * @param pMsgBuf Indicates the mlm message
872 * @param resultCode Indicates the result of previously issued
873 * eWNI_SME_OEM_DATA_RSP message
874 *
875 * @return None
876 */
877
878void limSendSmeOemDataRsp(tpAniSirGlobal pMac, tANI_U32* pMsgBuf, tSirResultCodes resultCode)
879{
880 tSirMsgQ mmhMsg;
881 tSirOemDataRsp* pSirSmeOemDataRsp=NULL;
882 tLimMlmOemDataRsp* pMlmOemDataRsp=NULL;
883 tANI_U16 msgLength;
884
885
886 //get the pointer to the mlm message
887 pMlmOemDataRsp = (tLimMlmOemDataRsp*)(pMsgBuf);
888
889 msgLength = sizeof(tSirOemDataRsp);
890
891 //now allocate memory for the char buffer
892 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pSirSmeOemDataRsp, msgLength))
893 {
894 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSirSmeOemDataRsp\n"));
895 return;
896 }
897
898#if defined (ANI_LITTLE_BYTE_ENDIAN)
899 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->length, msgLength);
900 sirStoreU16N((tANI_U8*)&pSirSmeOemDataRsp->messageType, eWNI_SME_OEM_DATA_RSP);
901#else
902 pSirSmeOemDataRsp->length = msgLength;
903 pSirSmeOemDataRsp->messageType = eWNI_SME_OEM_DATA_RSP;
904#endif
905
906 palCopyMemory(pMac->hHdd, pSirSmeOemDataRsp->oemDataRsp, pMlmOemDataRsp->oemDataRsp, OEM_DATA_RSP_SIZE);
907
908 //Now free the memory from MLM Rsp Message
909 palFreeMemory(pMac->hHdd, pMlmOemDataRsp);
910
911 mmhMsg.type = eWNI_SME_OEM_DATA_RSP;
912 mmhMsg.bodyptr = pSirSmeOemDataRsp;
913 mmhMsg.bodyval = 0;
914
915 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
916
917 return;
918} /*** limSendSmeOemDataRsp ***/
919
920#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700921
922
923/**
924 * limSendSmeAuthRsp()
925 *
926 *FUNCTION:
927 * This function is called by limProcessSmeMessages() to send
928 * eWNI_SME_AUTH_RSP message to host
929 *
930 *PARAMS:
931 *
932 *LOGIC:
933 *
934 *ASSUMPTIONS:
935 * NA
936 *
937 *NOTE:
938 * NA
939 *
940 * @param pMac Pointer to Global MAC structure
941 * @param statusCode Indicates the result of previously issued
942 * eWNI_SME_AUTH_REQ message
943 *
944 * @return None
945 */
946void
947limSendSmeAuthRsp(tpAniSirGlobal pMac,
948 tSirResultCodes statusCode,
949 tSirMacAddr peerMacAddr,
950 tAniAuthType authType,
951 tANI_U16 protStatusCode,
952 tpPESession psessionEntry,tANI_U8 smesessionId,
953 tANI_U16 smetransactionId)
954{
955#if 0
956 tSirMsgQ mmhMsg;
957 tSirSmeAuthRsp *pSirSmeAuthRsp;
958
959
960 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeAuthRsp, sizeof(tSirSmeAuthRsp)))
961 {
962 // Log error
963 limLog(pMac, LOGP,
964 FL("call to palAllocateMemory failed for eWNI_SME_AUTH_RSP\n"));
965
966 return;
967 }
968
969#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
970 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->messageType, eWNI_SME_AUTH_RSP);
971 sirStoreU16N((tANI_U8*)&pSirSmeAuthRsp->length, sizeof(tSirSmeAuthRsp));
972
973#endif
974
975
976 if(psessionEntry != NULL)
977 {
978 palCopyMemory( pMac->hHdd, (tANI_U8 *) pSirSmeAuthRsp->peerMacAddr,
979 (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
980 pSirSmeAuthRsp->authType = authType;
981
982 }
983
984 pSirSmeAuthRsp->messageType = eWNI_SME_AUTH_RSP;
985 pSirSmeAuthRsp->length = sizeof(tSirSmeAuthRsp);
986 pSirSmeAuthRsp->statusCode = statusCode;
987 pSirSmeAuthRsp->protStatusCode = protStatusCode;
988
989 /* Update SME session and transaction Id*/
990 pSirSmeAuthRsp->sessionId = smesessionId;
991 pSirSmeAuthRsp->transactionId = smetransactionId;
992
993 mmhMsg.type = eWNI_SME_AUTH_RSP;
994 mmhMsg.bodyptr = pSirSmeAuthRsp;
995 mmhMsg.bodyval = 0;
996 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
997 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
998#endif
999} /*** end limSendSmeAuthRsp() ***/
1000
1001
1002void limSendSmeDisassocDeauthNtfPostResume( tpAniSirGlobal pMac,
1003 eHalStatus status, tANI_U32 *pCtx )
1004{
1005 tSirMsgQ mmhMsg;
1006 tSirMsgQ *pMsg = (tSirMsgQ*) pCtx;
1007
1008 mmhMsg.type = pMsg->type;
1009 mmhMsg.bodyptr = pMsg;
1010 mmhMsg.bodyval = 0;
1011
Jeff Johnsone7245742012-09-05 17:12:55 -07001012 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001013
1014 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1015}
1016/**
1017 * limSendSmeDisassocNtf()
1018 *
1019 *FUNCTION:
1020 * This function is called by limProcessSmeMessages() to send
1021 * eWNI_SME_DISASSOC_RSP/IND message to host
1022 *
1023 *PARAMS:
1024 *
1025 *LOGIC:
1026 *
1027 *ASSUMPTIONS:
1028 * NA
1029 *
1030 *NOTE:
1031 * This function is used for sending eWNI_SME_DISASSOC_CNF,
1032 * or eWNI_SME_DISASSOC_IND to host depending on
1033 * disassociation trigger.
1034 *
1035 * @param peerMacAddr Indicates the peer MAC addr to which
1036 * disassociate was initiated
1037 * @param reasonCode Indicates the reason for Disassociation
1038 * @param disassocTrigger Indicates the trigger for Disassociation
1039 * @param aid Indicates the STAID. This parameter is
1040 * present only on AP.
1041 *
1042 * @return None
1043 */
1044void
1045limSendSmeDisassocNtf(tpAniSirGlobal pMac,
1046 tSirMacAddr peerMacAddr,
1047 tSirResultCodes reasonCode,
1048 tANI_U16 disassocTrigger,
1049 tANI_U16 aid,
1050 tANI_U8 smesessionId,
1051 tANI_U16 smetransactionId,
1052 tpPESession psessionEntry)
1053{
1054
1055 tANI_U8 *pBuf;
1056 tSirSmeDisassocRsp *pSirSmeDisassocRsp;
1057 tSirSmeDisassocInd *pSirSmeDisassocInd;
1058 tANI_U32 *pMsg;
1059
1060 switch (disassocTrigger)
1061 {
1062 case eLIM_PEER_ENTITY_DISASSOC:
1063 return;
1064
1065 case eLIM_HOST_DISASSOC:
1066 /**
1067 * Disassociation response due to
1068 * host triggered disassociation
1069 */
1070
1071 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocRsp, sizeof(tSirSmeDisassocRsp)))
1072 {
1073 // Log error
1074 limLog(pMac, LOGP,
1075 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_RSP\n"));
1076
1077 return;
1078 }
1079
1080#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1081 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->messageType,
1082 eWNI_SME_DISASSOC_RSP);
1083 sirStoreU16N((tANI_U8*)&pSirSmeDisassocRsp->length,
1084 sizeof(tSirSmeDisassocRsp));
1085#else
1086 pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP;
1087 pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp);
1088#endif
1089 //sessionId
1090 pBuf = (tANI_U8 *) &pSirSmeDisassocRsp->sessionId;
1091 *pBuf = smesessionId;
1092 pBuf++;
1093
1094 //transactionId
1095 limCopyU16(pBuf, smetransactionId);
1096 pBuf += sizeof(tANI_U16);
1097
1098 //statusCode
1099 limCopyU32(pBuf, reasonCode);
1100 pBuf += sizeof(tSirResultCodes);
1101
1102 //peerMacAddr
1103 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1104 pBuf += sizeof(tSirMacAddr);
1105
1106#if (WNI_POLARIS_FW_PRODUCT == AP)
1107 limCopyU16(pBuf, aid);
1108 pBuf += sizeof(tANI_U16);
1109
1110 // perStaStats
1111 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1112#else
1113 // Clear Station Stats
1114 //for sta, it is always 1, IBSS is handled at halInitSta
1115
1116#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1117
1118
1119#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1120 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
1121 psessionEntry, (tANI_U16)reasonCode, 0);
1122#endif
1123 pMsg = (tANI_U32*) pSirSmeDisassocRsp;
1124 break;
1125
1126 default:
1127 /**
1128 * Disassociation indication due to Disassociation
1129 * frame reception from peer entity or due to
1130 * loss of link with peer entity.
1131 */
1132 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1133 {
1134 // Log error
1135 limLog(pMac, LOGP,
1136 FL("call to palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1137
1138 return;
1139 }
1140
1141#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1142 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType,
1143 eWNI_SME_DISASSOC_IND);
1144 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length,
1145 sizeof(tSirSmeDisassocInd));
1146#else
1147 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1148 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1149
1150 /* Update SME session Id and Transaction Id */
1151 pSirSmeDisassocInd->sessionId = smesessionId;
1152 pSirSmeDisassocInd->transactionId = smetransactionId;
1153#endif
1154 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1155
1156 limCopyU32(pBuf, reasonCode);
1157 pBuf += sizeof(tSirResultCodes);
1158
1159 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1160 pBuf += sizeof(tSirMacAddr);
1161
1162 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1163#if (WNI_POLARIS_FW_PRODUCT == AP)
1164 pBuf += sizeof(tSirMacAddr);
1165 limCopyU16(pBuf, aid);
1166 pBuf += sizeof(tANI_U16);
1167
1168 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[aid].staStat, pBuf);
1169
1170#endif//#if (WNI_POLARIS_FW_PRODUCT == AP)
1171
1172
1173#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1174 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT,
1175 psessionEntry, (tANI_U16)reasonCode, 0);
1176#endif
1177 pMsg = (tANI_U32*) pSirSmeDisassocInd;
1178#if (WNI_POLARIS_FW_PRODUCT == AP)
1179 PELOG1(limLog(pMac, LOG1,
1180 FL("*** Sending DisAssocInd staId=%d, reasonCode=%d ***\n"),
1181 aid, reasonCode);)
1182#endif
1183
1184 break;
1185 }
1186
1187 /* Delete the PE session Created */
1188 if((psessionEntry != NULL) && ((psessionEntry ->limSystemRole == eLIM_STA_ROLE) ||
1189 (psessionEntry ->limSystemRole == eLIM_BT_AMP_STA_ROLE)) )
1190 {
1191 peDeleteSession(pMac,psessionEntry);
1192 }
1193
1194 if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
1195 {
1196 //Resume on the first active session channel.
Jeff Johnsone7245742012-09-05 17:12:55 -07001197 tANI_U8 resumeChannel;
1198 ePhyChanBondState resumePhyCbState;
1199 peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
1200 peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
Jeff Johnson295189b2012-06-20 16:38:30 -07001201
1202 limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
1203 (tANI_U32*) pMsg );
1204 }
1205 else
1206 {
1207 limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
1208 (tANI_U32*) pMsg );
1209 }
1210} /*** end limSendSmeDisassocNtf() ***/
1211
1212
1213/** -----------------------------------------------------------------
1214 \brief limSendSmeDisassocInd() - sends SME_DISASSOC_IND
1215
1216 After receiving disassociation frame from peer entity, this
1217 function sends a eWNI_SME_DISASSOC_IND to SME with a specific
1218 reason code.
1219
1220 \param pMac - global mac structure
1221 \param pStaDs - station dph hash node
1222 \return none
1223 \sa
1224 ----------------------------------------------------------------- */
1225void
1226limSendSmeDisassocInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs,tpPESession psessionEntry)
1227{
1228 tSirMsgQ mmhMsg;
1229 tSirSmeDisassocInd *pSirSmeDisassocInd;
1230
1231 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDisassocInd, sizeof(tSirSmeDisassocInd)))
1232 {
1233 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DISASSOC_IND\n"));
1234 return;
1235 }
1236
1237 //psessionEntry = peFindSessionByBssid(pMac,pStaDs->staAddr,&sessionId);
1238#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1239 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->messageType, eWNI_SME_DISASSOC_IND);
1240 sirStoreU16N((tANI_U8*)&pSirSmeDisassocInd->length, sizeof(tSirSmeDisassocInd));
1241#else
1242 pSirSmeDisassocInd->messageType = eWNI_SME_DISASSOC_IND;
1243 pSirSmeDisassocInd->length = sizeof(tSirSmeDisassocInd);
1244#endif
1245
1246#if 0 //Commenting out all the serialization
1247 //statusCode
1248 pBuf = (tANI_U8 *) &pSirSmeDisassocInd->statusCode;
1249 limCopyU32(pBuf, pStaDs->mlmStaContext.disassocReason);
1250 pBuf += sizeof(tSirResultCodes);
1251
1252 //peerMacAddr
1253 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1254
1255#ifdef ANI_PRODUCT_TYPE_AP
1256 pBuf += sizeof(tSirMacAddr);
1257 //aid
1258 limCopyU16(pBuf, pStaDs->assocId);
1259 pBuf += sizeof(tANI_U16);
1260
1261 //perStaStats
1262 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat, pBuf);
1263#endif
1264#endif
1265 pSirSmeDisassocInd->sessionId = psessionEntry->smeSessionId;
1266 pSirSmeDisassocInd->transactionId = psessionEntry->transactionId;
1267 pSirSmeDisassocInd->statusCode = pStaDs->mlmStaContext.disassocReason;
1268
1269 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
1270
1271 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->peerMacAddr , pStaDs->staAddr, sizeof(tSirMacAddr));
1272
1273#ifdef ANI_PRODUCT_TYPE_AP
1274 pSirSmeDisassocInd->aid = pStaDs->assocId;
1275 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat,(tANI_U8*)&pSirSmeDisassocInd-> perStaStats );
1276#endif
1277#ifdef WLAN_SOFTAP_FEATURE
1278 pSirSmeDisassocInd->staId = pStaDs->staIndex;
1279#endif
1280
1281 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1282 mmhMsg.bodyptr = pSirSmeDisassocInd;
1283 mmhMsg.bodyval = 0;
1284
Jeff Johnsone7245742012-09-05 17:12:55 -07001285 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001286#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1287 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1288#endif //FEATURE_WLAN_DIAG_SUPPORT
1289
1290 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1291
1292} /*** end limSendSmeDisassocInd() ***/
1293
1294
1295/** -----------------------------------------------------------------
1296 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1297
1298 After receiving deauthentication frame from peer entity, this
1299 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1300 reason code.
1301
1302 \param pMac - global mac structure
1303 \param pStaDs - station dph hash node
1304 \return none
1305 \sa
1306 ----------------------------------------------------------------- */
1307void
1308limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1309{
1310#ifndef WLAN_SOFTAP_FEATURE
1311 tANI_U8 *pBuf;
1312#endif
1313 tSirMsgQ mmhMsg;
1314 tSirSmeDeauthInd *pSirSmeDeauthInd;
1315
1316 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1317 {
1318 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_IND \n"));
1319 return;
1320 }
1321
1322#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1323 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType, eWNI_SME_DEAUTH_IND);
1324 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length, sizeof(tSirSmeDeauthInd));
1325#else
1326 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1327 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1328#endif
1329
1330#ifdef WLAN_SOFTAP_FEATURE
1331 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1332 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1333 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1334 {
1335 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1336 }
1337 else
1338 {
1339 //Need to indicatet he reascon code over the air
1340 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1341 }
1342 //BSSID
1343 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1344 //peerMacAddr
1345 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
1346#else
1347
1348 //sessionId
1349 pBuf = (tANI_U8 *) &pSirSmeDeauthInd->sessionId;
1350 *pBuf++ = psessionEntry->smeSessionId;
1351
1352 //transactionId
1353 limCopyU16(pBuf, 0);
1354 pBuf += sizeof(tANI_U16);
1355
1356 // status code
1357 limCopyU32(pBuf, pStaDs->mlmStaContext.cleanupTrigger);
1358 pBuf += sizeof(tSirResultCodes);
1359
1360 //bssid
1361 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1362 pBuf += sizeof(tSirMacAddr);
1363
1364 //peerMacAddr
1365 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1366#endif
1367
1368#if (WNI_POLARIS_FW_PRODUCT == AP)
1369 pBuf += sizeof(tSirMacAddr);
1370 limCopyU16(pBuf, pStaDs->staAddr);
1371#endif
1372
1373#ifdef WLAN_SOFTAP_FEATURE
1374 pSirSmeDeauthInd->staId = pStaDs->staIndex;
1375#endif
1376
1377 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1378 mmhMsg.bodyptr = pSirSmeDeauthInd;
1379 mmhMsg.bodyval = 0;
1380
Jeff Johnsone7245742012-09-05 17:12:55 -07001381 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001382#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1383 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1384#endif //FEATURE_WLAN_DIAG_SUPPORT
1385
1386 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1387 return;
1388} /*** end limSendSmeDeauthInd() ***/
1389
1390
1391/**
1392 * limSendSmeDeauthNtf()
1393 *
1394 *FUNCTION:
1395 * This function is called by limProcessSmeMessages() to send
1396 * eWNI_SME_DISASSOC_RSP/IND message to host
1397 *
1398 *PARAMS:
1399 *
1400 *LOGIC:
1401 *
1402 *ASSUMPTIONS:
1403 * NA
1404 *
1405 *NOTE:
1406 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1407 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1408 *
1409 * @param peerMacAddr Indicates the peer MAC addr to which
1410 * deauthentication was initiated
1411 * @param reasonCode Indicates the reason for Deauthetication
1412 * @param deauthTrigger Indicates the trigger for Deauthetication
1413 * @param aid Indicates the STAID. This parameter is present
1414 * only on AP.
1415 *
1416 * @return None
1417 */
1418void
1419limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1420 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1421{
1422 tANI_U8 *pBuf;
1423 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1424 tSirSmeDeauthInd *pSirSmeDeauthInd;
1425 tpPESession psessionEntry;
1426 tANI_U8 sessionId;
1427 tANI_U32 *pMsg;
1428
1429 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1430 switch (deauthTrigger)
1431 {
1432 case eLIM_PEER_ENTITY_DEAUTH:
1433 return;
1434
1435 case eLIM_HOST_DEAUTH:
1436 /**
1437 * Deauthentication response to host triggered
1438 * deauthentication.
1439 */
1440 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthRsp, sizeof(tSirSmeDeauthRsp)))
1441 {
1442 // Log error
1443 limLog(pMac, LOGP,
1444 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_RSP\n"));
1445
1446 return;
1447 }
1448
1449#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1450 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->messageType),
1451 eWNI_SME_DEAUTH_RSP);
1452 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->length),
1453 sizeof(tSirSmeDeauthRsp));
1454#else
1455 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1456 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
1457#endif
1458 pSirSmeDeauthRsp->statusCode = reasonCode;
1459 pSirSmeDeauthRsp->sessionId = smesessionId;
1460 pSirSmeDeauthRsp->transactionId = smetransactionId;
1461
1462 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
1463 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1464
1465#if (WNI_POLARIS_FW_PRODUCT == AP)
1466 pBuf += sizeof(tSirMacAddr);
1467 limCopyU16(pBuf, aid);
1468#endif
1469#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1470 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1471 psessionEntry, 0, (tANI_U16)reasonCode);
1472#endif
1473 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1474
1475 break;
1476
1477 default:
1478 /**
1479 * Deauthentication indication due to Deauthentication
1480 * frame reception from peer entity or due to
1481 * loss of link with peer entity.
1482 */
1483 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1484 {
1485 // Log error
1486 limLog(pMac, LOGP,
1487 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_Ind\n"));
1488
1489 return;
1490 }
1491
1492#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1493 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType,
1494 eWNI_SME_DEAUTH_IND);
1495 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length,
1496 sizeof(tSirSmeDeauthInd));
1497#else
1498 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1499 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1500#endif
1501
1502 // sessionId
1503 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1504 *pBuf++ = smesessionId;
1505
1506 //transaction ID
1507 limCopyU16(pBuf, smetransactionId);
1508 pBuf += sizeof(tANI_U16);
1509
1510 // status code
1511 limCopyU32(pBuf, reasonCode);
1512 pBuf += sizeof(tSirResultCodes);
1513
1514 //bssId
1515 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1516 pBuf += sizeof(tSirMacAddr);
1517
1518 //peerMacAddr
1519 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
1520
1521#if (WNI_POLARIS_FW_PRODUCT == AP)
1522 pBuf += sizeof(tSirMacAddr);
1523 limCopyU16(pBuf, aid);
1524#endif
1525#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1526 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1527 psessionEntry, 0, (tANI_U16)reasonCode);
1528#endif //FEATURE_WLAN_DIAG_SUPPORT
1529 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1530
1531 break;
1532 }
1533
1534 /*Delete the PE session created */
1535 if(psessionEntry != NULL)
1536 {
1537 peDeleteSession(pMac,psessionEntry);
1538 }
1539
1540 if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
1541 {
1542 //Resume on the first active session channel.
Jeff Johnsone7245742012-09-05 17:12:55 -07001543 tANI_U8 resumeChannel;
1544 ePhyChanBondState resumePhyCbState;
1545 peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
1546 peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
Jeff Johnson295189b2012-06-20 16:38:30 -07001547
1548 limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
1549 (tANI_U32*) pMsg );
1550 }
1551 else
1552 {
1553 limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
1554 (tANI_U32*) pMsg );
1555 }
1556} /*** end limSendSmeDeauthNtf() ***/
1557
1558
1559/**
1560 * limSendSmeWmStatusChangeNtf()
1561 *
1562 *FUNCTION:
1563 * This function is called by limProcessSmeMessages() to send
1564 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1565 *
1566 *PARAMS:
1567 *
1568 *LOGIC:
1569 *
1570 *ASSUMPTIONS:
1571 * NA
1572 *
1573 *NOTE:
1574 *
1575 * @param statusChangeCode Indicates the change in the wireless medium.
1576 * @param statusChangeInfo Indicates the information associated with
1577 * change in the wireless medium.
1578 * @param infoLen Indicates the length of status change information
1579 * being sent.
1580 *
1581 * @return None
1582 */
1583void
1584limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1585 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1586{
1587 tSirMsgQ mmhMsg;
1588 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
1589 eHalStatus status;
1590#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1591 tANI_U32 bufLen;
1592 tANI_U16 length=0;
1593 tANI_U8 *pBuf;
1594#endif
1595
1596
1597
1598 status = palAllocateMemory( pMac->hHdd, (void **)&pSirSmeWmStatusChangeNtf,
1599 sizeof(tSirSmeWmStatusChangeNtf));
1600 if (status != eHAL_STATUS_SUCCESS)
1601 {
1602 limLog(pMac, LOGE,
1603 FL("call to palAllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF, status = %d\n"),
1604 status);
1605 return;
1606 }
1607
1608#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1609 pBuf = (tANI_U8 *)pSirSmeWmStatusChangeNtf;
1610#endif
1611
1612 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1613 mmhMsg.bodyval = 0;
1614 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1615
1616 switch(statusChangeCode)
1617 {
1618 case eSIR_SME_RADAR_DETECTED:
1619
1620#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1621 bufLen = sizeof(tSirSmeWmStatusChangeNtf);
1622 if ((limSmeWmStatusChangeHeaderSerDes(pMac,
1623 statusChangeCode,
1624 pBuf,
1625 &length,
1626 bufLen,
1627 sessionId) != eSIR_SUCCESS))
1628 {
1629 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1630 limLog(pMac, LOGP, FL("Header SerDes failed \n"));
1631 return;
1632 }
1633 pBuf += length;
1634 bufLen -= length;
1635 if ((limRadioInfoSerDes(pMac,
1636 (tpSirRadarInfo)pStatusChangeInfo,
1637 pBuf,
1638 &length,
1639 bufLen) != eSIR_SUCCESS))
1640 {
1641 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1642 limLog(pMac, LOGP, FL("Radio Info SerDes failed \n"));
1643 return;
1644 }
1645
1646 pBuf = (tANI_U8 *) pSirSmeWmStatusChangeNtf;
1647 pBuf += sizeof(tANI_U16);
1648 limCopyU16(pBuf, length);
1649#endif
1650 break;
1651
1652 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
1653#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1654
1655 if( eSIR_SUCCESS != nonTitanBssFoundSerDes( pMac,
1656 (tpSirNeighborBssWdsInfo) pStatusChangeInfo,
1657 pBuf,
1658 &length,
1659 sessionId))
1660 {
1661 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1662 limLog( pMac, LOGP,
1663 FL("Unable to serialize nonTitanBssFoundSerDes!\n"));
1664 return;
1665 }
1666#endif
1667 break;
1668
1669 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1670 limPackBkgndScanFailNotify(pMac,
1671 statusChangeCode,
1672 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1673 pSirSmeWmStatusChangeNtf, sessionId);
1674 break;
1675
1676 default:
1677#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1678 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->messageType,
1679 eWNI_SME_WM_STATUS_CHANGE_NTF );
1680 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->length,
1681 (sizeof(tSirSmeWmStatusChangeNtf)));
1682 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1683 sirStoreU32N((tANI_U8*)&pSirSmeWmStatusChangeNtf->statusChangeCode,
1684 statusChangeCode);
1685#else
1686 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1687 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1688 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1689 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1690#endif
1691 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1692 {
1693 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo, (tANI_U8 *)pStatusChangeInfo, infoLen);
1694 }
1695 limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***\n"),
1696 statusChangeCode, infoLen);
1697 break;
1698 }
1699
1700
Jeff Johnsone7245742012-09-05 17:12:55 -07001701 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1703 {
1704 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1705 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed\n"));
1706 }
1707
1708} /*** end limSendSmeWmStatusChangeNtf() ***/
1709
1710
1711/**
1712 * limSendSmeSetContextRsp()
1713 *
1714 *FUNCTION:
1715 * This function is called by limProcessSmeMessages() to send
1716 * eWNI_SME_SETCONTEXT_RSP message to host
1717 *
1718 *PARAMS:
1719 *
1720 *LOGIC:
1721 *
1722 *ASSUMPTIONS:
1723 * NA
1724 *
1725 *NOTE:
1726 *
1727 * @param pMac Pointer to Global MAC structure
1728 * @param peerMacAddr Indicates the peer MAC addr to which
1729 * setContext was performed
1730 * @param aid Indicates the aid corresponding to the peer MAC
1731 * address
1732 * @param resultCode Indicates the result of previously issued
1733 * eWNI_SME_SETCONTEXT_RSP message
1734 *
1735 * @return None
1736 */
1737void
1738limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1739 tSirMacAddr peerMacAddr, tANI_U16 aid,
1740 tSirResultCodes resultCode,
1741 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1742{
1743
1744 tANI_U8 *pBuf;
1745 tSirMsgQ mmhMsg;
1746 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1747
1748 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSetContextRsp, sizeof(tSirSmeSetContextRsp)))
1749 {
1750 // Log error
1751 limLog(pMac, LOGP,
1752 FL("call to palAllocateMemory failed for SmeSetContextRsp\n"));
1753
1754 return;
1755 }
1756
1757#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1758 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->messageType,
1759 eWNI_SME_SETCONTEXT_RSP);
1760 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->length,
1761 sizeof(tSirSmeSetContextRsp));
1762#else
1763 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1764 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
1765#endif
1766 pSirSmeSetContextRsp->statusCode = resultCode;
1767
1768 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1769
1770 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1771 pBuf += sizeof(tSirMacAddr);
1772
1773#if (WNI_POLARIS_FW_PRODUCT == AP)
1774 limCopyU16(pBuf, aid);
1775 pBuf += sizeof(tANI_U16);
1776#endif
1777
1778 /* Update SME session and transaction Id*/
1779 pSirSmeSetContextRsp->sessionId = smesessionId;
1780 pSirSmeSetContextRsp->transactionId = smetransactionId;
1781
1782 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1783 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1784 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001785 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001786
1787#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1788 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1789#endif //FEATURE_WLAN_DIAG_SUPPORT
1790
1791 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1792} /*** end limSendSmeSetContextRsp() ***/
1793
1794/**
1795 * limSendSmeRemoveKeyRsp()
1796 *
1797 *FUNCTION:
1798 * This function is called by limProcessSmeMessages() to send
1799 * eWNI_SME_REMOVEKEY_RSP message to host
1800 *
1801 *PARAMS:
1802 *
1803 *LOGIC:
1804 *
1805 *ASSUMPTIONS:
1806 * NA
1807 *
1808 *NOTE:
1809 *
1810 * @param pMac Pointer to Global MAC structure
1811 * @param peerMacAddr Indicates the peer MAC addr to which
1812 * Removekey was performed
1813 * @param aid Indicates the aid corresponding to the peer MAC
1814 * address
1815 * @param resultCode Indicates the result of previously issued
1816 * eWNI_SME_REMOVEKEY_RSP message
1817 *
1818 * @return None
1819 */
1820void
1821limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1822 tSirMacAddr peerMacAddr,
1823 tSirResultCodes resultCode,
1824 tpPESession psessionEntry,tANI_U8 smesessionId,
1825 tANI_U16 smetransactionId)
1826{
1827 tANI_U8 *pBuf;
1828 tSirMsgQ mmhMsg;
1829 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
1830
1831 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRemoveKeyRsp, sizeof(tSirSmeRemoveKeyRsp)))
1832 {
1833 // Log error
1834 limLog(pMac, LOGP,
1835 FL("call to palAllocateMemory failed for SmeRemoveKeyRsp\n"));
1836
1837 return;
1838 }
1839
1840#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
1841 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->messageType,
1842 eWNI_SME_REMOVEKEY_RSP);
1843 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->length,
1844 sizeof(tSirSmeRemoveKeyRsp));
1845
1846#endif
1847
1848
1849 if(psessionEntry != NULL)
1850 {
1851 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
1852 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1853 pBuf += sizeof(tSirMacAddr);
1854 limCopyU32(pBuf, resultCode);
1855 }
1856
1857 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
1858 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
1859 pSirSmeRemoveKeyRsp->statusCode = resultCode;
1860
1861 /* Update SME session and transaction Id*/
1862 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
1863 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
1864
1865 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
1866 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
1867 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001868 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1870} /*** end limSendSmeSetContextRsp() ***/
1871
1872
1873/**
1874 * limSendSmePromiscuousModeRsp()
1875 *
1876 *FUNCTION:
1877 * This function is called by limProcessSmeMessages() to send
1878 * eWNI_PROMISCUOUS_MODE_RSP message to host
1879 *
1880 *PARAMS:
1881 *
1882 *LOGIC:
1883 *
1884 *ASSUMPTIONS:
1885 * NA
1886 *
1887 *NOTE:
1888 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
1889 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
1890 *
1891 * @param None
1892 * @return None
1893 */
1894void
1895limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
1896{
1897#if 0
1898 tSirMsgQ mmhMsg;
1899 tSirMbMsg *pMbMsg;
1900
1901 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbMsg, sizeof(tSirMbMsg)))
1902 {
1903 // Log error
1904 limLog(pMac, LOGP, FL("call to palAllocateMemory failed\n"));
1905
1906 return;
1907 }
1908
1909 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
1910 pMbMsg->msgLen = 4;
1911
1912 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
1913 mmhMsg.bodyptr = pMbMsg;
1914 mmhMsg.bodyval = 0;
1915 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1916 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1917#endif
1918} /*** end limSendSmePromiscuousModeRsp() ***/
1919
1920
1921
1922/**
1923 * limSendSmeNeighborBssInd()
1924 *
1925 *FUNCTION:
1926 * This function is called by limLookupNaddHashEntry() to send
1927 * eWNI_SME_NEIGHBOR_BSS_IND message to host
1928 *
1929 *PARAMS:
1930 *
1931 *LOGIC:
1932 *
1933 *ASSUMPTIONS:
1934 * NA
1935 *
1936 *NOTE:
1937 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
1938 * host upon detecting new BSS during background scanning if CFG
1939 * option is enabled for sending such indication
1940 *
1941 * @param pMac - Pointer to Global MAC structure
1942 * @return None
1943 */
1944
1945void
1946limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
1947 tLimScanResultNode *pBssDescr)
1948{
1949 tSirMsgQ msgQ;
1950 tANI_U32 val;
1951 tSirSmeNeighborBssInd *pNewBssInd;
1952
1953 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
1954 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
1955 pMac->lim.gLimRspReqd))
1956 {
1957 // LIM is not in background scan state OR
1958 // current scan is initiated by HDD.
1959 // No need to send new BSS indication to HDD
1960 return;
1961 }
1962
1963 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
1964 {
1965 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG\n"));
1966
1967 return;
1968 }
1969
1970 if (val == 0)
1971 return;
1972
1973 /**
1974 * Need to indicate new BSSs found during
1975 * background scanning to host.
1976 * Allocate buffer for sending indication.
1977 * Length of buffer is length of BSS description
1978 * and length of header itself
1979 */
1980 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
1981 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pNewBssInd, val))
1982 {
1983 // Log error
1984 limLog(pMac, LOGP,
1985 FL("call to palAllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND\n"));
1986
1987 return;
1988 }
1989
1990#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1991 sirStoreU16N((tANI_U8*) &pNewBssInd->messageType,
1992 eWNI_SME_NEIGHBOR_BSS_IND);
1993 sirStoreU16N((tANI_U8*)&pNewBssInd->length, (tANI_U16)val );
1994#else
1995 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
1996 pNewBssInd->length = (tANI_U16) val;
1997#endif
1998 pNewBssInd->sessionId = 0;
1999
2000#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
2001 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewBssInd->bssDescription,
2002 (tANI_U8 *) &pBssDescr->bssDescription,
2003 pBssDescr->bssDescription.length + sizeof(tANI_U16));
2004#endif
2005
2006 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2007 msgQ.bodyptr = pNewBssInd;
2008 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002009 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2011} /*** end limSendSmeNeighborBssInd() ***/
2012
2013/** -----------------------------------------------------------------
2014 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2015 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2016 \ SME only looks at rc and tspec field.
2017 \param pMac - global mac structure
2018 \param rspReqd - is SmeAddTsRsp required
2019 \param status - status code of SME_ADD_TS_RSP
2020 \return tspec
2021 \sa
2022 ----------------------------------------------------------------- */
2023void
2024limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2025 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2026{
2027 tpSirAddtsRsp rsp;
2028 tSirMsgQ mmhMsg;
2029
2030 if (! rspReqd)
2031 return;
2032
2033 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2034 {
2035 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_RSP"));
2036 return;
2037 }
2038
2039 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2040 rsp->messageType = eWNI_SME_ADDTS_RSP;
2041 rsp->rc = status;
2042 rsp->rsp.status = (enum eSirMacStatusCodes) status;
2043 //palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
2044 rsp->rsp.tspec = tspec;
2045
2046 /* Update SME session Id and transcation Id */
2047 rsp->sessionId = smesessionId;
2048 rsp->transactionId = smetransactionId;
2049
2050 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2051 mmhMsg.bodyptr = rsp;
2052 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002053 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002054#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2055 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2056#endif //FEATURE_WLAN_DIAG_SUPPORT
2057
2058 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2059 return;
2060}
2061
2062void
2063limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2064{
2065 tpSirAddtsRsp rsp;
2066 tSirMsgQ mmhMsg;
2067
2068 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)\n",
2069 addts->dialogToken,
2070 addts->tspec.tsinfo.traffic.tsid,
2071 addts->tspec.tsinfo.traffic.userPrio);
2072
2073 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2074 {
2075 // Log error
2076 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_IND\n"));
2077 return;
2078 }
2079 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2080
2081 rsp->messageType = eWNI_SME_ADDTS_IND;
2082
2083 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
2084
2085 mmhMsg.type = eWNI_SME_ADDTS_IND;
2086 mmhMsg.bodyptr = rsp;
2087 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002088 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2090}
2091
2092void
2093limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2094{
2095 tpSirDeltsRsp rsp;
2096 tSirMsgQ mmhMsg;
2097
2098 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d\n",
2099 delts->aid,
2100 delts->req.tsinfo.traffic.tsid,
2101 delts->req.tsinfo.traffic.userPrio,
2102 status);
2103 if (! delts->rspReqd)
2104 return;
2105
2106 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2107 {
2108 // Log error
2109 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_RSP\n"));
2110 return;
2111 }
2112 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2113
2114 if(psessionEntry != NULL)
2115 {
2116
2117 rsp->aid = delts->aid;
2118 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2119 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
2120 }
2121
2122
2123 rsp->messageType = eWNI_SME_DELTS_RSP;
2124 rsp->rc = status;
2125
2126 /* Update SME session Id and transcation Id */
2127 rsp->sessionId = smesessionId;
2128 rsp->transactionId = smetransactionId;
2129
2130 mmhMsg.type = eWNI_SME_DELTS_RSP;
2131 mmhMsg.bodyptr = rsp;
2132 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002133 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002134#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2135 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2136#endif //FEATURE_WLAN_DIAG_SUPPORT
2137
2138 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2139}
2140
2141void
2142limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2143{
2144 tpSirDeltsRsp rsp;
2145 tSirMsgQ mmhMsg;
2146
2147 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)\n",
2148 aid,
2149 delts->tsinfo.traffic.tsid,
2150 delts->tsinfo.traffic.userPrio);
2151
2152 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2153 {
2154 // Log error
2155 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_IND\n"));
2156 return;
2157 }
2158 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2159
2160 rsp->messageType = eWNI_SME_DELTS_IND;
2161 rsp->rc = eSIR_SUCCESS;
2162 rsp->aid = aid;
2163 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
2164
2165 /* Update SME session Id and SME transaction Id */
2166
2167 rsp->sessionId = psessionEntry->smeSessionId;
2168 rsp->transactionId = psessionEntry->transactionId;
2169
2170 mmhMsg.type = eWNI_SME_DELTS_IND;
2171 mmhMsg.bodyptr = rsp;
2172 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002173 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002174#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2175 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2176#endif //FEATURE_WLAN_DIAG_SUPPORT
2177
2178 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2179}
2180
2181/**
2182 * limSendSmeStatsRsp()
2183 *
2184 *FUNCTION:
2185 * This function is called to send 802.11 statistics response to HDD.
2186 * This function posts the result back to HDD. This is a response to
2187 * HDD's request for statistics.
2188 *
2189 *PARAMS:
2190 *
2191 *LOGIC:
2192 *
2193 *ASSUMPTIONS:
2194 * NA
2195 *
2196 *NOTE:
2197 * NA
2198 *
2199 * @param pMac Pointer to Global MAC structure
2200 * @param p80211Stats Statistics sent in response
2201 * @param resultCode TODO:
2202 *
2203 *
2204 * @return none
2205 */
2206
2207void
2208limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2209{
2210 tSirMsgQ mmhMsg;
2211 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2212
2213 switch(msgType)
2214 {
2215 case WDA_STA_STAT_RSP:
2216 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2217 break;
2218 case WDA_AGGR_STAT_RSP:
2219 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2220 break;
2221 case WDA_GLOBAL_STAT_RSP:
2222 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2223 break;
2224 case WDA_STAT_SUMM_RSP:
2225 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2226 break;
2227 default:
2228 mmhMsg.type = msgType; //Response from within PE
2229 break;
2230 }
2231
2232 pMsgHdr->messageType = mmhMsg.type;
2233
2234 mmhMsg.bodyptr = stats;
2235 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002236 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2238
2239 return;
2240
2241} /*** end limSendSmeStatsRsp() ***/
2242
2243/**
2244 * limSendSmePEStatisticsRsp()
2245 *
2246 *FUNCTION:
2247 * This function is called to send 802.11 statistics response to HDD.
2248 * This function posts the result back to HDD. This is a response to
2249 * HDD's request for statistics.
2250 *
2251 *PARAMS:
2252 *
2253 *LOGIC:
2254 *
2255 *ASSUMPTIONS:
2256 * NA
2257 *
2258 *NOTE:
2259 * NA
2260 *
2261 * @param pMac Pointer to Global MAC structure
2262 * @param p80211Stats Statistics sent in response
2263 * @param resultCode TODO:
2264 *
2265 *
2266 * @return none
2267 */
2268
2269void
2270limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2271{
2272 tSirMsgQ mmhMsg;
2273 tANI_U8 sessionId;
2274 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2275 tpPESession pPeSessionEntry;
2276
2277 //Get the Session Id based on Sta Id
2278 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2279
2280 //Fill the Session Id
2281 if(NULL != pPeSessionEntry)
2282 {
2283 //Fill the Session Id
2284 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2285 }
2286
2287 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2288
2289
2290 //msgType should be WDA_GET_STATISTICS_RSP
2291 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2292
2293 mmhMsg.bodyptr = stats;
2294 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002295 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2297
2298 return;
2299
2300} /*** end limSendSmePEStatisticsRsp() ***/
2301
2302
2303void
2304limSendSmeIBSSPeerInd(
2305 tpAniSirGlobal pMac,
2306 tSirMacAddr peerMacAddr,
2307 tANI_U16 staIndex,
2308 tANI_U8 ucastIdx,
2309 tANI_U8 bcastIdx,
2310 tANI_U8 *beacon,
2311 tANI_U16 beaconLen,
2312 tANI_U16 msgType,
2313 tANI_U8 sessionId)
2314{
2315 tSirMsgQ mmhMsg;
2316 tSmeIbssPeerInd *pNewPeerInd;
2317
Jeff Johnson43971f52012-07-17 12:26:56 -07002318 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 palAllocateMemory(pMac->hHdd,(void * *) &pNewPeerInd,(sizeof(tSmeIbssPeerInd) + beaconLen)))
2320 {
2321 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2322 return;
2323 }
2324
2325 palZeroMemory(pMac->hHdd, (void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen));
2326
2327 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewPeerInd->peerAddr,
2328 peerMacAddr, sizeof(tSirMacAddr));
2329 pNewPeerInd->staId= staIndex;
2330 pNewPeerInd->ucastSig = ucastIdx;
2331 pNewPeerInd->bcastSig = bcastIdx;
2332 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2333 pNewPeerInd->mesgType = msgType;
2334 pNewPeerInd->sessionId = sessionId;
2335
2336 if ( beacon != NULL )
2337 {
2338 palCopyMemory(pMac->hHdd, (void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)), (void*)beacon, beaconLen);
2339 }
2340
2341 mmhMsg.type = msgType;
2342// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2343 mmhMsg.bodyptr = pNewPeerInd;
Jeff Johnsone7245742012-09-05 17:12:55 -07002344 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2346
2347}
2348
2349
2350/** -----------------------------------------------------------------
2351 \brief limSendExitBmpsInd() - sends exit bmps indication
2352
2353 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2354 code to SME. This will trigger SME to get out of BMPS mode.
2355
2356 \param pMac - global mac structure
2357 \param reasonCode - reason for which PE wish to exit BMPS
2358 \return none
2359 \sa
2360 ----------------------------------------------------------------- */
2361void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2362{
2363 tSirMsgQ mmhMsg;
2364 tANI_U16 msgLen = 0;
2365 tpSirSmeExitBmpsInd pExitBmpsInd;
2366
2367 msgLen = sizeof(tSirSmeExitBmpsInd);
2368 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsInd, msgLen ))
2369 {
2370 limLog(pMac, LOGP, FL("palAllocateMemory failed for PMC_EXIT_BMPS_IND \n"));
2371 return;
2372 }
2373 palZeroMemory(pMac->hHdd, pExitBmpsInd, msgLen);
2374
2375#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
2376 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgType, eWNI_PMC_EXIT_BMPS_IND);
2377 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgLen, msgLen);
2378#else
2379 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2380 pExitBmpsInd->mesgLen = msgLen;
2381#endif
2382 pExitBmpsInd->exitBmpsReason = reasonCode;
2383 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2384
2385 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2386 mmhMsg.bodyptr = pExitBmpsInd;
2387 mmhMsg.bodyval = 0;
2388
2389 PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002390 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002391#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2392 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2393#endif //FEATURE_WLAN_DIAG_SUPPORT
2394
2395 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2396 return;
2397
2398} /*** end limSendExitBmpsInd() ***/
2399
2400
2401
2402
2403/*--------------------------------------------------------------------------
2404 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2405
2406
2407 \param pMac - pointer to global adapter context
2408 \param sessionId - Message pointer.
2409
2410 \sa
2411 --------------------------------------------------------------------------*/
2412
2413void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2414{
2415 tpPESession psessionEntry;
2416 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2417 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2418 {
2419 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
2420 return;
2421 }
2422 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2423 {
2424 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2425 }
2426 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2427 {
2428 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2429 }
2430
2431 else
2432 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2433
2434}
2435
2436#ifdef WLAN_FEATURE_VOWIFI_11R
2437/** -----------------------------------------------------------------
2438 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2439 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2440 \ SME only looks at rc and tspec field.
2441 \param pMac - global mac structure
2442 \param rspReqd - is SmeAddTsRsp required
2443 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2444 \return tspec
2445 \sa
2446 ----------------------------------------------------------------- */
2447void
2448limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2449 tANI_U8 smesessionId)
2450{
2451 tSirMsgQ mmhMsg;
2452
2453 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2454 mmhMsg.bodyptr = aggrQosRsp;
2455 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002456 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002457 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2458
2459 return;
2460}
2461#endif
2462
2463/** -----------------------------------------------------------------
2464 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2465 before switching channels for spectrum manangement.
2466
2467 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2468
2469 \param pMac - global mac structure
2470 \return none
2471 \sa
2472 ----------------------------------------------------------------- */
2473void
2474limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2475{
2476 tSirMsgQ mmhMsg;
2477
2478 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2479 mmhMsg.bodyptr = NULL;
2480 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002481 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2483
2484 return;
2485}
2486
2487/** -----------------------------------------------------------------
2488 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2489 after channel switch for spectrum manangement is complete.
2490
2491 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2492
2493 \param pMac - global mac structure
2494 \return none
2495 \sa
2496 ----------------------------------------------------------------- */
2497void
2498limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2499{
2500 tSirMsgQ mmhMsg;
2501
2502 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2503 mmhMsg.bodyptr = NULL;
2504 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002505 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2507
2508 return;
2509}
2510
2511void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2512 tANI_U8 smesessionId)
2513{
2514 tSirMsgQ mmhMsg;
2515 tSmeMaxAssocInd *pSmeMaxAssocInd;
2516
Jeff Johnson43971f52012-07-17 12:26:56 -07002517 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 palAllocateMemory(pMac->hHdd,(void **)&pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd)))
2519 {
2520 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2521 return;
2522 }
2523 palZeroMemory(pMac->hHdd, (void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd));
2524 palCopyMemory( pMac->hHdd, (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2525 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
2526 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2527 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2528 pSmeMaxAssocInd->sessionId = smesessionId;
2529 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2530 mmhMsg.bodyptr = pSmeMaxAssocInd;
2531 PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
2532 "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
2533 peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002534 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2536
2537 return;
2538}