blob: f2e1330f0a996998df131335f449f454f9ceb84f [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;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001153 pSirSmeDisassocInd->reasonCode = reasonCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001154#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;
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001269 pSirSmeDisassocInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001270
1271 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->bssId , psessionEntry->bssId , sizeof(tSirMacAddr));
1272
1273 palCopyMemory( pMac->hHdd, pSirSmeDisassocInd->peerMacAddr , pStaDs->staAddr, sizeof(tSirMacAddr));
1274
1275#ifdef ANI_PRODUCT_TYPE_AP
1276 pSirSmeDisassocInd->aid = pStaDs->assocId;
1277 limStatSerDes(pMac, &pMac->hal.halMac.macStats.pPerStaStats[pStaDs->assocId].staStat,(tANI_U8*)&pSirSmeDisassocInd-> perStaStats );
1278#endif
1279#ifdef WLAN_SOFTAP_FEATURE
1280 pSirSmeDisassocInd->staId = pStaDs->staIndex;
1281#endif
1282
1283 mmhMsg.type = eWNI_SME_DISASSOC_IND;
1284 mmhMsg.bodyptr = pSirSmeDisassocInd;
1285 mmhMsg.bodyval = 0;
1286
Jeff Johnsone7245742012-09-05 17:12:55 -07001287 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001288#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1289 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_IND_EVENT, psessionEntry, 0, (tANI_U16)pStaDs->mlmStaContext.disassocReason);
1290#endif //FEATURE_WLAN_DIAG_SUPPORT
1291
1292 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1293
1294} /*** end limSendSmeDisassocInd() ***/
1295
1296
1297/** -----------------------------------------------------------------
1298 \brief limSendSmeDeauthInd() - sends SME_DEAUTH_IND
1299
1300 After receiving deauthentication frame from peer entity, this
1301 function sends a eWNI_SME_DEAUTH_IND to SME with a specific
1302 reason code.
1303
1304 \param pMac - global mac structure
1305 \param pStaDs - station dph hash node
1306 \return none
1307 \sa
1308 ----------------------------------------------------------------- */
1309void
1310limSendSmeDeauthInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry)
1311{
1312#ifndef WLAN_SOFTAP_FEATURE
1313 tANI_U8 *pBuf;
1314#endif
1315 tSirMsgQ mmhMsg;
1316 tSirSmeDeauthInd *pSirSmeDeauthInd;
1317
1318 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1319 {
1320 limLog(pMac, LOGP, FL("palAllocateMemory failed for eWNI_SME_DEAUTH_IND \n"));
1321 return;
1322 }
1323
1324#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1325 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType, eWNI_SME_DEAUTH_IND);
1326 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length, sizeof(tSirSmeDeauthInd));
1327#else
1328 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1329 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
1330#endif
1331
1332#ifdef WLAN_SOFTAP_FEATURE
1333 pSirSmeDeauthInd->sessionId = psessionEntry->smeSessionId;
1334 pSirSmeDeauthInd->transactionId = psessionEntry->transactionId;
1335 if(eSIR_INFRA_AP_MODE == psessionEntry->bssType)
1336 {
1337 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.cleanupTrigger;
1338 }
1339 else
1340 {
1341 //Need to indicatet he reascon code over the air
1342 pSirSmeDeauthInd->statusCode = (tSirResultCodes)pStaDs->mlmStaContext.disassocReason;
1343 }
1344 //BSSID
1345 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->bssId, psessionEntry->bssId, sizeof(tSirMacAddr));
1346 //peerMacAddr
1347 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, pStaDs->staAddr, sizeof(tSirMacAddr));
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001348 pSirSmeDeauthInd->reasonCode = pStaDs->mlmStaContext.disassocReason;
Jeff Johnson295189b2012-06-20 16:38:30 -07001349#else
1350
1351 //sessionId
1352 pBuf = (tANI_U8 *) &pSirSmeDeauthInd->sessionId;
1353 *pBuf++ = psessionEntry->smeSessionId;
1354
1355 //transactionId
1356 limCopyU16(pBuf, 0);
1357 pBuf += sizeof(tANI_U16);
1358
1359 // status code
1360 limCopyU32(pBuf, pStaDs->mlmStaContext.cleanupTrigger);
1361 pBuf += sizeof(tSirResultCodes);
1362
1363 //bssid
1364 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1365 pBuf += sizeof(tSirMacAddr);
1366
1367 //peerMacAddr
1368 palCopyMemory( pMac->hHdd, pBuf, pStaDs->staAddr, sizeof(tSirMacAddr));
1369#endif
1370
1371#if (WNI_POLARIS_FW_PRODUCT == AP)
1372 pBuf += sizeof(tSirMacAddr);
1373 limCopyU16(pBuf, pStaDs->staAddr);
1374#endif
1375
1376#ifdef WLAN_SOFTAP_FEATURE
1377 pSirSmeDeauthInd->staId = pStaDs->staIndex;
1378#endif
1379
1380 mmhMsg.type = eWNI_SME_DEAUTH_IND;
1381 mmhMsg.bodyptr = pSirSmeDeauthInd;
1382 mmhMsg.bodyval = 0;
1383
Jeff Johnsone7245742012-09-05 17:12:55 -07001384 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001385#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1386 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT, psessionEntry, 0, pStaDs->mlmStaContext.cleanupTrigger);
1387#endif //FEATURE_WLAN_DIAG_SUPPORT
1388
1389 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1390 return;
1391} /*** end limSendSmeDeauthInd() ***/
1392
1393
1394/**
1395 * limSendSmeDeauthNtf()
1396 *
1397 *FUNCTION:
1398 * This function is called by limProcessSmeMessages() to send
1399 * eWNI_SME_DISASSOC_RSP/IND message to host
1400 *
1401 *PARAMS:
1402 *
1403 *LOGIC:
1404 *
1405 *ASSUMPTIONS:
1406 * NA
1407 *
1408 *NOTE:
1409 * This function is used for sending eWNI_SME_DEAUTH_CNF or
1410 * eWNI_SME_DEAUTH_IND to host depending on deauthentication trigger.
1411 *
1412 * @param peerMacAddr Indicates the peer MAC addr to which
1413 * deauthentication was initiated
1414 * @param reasonCode Indicates the reason for Deauthetication
1415 * @param deauthTrigger Indicates the trigger for Deauthetication
1416 * @param aid Indicates the STAID. This parameter is present
1417 * only on AP.
1418 *
1419 * @return None
1420 */
1421void
1422limSendSmeDeauthNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tSirResultCodes reasonCode,
1423 tANI_U16 deauthTrigger, tANI_U16 aid,tANI_U8 smesessionId, tANI_U16 smetransactionId)
1424{
1425 tANI_U8 *pBuf;
1426 tSirSmeDeauthRsp *pSirSmeDeauthRsp;
1427 tSirSmeDeauthInd *pSirSmeDeauthInd;
1428 tpPESession psessionEntry;
1429 tANI_U8 sessionId;
1430 tANI_U32 *pMsg;
1431
1432 psessionEntry = peFindSessionByBssid(pMac,peerMacAddr,&sessionId);
1433 switch (deauthTrigger)
1434 {
1435 case eLIM_PEER_ENTITY_DEAUTH:
1436 return;
1437
1438 case eLIM_HOST_DEAUTH:
1439 /**
1440 * Deauthentication response to host triggered
1441 * deauthentication.
1442 */
1443 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthRsp, sizeof(tSirSmeDeauthRsp)))
1444 {
1445 // Log error
1446 limLog(pMac, LOGP,
1447 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_RSP\n"));
1448
1449 return;
1450 }
1451
1452#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1453 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->messageType),
1454 eWNI_SME_DEAUTH_RSP);
1455 sirStoreU16N((tANI_U8*) &(pSirSmeDeauthRsp->length),
1456 sizeof(tSirSmeDeauthRsp));
1457#else
1458 pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP;
1459 pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp);
1460#endif
1461 pSirSmeDeauthRsp->statusCode = reasonCode;
1462 pSirSmeDeauthRsp->sessionId = smesessionId;
1463 pSirSmeDeauthRsp->transactionId = smetransactionId;
1464
1465 pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr;
1466 palCopyMemory( pMac->hHdd, pBuf, peerMacAddr, sizeof(tSirMacAddr));
1467
1468#if (WNI_POLARIS_FW_PRODUCT == AP)
1469 pBuf += sizeof(tSirMacAddr);
1470 limCopyU16(pBuf, aid);
1471#endif
1472#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1473 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
1474 psessionEntry, 0, (tANI_U16)reasonCode);
1475#endif
1476 pMsg = (tANI_U32*)pSirSmeDeauthRsp;
1477
1478 break;
1479
1480 default:
1481 /**
1482 * Deauthentication indication due to Deauthentication
1483 * frame reception from peer entity or due to
1484 * loss of link with peer entity.
1485 */
1486 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeDeauthInd, sizeof(tSirSmeDeauthInd)))
1487 {
1488 // Log error
1489 limLog(pMac, LOGP,
1490 FL("call to palAllocateMemory failed for eWNI_SME_DEAUTH_Ind\n"));
1491
1492 return;
1493 }
1494
1495#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1496 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->messageType,
1497 eWNI_SME_DEAUTH_IND);
1498 sirStoreU16N((tANI_U8*)&pSirSmeDeauthInd->length,
1499 sizeof(tSirSmeDeauthInd));
1500#else
1501 pSirSmeDeauthInd->messageType = eWNI_SME_DEAUTH_IND;
1502 pSirSmeDeauthInd->length = sizeof(tSirSmeDeauthInd);
Mohit Khanna99d5fd02012-09-11 14:51:20 -07001503 pSirSmeDeauthInd->reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
Jeff Johnson295189b2012-06-20 16:38:30 -07001504#endif
1505
1506 // sessionId
1507 pBuf = (tANI_U8*) &pSirSmeDeauthInd->sessionId;
1508 *pBuf++ = smesessionId;
1509
1510 //transaction ID
1511 limCopyU16(pBuf, smetransactionId);
1512 pBuf += sizeof(tANI_U16);
1513
1514 // status code
1515 limCopyU32(pBuf, reasonCode);
1516 pBuf += sizeof(tSirResultCodes);
1517
1518 //bssId
1519 palCopyMemory( pMac->hHdd, pBuf, psessionEntry->bssId, sizeof(tSirMacAddr));
1520 pBuf += sizeof(tSirMacAddr);
1521
1522 //peerMacAddr
1523 palCopyMemory( pMac->hHdd, pSirSmeDeauthInd->peerMacAddr, peerMacAddr, sizeof(tSirMacAddr));
1524
1525#if (WNI_POLARIS_FW_PRODUCT == AP)
1526 pBuf += sizeof(tSirMacAddr);
1527 limCopyU16(pBuf, aid);
1528#endif
1529#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1530 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_IND_EVENT,
1531 psessionEntry, 0, (tANI_U16)reasonCode);
1532#endif //FEATURE_WLAN_DIAG_SUPPORT
1533 pMsg = (tANI_U32*)pSirSmeDeauthInd;
1534
1535 break;
1536 }
1537
1538 /*Delete the PE session created */
1539 if(psessionEntry != NULL)
1540 {
1541 peDeleteSession(pMac,psessionEntry);
1542 }
1543
1544 if( IS_MCC_SUPPORTED && limIsLinkSuspended( pMac ) )
1545 {
1546 //Resume on the first active session channel.
Jeff Johnsone7245742012-09-05 17:12:55 -07001547 tANI_U8 resumeChannel;
1548 ePhyChanBondState resumePhyCbState;
1549 peGetActiveSessionChannel( pMac, &resumeChannel, &resumePhyCbState );
1550 peSetResumeChannel( pMac, resumeChannel, resumePhyCbState );
Jeff Johnson295189b2012-06-20 16:38:30 -07001551
1552 limResumeLink( pMac, limSendSmeDisassocDeauthNtfPostResume,
1553 (tANI_U32*) pMsg );
1554 }
1555 else
1556 {
1557 limSendSmeDisassocDeauthNtfPostResume( pMac, eHAL_STATUS_SUCCESS,
1558 (tANI_U32*) pMsg );
1559 }
1560} /*** end limSendSmeDeauthNtf() ***/
1561
1562
1563/**
1564 * limSendSmeWmStatusChangeNtf()
1565 *
1566 *FUNCTION:
1567 * This function is called by limProcessSmeMessages() to send
1568 * eWNI_SME_WM_STATUS_CHANGE_NTF message to host.
1569 *
1570 *PARAMS:
1571 *
1572 *LOGIC:
1573 *
1574 *ASSUMPTIONS:
1575 * NA
1576 *
1577 *NOTE:
1578 *
1579 * @param statusChangeCode Indicates the change in the wireless medium.
1580 * @param statusChangeInfo Indicates the information associated with
1581 * change in the wireless medium.
1582 * @param infoLen Indicates the length of status change information
1583 * being sent.
1584 *
1585 * @return None
1586 */
1587void
1588limSendSmeWmStatusChangeNtf(tpAniSirGlobal pMac, tSirSmeStatusChangeCode statusChangeCode,
1589 tANI_U32 *pStatusChangeInfo, tANI_U16 infoLen, tANI_U8 sessionId)
1590{
1591 tSirMsgQ mmhMsg;
1592 tSirSmeWmStatusChangeNtf *pSirSmeWmStatusChangeNtf;
1593 eHalStatus status;
1594#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1595 tANI_U32 bufLen;
1596 tANI_U16 length=0;
1597 tANI_U8 *pBuf;
1598#endif
1599
1600
1601
1602 status = palAllocateMemory( pMac->hHdd, (void **)&pSirSmeWmStatusChangeNtf,
1603 sizeof(tSirSmeWmStatusChangeNtf));
1604 if (status != eHAL_STATUS_SUCCESS)
1605 {
1606 limLog(pMac, LOGE,
1607 FL("call to palAllocateMemory failed for eWNI_SME_WM_STATUS_CHANGE_NTF, status = %d\n"),
1608 status);
1609 return;
1610 }
1611
1612#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1613 pBuf = (tANI_U8 *)pSirSmeWmStatusChangeNtf;
1614#endif
1615
1616 mmhMsg.type = eWNI_SME_WM_STATUS_CHANGE_NTF;
1617 mmhMsg.bodyval = 0;
1618 mmhMsg.bodyptr = pSirSmeWmStatusChangeNtf;
1619
1620 switch(statusChangeCode)
1621 {
1622 case eSIR_SME_RADAR_DETECTED:
1623
1624#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1625 bufLen = sizeof(tSirSmeWmStatusChangeNtf);
1626 if ((limSmeWmStatusChangeHeaderSerDes(pMac,
1627 statusChangeCode,
1628 pBuf,
1629 &length,
1630 bufLen,
1631 sessionId) != eSIR_SUCCESS))
1632 {
1633 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1634 limLog(pMac, LOGP, FL("Header SerDes failed \n"));
1635 return;
1636 }
1637 pBuf += length;
1638 bufLen -= length;
1639 if ((limRadioInfoSerDes(pMac,
1640 (tpSirRadarInfo)pStatusChangeInfo,
1641 pBuf,
1642 &length,
1643 bufLen) != eSIR_SUCCESS))
1644 {
1645 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1646 limLog(pMac, LOGP, FL("Radio Info SerDes failed \n"));
1647 return;
1648 }
1649
1650 pBuf = (tANI_U8 *) pSirSmeWmStatusChangeNtf;
1651 pBuf += sizeof(tANI_U16);
1652 limCopyU16(pBuf, length);
1653#endif
1654 break;
1655
1656 case eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP:
1657#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && (WNI_POLARIS_FW_PRODUCT == AP)
1658
1659 if( eSIR_SUCCESS != nonTitanBssFoundSerDes( pMac,
1660 (tpSirNeighborBssWdsInfo) pStatusChangeInfo,
1661 pBuf,
1662 &length,
1663 sessionId))
1664 {
1665 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1666 limLog( pMac, LOGP,
1667 FL("Unable to serialize nonTitanBssFoundSerDes!\n"));
1668 return;
1669 }
1670#endif
1671 break;
1672
1673 case eSIR_SME_BACKGROUND_SCAN_FAIL:
1674 limPackBkgndScanFailNotify(pMac,
1675 statusChangeCode,
1676 (tpSirBackgroundScanInfo)pStatusChangeInfo,
1677 pSirSmeWmStatusChangeNtf, sessionId);
1678 break;
1679
1680 default:
1681#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1682 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->messageType,
1683 eWNI_SME_WM_STATUS_CHANGE_NTF );
1684 sirStoreU16N((tANI_U8*)&pSirSmeWmStatusChangeNtf->length,
1685 (sizeof(tSirSmeWmStatusChangeNtf)));
1686 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1687 sirStoreU32N((tANI_U8*)&pSirSmeWmStatusChangeNtf->statusChangeCode,
1688 statusChangeCode);
1689#else
1690 pSirSmeWmStatusChangeNtf->messageType = eWNI_SME_WM_STATUS_CHANGE_NTF;
1691 pSirSmeWmStatusChangeNtf->statusChangeCode = statusChangeCode;
1692 pSirSmeWmStatusChangeNtf->length = sizeof(tSirSmeWmStatusChangeNtf);
1693 pSirSmeWmStatusChangeNtf->sessionId = sessionId;
1694#endif
1695 if(sizeof(pSirSmeWmStatusChangeNtf->statusChangeInfo) >= infoLen)
1696 {
1697 palCopyMemory( pMac->hHdd, (tANI_U8 *)&pSirSmeWmStatusChangeNtf->statusChangeInfo, (tANI_U8 *)pStatusChangeInfo, infoLen);
1698 }
1699 limLog(pMac, LOGE, FL("***---*** StatusChg: code 0x%x, length %d ***---***\n"),
1700 statusChangeCode, infoLen);
1701 break;
1702 }
1703
1704
Jeff Johnsone7245742012-09-05 17:12:55 -07001705 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 if (eSIR_SUCCESS != limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT))
1707 {
1708 palFreeMemory(pMac->hHdd, (void *) pSirSmeWmStatusChangeNtf);
1709 limLog( pMac, LOGP, FL("limSysProcessMmhMsgApi failed\n"));
1710 }
1711
1712} /*** end limSendSmeWmStatusChangeNtf() ***/
1713
1714
1715/**
1716 * limSendSmeSetContextRsp()
1717 *
1718 *FUNCTION:
1719 * This function is called by limProcessSmeMessages() to send
1720 * eWNI_SME_SETCONTEXT_RSP message to host
1721 *
1722 *PARAMS:
1723 *
1724 *LOGIC:
1725 *
1726 *ASSUMPTIONS:
1727 * NA
1728 *
1729 *NOTE:
1730 *
1731 * @param pMac Pointer to Global MAC structure
1732 * @param peerMacAddr Indicates the peer MAC addr to which
1733 * setContext was performed
1734 * @param aid Indicates the aid corresponding to the peer MAC
1735 * address
1736 * @param resultCode Indicates the result of previously issued
1737 * eWNI_SME_SETCONTEXT_RSP message
1738 *
1739 * @return None
1740 */
1741void
1742limSendSmeSetContextRsp(tpAniSirGlobal pMac,
1743 tSirMacAddr peerMacAddr, tANI_U16 aid,
1744 tSirResultCodes resultCode,
1745 tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
1746{
1747
1748 tANI_U8 *pBuf;
1749 tSirMsgQ mmhMsg;
1750 tSirSmeSetContextRsp *pSirSmeSetContextRsp;
1751
1752 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeSetContextRsp, sizeof(tSirSmeSetContextRsp)))
1753 {
1754 // Log error
1755 limLog(pMac, LOGP,
1756 FL("call to palAllocateMemory failed for SmeSetContextRsp\n"));
1757
1758 return;
1759 }
1760
1761#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1762 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->messageType,
1763 eWNI_SME_SETCONTEXT_RSP);
1764 sirStoreU16N((tANI_U8*)&pSirSmeSetContextRsp->length,
1765 sizeof(tSirSmeSetContextRsp));
1766#else
1767 pSirSmeSetContextRsp->messageType = eWNI_SME_SETCONTEXT_RSP;
1768 pSirSmeSetContextRsp->length = sizeof(tSirSmeSetContextRsp);
1769#endif
1770 pSirSmeSetContextRsp->statusCode = resultCode;
1771
1772 pBuf = pSirSmeSetContextRsp->peerMacAddr;
1773
1774 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1775 pBuf += sizeof(tSirMacAddr);
1776
1777#if (WNI_POLARIS_FW_PRODUCT == AP)
1778 limCopyU16(pBuf, aid);
1779 pBuf += sizeof(tANI_U16);
1780#endif
1781
1782 /* Update SME session and transaction Id*/
1783 pSirSmeSetContextRsp->sessionId = smesessionId;
1784 pSirSmeSetContextRsp->transactionId = smetransactionId;
1785
1786 mmhMsg.type = eWNI_SME_SETCONTEXT_RSP;
1787 mmhMsg.bodyptr = pSirSmeSetContextRsp;
1788 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001789 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001790
1791#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1792 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, psessionEntry, (tANI_U16)resultCode, 0);
1793#endif //FEATURE_WLAN_DIAG_SUPPORT
1794
1795 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1796} /*** end limSendSmeSetContextRsp() ***/
1797
1798/**
1799 * limSendSmeRemoveKeyRsp()
1800 *
1801 *FUNCTION:
1802 * This function is called by limProcessSmeMessages() to send
1803 * eWNI_SME_REMOVEKEY_RSP message to host
1804 *
1805 *PARAMS:
1806 *
1807 *LOGIC:
1808 *
1809 *ASSUMPTIONS:
1810 * NA
1811 *
1812 *NOTE:
1813 *
1814 * @param pMac Pointer to Global MAC structure
1815 * @param peerMacAddr Indicates the peer MAC addr to which
1816 * Removekey was performed
1817 * @param aid Indicates the aid corresponding to the peer MAC
1818 * address
1819 * @param resultCode Indicates the result of previously issued
1820 * eWNI_SME_REMOVEKEY_RSP message
1821 *
1822 * @return None
1823 */
1824void
1825limSendSmeRemoveKeyRsp(tpAniSirGlobal pMac,
1826 tSirMacAddr peerMacAddr,
1827 tSirResultCodes resultCode,
1828 tpPESession psessionEntry,tANI_U8 smesessionId,
1829 tANI_U16 smetransactionId)
1830{
1831 tANI_U8 *pBuf;
1832 tSirMsgQ mmhMsg;
1833 tSirSmeRemoveKeyRsp *pSirSmeRemoveKeyRsp;
1834
1835 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRemoveKeyRsp, sizeof(tSirSmeRemoveKeyRsp)))
1836 {
1837 // Log error
1838 limLog(pMac, LOGP,
1839 FL("call to palAllocateMemory failed for SmeRemoveKeyRsp\n"));
1840
1841 return;
1842 }
1843
1844#if defined (ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
1845 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->messageType,
1846 eWNI_SME_REMOVEKEY_RSP);
1847 sirStoreU16N((tANI_U8*)&pSirSmeRemoveKeyRsp->length,
1848 sizeof(tSirSmeRemoveKeyRsp));
1849
1850#endif
1851
1852
1853 if(psessionEntry != NULL)
1854 {
1855 pBuf = pSirSmeRemoveKeyRsp->peerMacAddr;
1856 palCopyMemory( pMac->hHdd, pBuf, (tANI_U8 *) peerMacAddr, sizeof(tSirMacAddr));
1857 pBuf += sizeof(tSirMacAddr);
1858 limCopyU32(pBuf, resultCode);
1859 }
1860
1861 pSirSmeRemoveKeyRsp->messageType = eWNI_SME_REMOVEKEY_RSP;
1862 pSirSmeRemoveKeyRsp->length = sizeof(tSirSmeRemoveKeyRsp);
1863 pSirSmeRemoveKeyRsp->statusCode = resultCode;
1864
1865 /* Update SME session and transaction Id*/
1866 pSirSmeRemoveKeyRsp->sessionId = smesessionId;
1867 pSirSmeRemoveKeyRsp->transactionId = smetransactionId;
1868
1869 mmhMsg.type = eWNI_SME_REMOVEKEY_RSP;
1870 mmhMsg.bodyptr = pSirSmeRemoveKeyRsp;
1871 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001872 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1874} /*** end limSendSmeSetContextRsp() ***/
1875
1876
1877/**
1878 * limSendSmePromiscuousModeRsp()
1879 *
1880 *FUNCTION:
1881 * This function is called by limProcessSmeMessages() to send
1882 * eWNI_PROMISCUOUS_MODE_RSP message to host
1883 *
1884 *PARAMS:
1885 *
1886 *LOGIC:
1887 *
1888 *ASSUMPTIONS:
1889 * NA
1890 *
1891 *NOTE:
1892 * This function is used for sending eWNI_SME_PROMISCUOUS_MODE_RSP to
1893 * host as a reply to eWNI_SME_PROMISCUOUS_MODE_REQ directive from it.
1894 *
1895 * @param None
1896 * @return None
1897 */
1898void
1899limSendSmePromiscuousModeRsp(tpAniSirGlobal pMac)
1900{
1901#if 0
1902 tSirMsgQ mmhMsg;
1903 tSirMbMsg *pMbMsg;
1904
1905 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbMsg, sizeof(tSirMbMsg)))
1906 {
1907 // Log error
1908 limLog(pMac, LOGP, FL("call to palAllocateMemory failed\n"));
1909
1910 return;
1911 }
1912
1913 pMbMsg->type = eWNI_SME_PROMISCUOUS_MODE_RSP;
1914 pMbMsg->msgLen = 4;
1915
1916 mmhMsg.type = eWNI_SME_PROMISCUOUS_MODE_RSP;
1917 mmhMsg.bodyptr = pMbMsg;
1918 mmhMsg.bodyval = 0;
1919 MTRACE(macTraceMsgTx(pMac, 0, mmhMsg.type));
1920 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1921#endif
1922} /*** end limSendSmePromiscuousModeRsp() ***/
1923
1924
1925
1926/**
1927 * limSendSmeNeighborBssInd()
1928 *
1929 *FUNCTION:
1930 * This function is called by limLookupNaddHashEntry() to send
1931 * eWNI_SME_NEIGHBOR_BSS_IND message to host
1932 *
1933 *PARAMS:
1934 *
1935 *LOGIC:
1936 *
1937 *ASSUMPTIONS:
1938 * NA
1939 *
1940 *NOTE:
1941 * This function is used for sending eWNI_SME_NEIGHBOR_BSS_IND to
1942 * host upon detecting new BSS during background scanning if CFG
1943 * option is enabled for sending such indication
1944 *
1945 * @param pMac - Pointer to Global MAC structure
1946 * @return None
1947 */
1948
1949void
1950limSendSmeNeighborBssInd(tpAniSirGlobal pMac,
1951 tLimScanResultNode *pBssDescr)
1952{
1953 tSirMsgQ msgQ;
1954 tANI_U32 val;
1955 tSirSmeNeighborBssInd *pNewBssInd;
1956
1957 if ((pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_WT_SCAN_STATE) ||
1958 ((pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_WT_SCAN_STATE) &&
1959 pMac->lim.gLimRspReqd))
1960 {
1961 // LIM is not in background scan state OR
1962 // current scan is initiated by HDD.
1963 // No need to send new BSS indication to HDD
1964 return;
1965 }
1966
1967 if (wlan_cfgGetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, &val) != eSIR_SUCCESS)
1968 {
1969 limLog(pMac, LOGP, FL("could not get NEIGHBOR_BSS_IND from CFG\n"));
1970
1971 return;
1972 }
1973
1974 if (val == 0)
1975 return;
1976
1977 /**
1978 * Need to indicate new BSSs found during
1979 * background scanning to host.
1980 * Allocate buffer for sending indication.
1981 * Length of buffer is length of BSS description
1982 * and length of header itself
1983 */
1984 val = pBssDescr->bssDescription.length + sizeof(tANI_U16) + sizeof(tANI_U32) + sizeof(tANI_U8);
1985 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pNewBssInd, val))
1986 {
1987 // Log error
1988 limLog(pMac, LOGP,
1989 FL("call to palAllocateMemory failed for eWNI_SME_NEIGHBOR_BSS_IND\n"));
1990
1991 return;
1992 }
1993
1994#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
1995 sirStoreU16N((tANI_U8*) &pNewBssInd->messageType,
1996 eWNI_SME_NEIGHBOR_BSS_IND);
1997 sirStoreU16N((tANI_U8*)&pNewBssInd->length, (tANI_U16)val );
1998#else
1999 pNewBssInd->messageType = eWNI_SME_NEIGHBOR_BSS_IND;
2000 pNewBssInd->length = (tANI_U16) val;
2001#endif
2002 pNewBssInd->sessionId = 0;
2003
2004#if (WNI_POLARIS_FW_PRODUCT == WLAN_STA)
2005 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewBssInd->bssDescription,
2006 (tANI_U8 *) &pBssDescr->bssDescription,
2007 pBssDescr->bssDescription.length + sizeof(tANI_U16));
2008#endif
2009
2010 msgQ.type = eWNI_SME_NEIGHBOR_BSS_IND;
2011 msgQ.bodyptr = pNewBssInd;
2012 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002013 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 limSysProcessMmhMsgApi(pMac, &msgQ, ePROT);
2015} /*** end limSendSmeNeighborBssInd() ***/
2016
2017/** -----------------------------------------------------------------
2018 \brief limSendSmeAddtsRsp() - sends SME ADDTS RSP
2019 \ This function sends a eWNI_SME_ADDTS_RSP to SME.
2020 \ SME only looks at rc and tspec field.
2021 \param pMac - global mac structure
2022 \param rspReqd - is SmeAddTsRsp required
2023 \param status - status code of SME_ADD_TS_RSP
2024 \return tspec
2025 \sa
2026 ----------------------------------------------------------------- */
2027void
2028limSendSmeAddtsRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd, tANI_U32 status, tpPESession psessionEntry,
2029 tSirMacTspecIE tspec, tANI_U8 smesessionId, tANI_U16 smetransactionId)
2030{
2031 tpSirAddtsRsp rsp;
2032 tSirMsgQ mmhMsg;
2033
2034 if (! rspReqd)
2035 return;
2036
2037 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2038 {
2039 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_RSP"));
2040 return;
2041 }
2042
2043 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2044 rsp->messageType = eWNI_SME_ADDTS_RSP;
2045 rsp->rc = status;
2046 rsp->rsp.status = (enum eSirMacStatusCodes) status;
2047 //palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp.tspec, (tANI_U8 *) &addts->tspec, sizeof(addts->tspec));
2048 rsp->rsp.tspec = tspec;
2049
2050 /* Update SME session Id and transcation Id */
2051 rsp->sessionId = smesessionId;
2052 rsp->transactionId = smetransactionId;
2053
2054 mmhMsg.type = eWNI_SME_ADDTS_RSP;
2055 mmhMsg.bodyptr = rsp;
2056 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002057 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002058#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2059 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_RSP_EVENT, psessionEntry, 0, 0);
2060#endif //FEATURE_WLAN_DIAG_SUPPORT
2061
2062 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2063 return;
2064}
2065
2066void
2067limSendSmeAddtsInd(tpAniSirGlobal pMac, tpSirAddtsReqInfo addts)
2068{
2069 tpSirAddtsRsp rsp;
2070 tSirMsgQ mmhMsg;
2071
2072 limLog(pMac, LOGW, "SendSmeAddtsInd (token %d, tsid %d, up %d)\n",
2073 addts->dialogToken,
2074 addts->tspec.tsinfo.traffic.tsid,
2075 addts->tspec.tsinfo.traffic.userPrio);
2076
2077 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirAddtsRsp)))
2078 {
2079 // Log error
2080 limLog(pMac, LOGP, FL("palAllocateMemory failed for ADDTS_IND\n"));
2081 return;
2082 }
2083 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2084
2085 rsp->messageType = eWNI_SME_ADDTS_IND;
2086
2087 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) addts, sizeof(*addts));
2088
2089 mmhMsg.type = eWNI_SME_ADDTS_IND;
2090 mmhMsg.bodyptr = rsp;
2091 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002092 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2094}
2095
2096void
2097limSendSmeDeltsRsp(tpAniSirGlobal pMac, tpSirDeltsReq delts, tANI_U32 status,tpPESession psessionEntry,tANI_U8 smesessionId,tANI_U16 smetransactionId)
2098{
2099 tpSirDeltsRsp rsp;
2100 tSirMsgQ mmhMsg;
2101
2102 limLog(pMac, LOGW, "SendSmeDeltsRsp (aid %d, tsid %d, up %d) status %d\n",
2103 delts->aid,
2104 delts->req.tsinfo.traffic.tsid,
2105 delts->req.tsinfo.traffic.userPrio,
2106 status);
2107 if (! delts->rspReqd)
2108 return;
2109
2110 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2111 {
2112 // Log error
2113 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_RSP\n"));
2114 return;
2115 }
2116 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2117
2118 if(psessionEntry != NULL)
2119 {
2120
2121 rsp->aid = delts->aid;
2122 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->macAddr[0], (tANI_U8 *) &delts->macAddr[0], 6);
2123 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) &delts->req, sizeof(tSirDeltsReqInfo));
2124 }
2125
2126
2127 rsp->messageType = eWNI_SME_DELTS_RSP;
2128 rsp->rc = status;
2129
2130 /* Update SME session Id and transcation Id */
2131 rsp->sessionId = smesessionId;
2132 rsp->transactionId = smetransactionId;
2133
2134 mmhMsg.type = eWNI_SME_DELTS_RSP;
2135 mmhMsg.bodyptr = rsp;
2136 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002137 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002138#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2139 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
2140#endif //FEATURE_WLAN_DIAG_SUPPORT
2141
2142 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2143}
2144
2145void
2146limSendSmeDeltsInd(tpAniSirGlobal pMac, tpSirDeltsReqInfo delts, tANI_U16 aid,tpPESession psessionEntry)
2147{
2148 tpSirDeltsRsp rsp;
2149 tSirMsgQ mmhMsg;
2150
2151 limLog(pMac, LOGW, "SendSmeDeltsInd (aid %d, tsid %d, up %d)\n",
2152 aid,
2153 delts->tsinfo.traffic.tsid,
2154 delts->tsinfo.traffic.userPrio);
2155
2156 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp, sizeof(tSirDeltsRsp)))
2157 {
2158 // Log error
2159 limLog(pMac, LOGP, FL("palAllocateMemory failed for DELTS_IND\n"));
2160 return;
2161 }
2162 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
2163
2164 rsp->messageType = eWNI_SME_DELTS_IND;
2165 rsp->rc = eSIR_SUCCESS;
2166 rsp->aid = aid;
2167 palCopyMemory( pMac->hHdd, (tANI_U8 *) &rsp->rsp, (tANI_U8 *) delts, sizeof(*delts));
2168
2169 /* Update SME session Id and SME transaction Id */
2170
2171 rsp->sessionId = psessionEntry->smeSessionId;
2172 rsp->transactionId = psessionEntry->transactionId;
2173
2174 mmhMsg.type = eWNI_SME_DELTS_IND;
2175 mmhMsg.bodyptr = rsp;
2176 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002177 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002178#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2179 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_IND_EVENT, psessionEntry, 0, 0);
2180#endif //FEATURE_WLAN_DIAG_SUPPORT
2181
2182 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2183}
2184
2185/**
2186 * limSendSmeStatsRsp()
2187 *
2188 *FUNCTION:
2189 * This function is called to send 802.11 statistics response to HDD.
2190 * This function posts the result back to HDD. This is a response to
2191 * HDD's request for statistics.
2192 *
2193 *PARAMS:
2194 *
2195 *LOGIC:
2196 *
2197 *ASSUMPTIONS:
2198 * NA
2199 *
2200 *NOTE:
2201 * NA
2202 *
2203 * @param pMac Pointer to Global MAC structure
2204 * @param p80211Stats Statistics sent in response
2205 * @param resultCode TODO:
2206 *
2207 *
2208 * @return none
2209 */
2210
2211void
2212limSendSmeStatsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2213{
2214 tSirMsgQ mmhMsg;
2215 tSirSmeRsp *pMsgHdr = (tSirSmeRsp*) stats;
2216
2217 switch(msgType)
2218 {
2219 case WDA_STA_STAT_RSP:
2220 mmhMsg.type = eWNI_SME_STA_STAT_RSP;
2221 break;
2222 case WDA_AGGR_STAT_RSP:
2223 mmhMsg.type = eWNI_SME_AGGR_STAT_RSP;
2224 break;
2225 case WDA_GLOBAL_STAT_RSP:
2226 mmhMsg.type = eWNI_SME_GLOBAL_STAT_RSP;
2227 break;
2228 case WDA_STAT_SUMM_RSP:
2229 mmhMsg.type = eWNI_SME_STAT_SUMM_RSP;
2230 break;
2231 default:
2232 mmhMsg.type = msgType; //Response from within PE
2233 break;
2234 }
2235
2236 pMsgHdr->messageType = mmhMsg.type;
2237
2238 mmhMsg.bodyptr = stats;
2239 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002240 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2242
2243 return;
2244
2245} /*** end limSendSmeStatsRsp() ***/
2246
2247/**
2248 * limSendSmePEStatisticsRsp()
2249 *
2250 *FUNCTION:
2251 * This function is called to send 802.11 statistics response to HDD.
2252 * This function posts the result back to HDD. This is a response to
2253 * HDD's request for statistics.
2254 *
2255 *PARAMS:
2256 *
2257 *LOGIC:
2258 *
2259 *ASSUMPTIONS:
2260 * NA
2261 *
2262 *NOTE:
2263 * NA
2264 *
2265 * @param pMac Pointer to Global MAC structure
2266 * @param p80211Stats Statistics sent in response
2267 * @param resultCode TODO:
2268 *
2269 *
2270 * @return none
2271 */
2272
2273void
2274limSendSmePEStatisticsRsp(tpAniSirGlobal pMac, tANI_U16 msgType, void* stats)
2275{
2276 tSirMsgQ mmhMsg;
2277 tANI_U8 sessionId;
2278 tAniGetPEStatsRsp *pPeStats = (tAniGetPEStatsRsp *) stats;
2279 tpPESession pPeSessionEntry;
2280
2281 //Get the Session Id based on Sta Id
2282 pPeSessionEntry = peFindSessionByStaId(pMac, pPeStats->staId, &sessionId);
2283
2284 //Fill the Session Id
2285 if(NULL != pPeSessionEntry)
2286 {
2287 //Fill the Session Id
2288 pPeStats->sessionId = pPeSessionEntry->smeSessionId;
2289 }
2290
2291 pPeStats->msgType = eWNI_SME_GET_STATISTICS_RSP;
2292
2293
2294 //msgType should be WDA_GET_STATISTICS_RSP
2295 mmhMsg.type = eWNI_SME_GET_STATISTICS_RSP;
2296
2297 mmhMsg.bodyptr = stats;
2298 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002299 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2301
2302 return;
2303
2304} /*** end limSendSmePEStatisticsRsp() ***/
2305
2306
2307void
2308limSendSmeIBSSPeerInd(
2309 tpAniSirGlobal pMac,
2310 tSirMacAddr peerMacAddr,
2311 tANI_U16 staIndex,
2312 tANI_U8 ucastIdx,
2313 tANI_U8 bcastIdx,
2314 tANI_U8 *beacon,
2315 tANI_U16 beaconLen,
2316 tANI_U16 msgType,
2317 tANI_U8 sessionId)
2318{
2319 tSirMsgQ mmhMsg;
2320 tSmeIbssPeerInd *pNewPeerInd;
2321
Jeff Johnson43971f52012-07-17 12:26:56 -07002322 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 palAllocateMemory(pMac->hHdd,(void * *) &pNewPeerInd,(sizeof(tSmeIbssPeerInd) + beaconLen)))
2324 {
2325 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2326 return;
2327 }
2328
2329 palZeroMemory(pMac->hHdd, (void *) pNewPeerInd, (sizeof(tSmeIbssPeerInd) + beaconLen));
2330
2331 palCopyMemory( pMac->hHdd, (tANI_U8 *) pNewPeerInd->peerAddr,
2332 peerMacAddr, sizeof(tSirMacAddr));
2333 pNewPeerInd->staId= staIndex;
2334 pNewPeerInd->ucastSig = ucastIdx;
2335 pNewPeerInd->bcastSig = bcastIdx;
2336 pNewPeerInd->mesgLen = sizeof(tSmeIbssPeerInd) + beaconLen;
2337 pNewPeerInd->mesgType = msgType;
2338 pNewPeerInd->sessionId = sessionId;
2339
2340 if ( beacon != NULL )
2341 {
2342 palCopyMemory(pMac->hHdd, (void*) ((tANI_U8*)pNewPeerInd+sizeof(tSmeIbssPeerInd)), (void*)beacon, beaconLen);
2343 }
2344
2345 mmhMsg.type = msgType;
2346// mmhMsg.bodyval = (tANI_U32) pNewPeerInd;
2347 mmhMsg.bodyptr = pNewPeerInd;
Jeff Johnsone7245742012-09-05 17:12:55 -07002348 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2350
2351}
2352
2353
2354/** -----------------------------------------------------------------
2355 \brief limSendExitBmpsInd() - sends exit bmps indication
2356
2357 This function sends a eWNI_PMC_EXIT_BMPS_IND with a specific reason
2358 code to SME. This will trigger SME to get out of BMPS mode.
2359
2360 \param pMac - global mac structure
2361 \param reasonCode - reason for which PE wish to exit BMPS
2362 \return none
2363 \sa
2364 ----------------------------------------------------------------- */
2365void limSendExitBmpsInd(tpAniSirGlobal pMac, tExitBmpsReason reasonCode)
2366{
2367 tSirMsgQ mmhMsg;
2368 tANI_U16 msgLen = 0;
2369 tpSirSmeExitBmpsInd pExitBmpsInd;
2370
2371 msgLen = sizeof(tSirSmeExitBmpsInd);
2372 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pExitBmpsInd, msgLen ))
2373 {
2374 limLog(pMac, LOGP, FL("palAllocateMemory failed for PMC_EXIT_BMPS_IND \n"));
2375 return;
2376 }
2377 palZeroMemory(pMac->hHdd, pExitBmpsInd, msgLen);
2378
2379#if defined (ANI_PRODUCT_TYPE_AP) && defined (ANI_LITTLE_BYTE_ENDIAN)
2380 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgType, eWNI_PMC_EXIT_BMPS_IND);
2381 sirStoreU16N((tANI_U8*)&pExitBmpsInd->mesgLen, msgLen);
2382#else
2383 pExitBmpsInd->mesgType = eWNI_PMC_EXIT_BMPS_IND;
2384 pExitBmpsInd->mesgLen = msgLen;
2385#endif
2386 pExitBmpsInd->exitBmpsReason = reasonCode;
2387 pExitBmpsInd->statusCode = eSIR_SME_SUCCESS;
2388
2389 mmhMsg.type = eWNI_PMC_EXIT_BMPS_IND;
2390 mmhMsg.bodyptr = pExitBmpsInd;
2391 mmhMsg.bodyval = 0;
2392
2393 PELOG1(limLog(pMac, LOG1, FL("Sending eWNI_PMC_EXIT_BMPS_IND to SME. \n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07002394 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002395#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2396 limDiagEventReport(pMac, WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, peGetValidPowerSaveSession(pMac), 0, (tANI_U16)reasonCode);
2397#endif //FEATURE_WLAN_DIAG_SUPPORT
2398
2399 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2400 return;
2401
2402} /*** end limSendExitBmpsInd() ***/
2403
2404
2405
2406
2407/*--------------------------------------------------------------------------
2408 \brief peDeleteSession() - Handle the Delete BSS Response from HAL.
2409
2410
2411 \param pMac - pointer to global adapter context
2412 \param sessionId - Message pointer.
2413
2414 \sa
2415 --------------------------------------------------------------------------*/
2416
2417void limHandleDeleteBssRsp(tpAniSirGlobal pMac,tpSirMsgQ MsgQ)
2418{
2419 tpPESession psessionEntry;
2420 tpDeleteBssParams pDelBss = (tpDeleteBssParams)(MsgQ->bodyptr);
2421 if((psessionEntry = peFindSessionBySessionId(pMac,pDelBss->sessionId))==NULL)
2422 {
2423 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
2424 return;
2425 }
2426 if (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE)
2427 {
2428 limIbssDelBssRsp(pMac, MsgQ->bodyptr,psessionEntry);
2429 }
2430 else if(psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE)
2431 {
2432 limProcessSmeDelBssRsp(pMac, MsgQ->bodyval,psessionEntry);
2433 }
2434
2435 else
2436 limProcessMlmDelBssRsp(pMac,MsgQ,psessionEntry);
2437
2438}
2439
2440#ifdef WLAN_FEATURE_VOWIFI_11R
2441/** -----------------------------------------------------------------
2442 \brief limSendSmeAggrQosRsp() - sends SME FT AGGR QOS RSP
2443 \ This function sends a eWNI_SME_FT_AGGR_QOS_RSP to SME.
2444 \ SME only looks at rc and tspec field.
2445 \param pMac - global mac structure
2446 \param rspReqd - is SmeAddTsRsp required
2447 \param status - status code of eWNI_SME_FT_AGGR_QOS_RSP
2448 \return tspec
2449 \sa
2450 ----------------------------------------------------------------- */
2451void
2452limSendSmeAggrQosRsp(tpAniSirGlobal pMac, tpSirAggrQosRsp aggrQosRsp,
2453 tANI_U8 smesessionId)
2454{
2455 tSirMsgQ mmhMsg;
2456
2457 mmhMsg.type = eWNI_SME_FT_AGGR_QOS_RSP;
2458 mmhMsg.bodyptr = aggrQosRsp;
2459 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002460 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2462
2463 return;
2464}
2465#endif
2466
2467/** -----------------------------------------------------------------
2468 \brief limSendSmePreChannelSwitchInd() - sends an indication to SME
2469 before switching channels for spectrum manangement.
2470
2471 This function sends a eWNI_SME_PRE_SWITCH_CHL_IND to SME.
2472
2473 \param pMac - global mac structure
2474 \return none
2475 \sa
2476 ----------------------------------------------------------------- */
2477void
2478limSendSmePreChannelSwitchInd(tpAniSirGlobal pMac)
2479{
2480 tSirMsgQ mmhMsg;
2481
2482 mmhMsg.type = eWNI_SME_PRE_SWITCH_CHL_IND;
2483 mmhMsg.bodyptr = NULL;
2484 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002485 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2487
2488 return;
2489}
2490
2491/** -----------------------------------------------------------------
2492 \brief limSendSmePostChannelSwitchInd() - sends an indication to SME
2493 after channel switch for spectrum manangement is complete.
2494
2495 This function sends a eWNI_SME_POST_SWITCH_CHL_IND to SME.
2496
2497 \param pMac - global mac structure
2498 \return none
2499 \sa
2500 ----------------------------------------------------------------- */
2501void
2502limSendSmePostChannelSwitchInd(tpAniSirGlobal pMac)
2503{
2504 tSirMsgQ mmhMsg;
2505
2506 mmhMsg.type = eWNI_SME_POST_SWITCH_CHL_IND;
2507 mmhMsg.bodyptr = NULL;
2508 mmhMsg.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07002509 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2511
2512 return;
2513}
2514
2515void limSendSmeMaxAssocExceededNtf(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr,
2516 tANI_U8 smesessionId)
2517{
2518 tSirMsgQ mmhMsg;
2519 tSmeMaxAssocInd *pSmeMaxAssocInd;
2520
Jeff Johnson43971f52012-07-17 12:26:56 -07002521 if(eHAL_STATUS_SUCCESS !=
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 palAllocateMemory(pMac->hHdd,(void **)&pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd)))
2523 {
2524 PELOGE(limLog(pMac, LOGE, FL("Failed to allocate memory"));)
2525 return;
2526 }
2527 palZeroMemory(pMac->hHdd, (void *) pSmeMaxAssocInd, sizeof(tSmeMaxAssocInd));
2528 palCopyMemory( pMac->hHdd, (tANI_U8 *)pSmeMaxAssocInd->peerMac,
2529 (tANI_U8 *)peerMacAddr, sizeof(tSirMacAddr));
2530 pSmeMaxAssocInd->mesgType = eWNI_SME_MAX_ASSOC_EXCEEDED;
2531 pSmeMaxAssocInd->mesgLen = sizeof(tSmeMaxAssocInd);
2532 pSmeMaxAssocInd->sessionId = smesessionId;
2533 mmhMsg.type = pSmeMaxAssocInd->mesgType;
2534 mmhMsg.bodyptr = pSmeMaxAssocInd;
2535 PELOG1(limLog(pMac, LOG1, FL("msgType %s peerMacAddr %02x-%02x-%02x-%02x-%02x-%02x"
2536 "sme session id %d\n"),"eWNI_SME_MAX_ASSOC_EXCEEDED", peerMacAddr[0], peerMacAddr[1],
2537 peerMacAddr[2], peerMacAddr[3], peerMacAddr[4], peerMacAddr[5], smesessionId);)
Jeff Johnsone7245742012-09-05 17:12:55 -07002538 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2540
2541 return;
2542}