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