blob: 66b8e233f87fc44028a0facd9f535ef77004ecf5 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 *
44 * Airgo Networks, Inc proprietary. All rights reserved.
45 * limSendMessages.c: Provides functions to send messages or Indications to HAL.
46 * Author: Sunit Bhatia
47 * Date: 09/21/2006
48 * History:-
49 * Date Modified by Modification Information
50 *
51 * --------------------------------------------------------------------------
52 *
53 */
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "limSendMessages.h"
55#include "cfgApi.h"
56#include "limTrace.h"
57#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
58#include "vos_diag_core_log.h"
59#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070060/* When beacon filtering is enabled, firmware will
61 * analyze the selected beacons received during BMPS,
62 * and monitor any changes in the IEs as listed below.
63 * The format of the table is:
64 * - EID
65 * - Check for IE presence
66 * - Byte offset
67 * - Byte value
68 * - Bit Mask
69 * - Byte refrence
70 */
71static tBeaconFilterIe beaconFilterTable[] = {
72 {SIR_MAC_DS_PARAM_SET_EID, 0, {0, 0, DS_PARAM_CHANNEL_MASK, 0}},
73 {SIR_MAC_ERP_INFO_EID, 0, {0, 0, ERP_FILTER_MASK, 0}},
74 {SIR_MAC_EDCA_PARAM_SET_EID, 0, {0, 0, EDCA_FILTER_MASK, 0}},
75 {SIR_MAC_QOS_CAPABILITY_EID, 0, {0, 0, QOS_FILTER_MASK, 0}},
76 {SIR_MAC_CHNL_SWITCH_ANN_EID, 1, {0, 0, 0, 0}},
77 {SIR_MAC_QUIET_EID, 1, {0, 0, 0, 0}},
78 {SIR_MAC_HT_INFO_EID, 0, {0, 0, HT_BYTE0_FILTER_MASK, 0}},
79 {SIR_MAC_HT_INFO_EID, 0, {2, 0, HT_BYTE2_FILTER_MASK, 0}},
80 {SIR_MAC_HT_INFO_EID, 0, {5, 0, HT_BYTE5_FILTER_MASK, 0}}
81#if defined WLAN_FEATURE_VOWIFI
82 ,{SIR_MAC_PWR_CONSTRAINT_EID, 0, {0, 0, 0, 0}}
83#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -070084#ifdef WLAN_FEATURE_11AC
85 ,{SIR_MAC_VHT_OPMODE_EID, 0, {0, 0, 0, 0}}
86#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070087};
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089/**
90 * limSendCFParams()
91 *
92 *FUNCTION:
93 * This function is called to send CFP Parameters to WDA, when they are changed.
94 *
95 *LOGIC:
96 *
97 *ASSUMPTIONS:
98 * NA
99 *
100 *NOTE:
101 * NA
102 *
103 * @param pMac pointer to Global Mac structure.
104 * @param bssIdx Bss Index of the BSS to which STA is associated.
105 * @param cfpCount CFP Count, if that is changed.
106 * @param cfpPeriod CFP Period if that is changed.
107 *
108 * @return success if message send is ok, else false.
109 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700110tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
111{
112 tpUpdateCFParams pCFParams = NULL;
113 tSirRetStatus retCode = eSIR_SUCCESS;
114 tSirMsgQ msgQ;
115
Jeff Johnson295189b2012-06-20 16:38:30 -0700116 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
117 (void **) &pCFParams,
118 sizeof( tUpdateCFParams )))
119 {
120 limLog( pMac, LOGP,
121 FL( "Unable to PAL allocate memory during Update CF Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 retCode = eSIR_MEM_ALLOC_FAILED;
123 goto returnFailure;
124 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 pCFParams->cfpCount = cfpCount;
127 pCFParams->cfpPeriod = cfpPeriod;
128 pCFParams->bssIdx = bssIdx;
129
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 msgQ.type = WDA_UPDATE_CF_IND;
131 msgQ.reserved = 0;
132 msgQ.bodyptr = pCFParams;
133 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700134 limLog( pMac, LOG3,
135 FL( "Sending WDA_UPDATE_CF_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700136 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
138 {
139 palFreeMemory(pMac->hHdd, pCFParams);
140 limLog( pMac, LOGP,
141 FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
142 retCode );
143 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700144returnFailure:
145 return retCode;
146}
147
Jeff Johnson295189b2012-06-20 16:38:30 -0700148/**
149 * limSendBeaconParams()
150 *
151 *FUNCTION:
152 * This function is called to send beacnon interval, short preamble or other
153 * parameters to WDA, which are changed and indication is received in beacon.
154 *
155 *LOGIC:
156 *
157 *ASSUMPTIONS:
158 * NA
159 *
160 *NOTE:
161 * NA
162 *
163 * @param pMac pointer to Global Mac structure.
164 * @param tpUpdateBeaconParams pointer to the structure,
165 which contains the beacon parameters which are changed.
166 *
167 * @return success if message send is ok, else false.
168 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700169tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac,
170 tpUpdateBeaconParams pUpdatedBcnParams,
171 tpPESession psessionEntry )
172{
173 tpUpdateBeaconParams pBcnParams = NULL;
174 tSirRetStatus retCode = eSIR_SUCCESS;
175 tSirMsgQ msgQ;
176
Jeff Johnson295189b2012-06-20 16:38:30 -0700177 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
178 (void **) &pBcnParams, sizeof(*pBcnParams)))
179 {
180 limLog( pMac, LOGP,
181 FL( "Unable to PAL allocate memory during Update Beacon Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700182 return eSIR_MEM_ALLOC_FAILED;
183 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700185 msgQ.type = WDA_UPDATE_BEACON_IND;
186 msgQ.reserved = 0;
187 msgQ.bodyptr = pBcnParams;
188 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 PELOG3(limLog( pMac, LOG3,
190 FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
191 pUpdatedBcnParams->paramChangeBitmap);)
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800192 if(NULL == psessionEntry)
193 {
194 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
195 }
196 else
197 {
198 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
199 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
201 {
202 palFreeMemory(pMac->hHdd, pBcnParams);
203 limLog( pMac, LOGP,
204 FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X\n"),
205 retCode );
206 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700207 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 return retCode;
209}
210
Jeff Johnson295189b2012-06-20 16:38:30 -0700211/**
212 * limSendSwitchChnlParams()
213 *
214 *FUNCTION:
215 * This function is called to send Channel Switch Indication to WDA
216 *
217 *LOGIC:
218 *
219 *ASSUMPTIONS:
220 * NA
221 *
222 *NOTE:
223 * NA
224 *
225 * @param pMac pointer to Global Mac structure.
226 * @param chnlNumber New Channel Number to be switched to.
227 * @param secondaryChnlOffset an enum for secondary channel offset.
228 * @param localPowerConstraint 11h local power constraint value
229 *
230 * @return success if message send is ok, else false.
231 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700232#if !defined WLAN_FEATURE_VOWIFI
233tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
234 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700235 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700236 tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
237#else
238tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
239 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700240 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 tPowerdBm maxTxPower, tANI_U8 peSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -0700242#endif
243{
244 tpSwitchChannelParams pChnlParams = NULL;
245 tSirRetStatus retCode = eSIR_SUCCESS;
246 tSirMsgQ msgQ;
247 tpPESession pSessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -0700248 if((pSessionEntry = peFindSessionBySessionId(pMac , peSessionId)) == NULL)
249 {
250 limLog( pMac, LOGP,
251 FL( "Unable to get Session for session Id %d\n" ), peSessionId);
252 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
255 (void **) &pChnlParams,
256 sizeof( tSwitchChannelParams )))
257 {
258 limLog( pMac, LOGP,
259 FL( "Unable to PAL allocate memory during Switch Channel Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 retCode = eSIR_MEM_ALLOC_FAILED;
261 goto returnFailure;
262 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 palZeroMemory( pMac->hHdd, (tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700264 pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
265 pChnlParams->channelNumber= chnlNumber;
266#if defined WLAN_FEATURE_VOWIFI
267 pChnlParams->maxTxPower = maxTxPower;
268 palCopyMemory( pMac->hHdd, pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
269#else
270 pChnlParams->localPowerConstraint = localPwrConstraint;
271#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 palCopyMemory( pMac->hHdd, pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
273 pChnlParams->peSessionId = peSessionId;
274
275 //we need to defer the message until we get the response back from WDA.
276 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 msgQ.type = WDA_CHNL_SWITCH_REQ;
278 msgQ.reserved = 0;
279 msgQ.bodyptr = pChnlParams;
280 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700281#if defined WLAN_FEATURE_VOWIFI
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 PELOG3(limLog( pMac, LOG3,
283 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
284 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
285#else
286 PELOG3(limLog( pMac, LOG3,
287 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
288 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
289#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700290 MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
292 {
293 palFreeMemory(pMac->hHdd, pChnlParams);
294 limLog( pMac, LOGP,
295 FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X\n"),
296 retCode );
297 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700298returnFailure:
299 return retCode;
300}
301
Jeff Johnson295189b2012-06-20 16:38:30 -0700302/**
303 * limSendEdcaParams()
304 *
305 *FUNCTION:
306 * This function is called to send dynamically changing EDCA Parameters to WDA.
307 *
308 *LOGIC:
309 *
310 *ASSUMPTIONS:
311 * NA
312 *
313 *NOTE:
314 * NA
315 *
316 * @param pMac pointer to Global Mac structure.
317 * @param tpUpdatedEdcaParams pointer to the structure which contains
318 * dynamically changing EDCA parameters.
319 * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true.
320 *
321 * @return success if message send is ok, else false.
322 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700323tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
324{
325 tEdcaParams *pEdcaParams = NULL;
326 tSirRetStatus retCode = eSIR_SUCCESS;
327 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
329 (void **) &pEdcaParams,
330 sizeof(tEdcaParams)))
331 {
332 limLog( pMac, LOGP,
333 FL( "Unable to PAL allocate memory during Update EDCA Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 retCode = eSIR_MEM_ALLOC_FAILED;
335 return retCode;
336 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 pEdcaParams->bssIdx = bssIdx;
338 pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
339 pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
340 pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
341 pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
342 pEdcaParams->highPerformance = highPerformance;
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
344 msgQ.reserved = 0;
345 msgQ.bodyptr = pEdcaParams;
346 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 {
348 tANI_U8 i;
349 PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
350 for(i=0; i<MAX_NUM_AC; i++)
351 {
352 PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d \n"),
353 i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm,
354 pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
355 }
356 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700357 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
359 {
360 palFreeMemory(pMac->hHdd, pEdcaParams);
361 limLog( pMac, LOGP,
362 FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X\n"),
363 retCode );
364 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700365 return retCode;
366}
367
Jeff Johnson295189b2012-06-20 16:38:30 -0700368/**
369 * limSetActiveEdcaParams()
370 *
371 * FUNCTION:
372 * This function is called to set the most up-to-date EDCA parameters
373 * given the default local EDCA parameters. The rules are as following:
374 * - If ACM bit is set for all ACs, then downgrade everything to Best Effort.
375 * - If ACM is not set for any AC, then PE will use the default EDCA
376 * parameters as advertised by AP.
377 * - If ACM is set in any of the ACs, PE will use the EDCA parameters
378 * from the next best AC for which ACM is not enabled.
379 *
380 * @param pMac pointer to Global Mac structure.
381 * @param plocalEdcaParams pointer to the local EDCA parameters
382 * @ param psessionEntry point to the session entry
383 * @return none
384 */
385 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry)
386{
387 tANI_U8 ac, newAc, i;
388 tANI_U8 acAdmitted;
389#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
390 vos_log_qos_edca_pkt_type *log_ptr = NULL;
391#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
393 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
394 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
395 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
396 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 /* An AC requires downgrade if the ACM bit is set, and the AC has not
398 * yet been admitted in uplink or bi-directions.
399 * If an AC requires downgrade, it will downgrade to the next beset AC
400 * for which ACM is not enabled.
401 *
402 * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence
403 * start the for loop with AC_BK.
404 * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then
405 * traverse thru the AC list. If we do find the next best AC which is
406 * better than AC_BE, then use that one. For example, if ACM bits are set
407 * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0
408 * then all AC will be downgraded to AC_BE.
409 */
410 limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] );
411 limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] );
412 for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++)
413 {
414 acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
415 limLog(pMac, LOG1, FL("For AC[%d]: acm=%d, acAdmit=%d \n"), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
417 {
418 limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
419 newAc = EDCA_AC_BE;
420 for (i=ac-1; i>0; i--)
421 {
422 if (plocalEdcaParams[i].aci.acm == 0)
423 {
424 newAc = i;
425 break;
426 }
427 }
428 limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc);
429 psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc];
430 }
431 }
432//log: LOG_WLAN_QOS_EDCA_C
433#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
434 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
435 if(log_ptr)
436 {
437 log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci;
438 log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 |
439 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min;
440 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit;
441 log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci;
442 log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 |
443 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min;
444 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit;
445 log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci;
446 log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 |
447 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min;
448 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit;
449 log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci;
450 log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 |
451 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min;
452 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit;
453 }
454 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
455#endif //FEATURE_WLAN_DIAG_SUPPORT
456
457 return;
458 }
459
Jeff Johnson295189b2012-06-20 16:38:30 -0700460/** ---------------------------------------------------------
461\fn limSetLinkState
462\brief LIM sends a message to WDA to set the link state
463\param tpAniSirGlobal pMac
464\param tSirLinkState state
465\return None
466 -----------------------------------------------------------*/
467 //Original code with out anu's change
468#if 0
469tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId)
470{
471 tSirMsgQ msg;
472 tSirRetStatus retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 msg.type = WDA_SET_LINK_STATE;
474 msg.bodyval = (tANI_U32) state;
475 msg.bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 MTRACE(macTraceMsgTx(pMac, 0, msg.type));
477 retCode = wdaPostCtrlMsg(pMac, &msg);
478 if (retCode != eSIR_SUCCESS)
479 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 return retCode;
481}
482#endif //0
Jeff Johnson295189b2012-06-20 16:38:30 -0700483tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId,
484 tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback,
485 void *callbackArg)
486{
487 tSirMsgQ msgQ;
488 tSirRetStatus retCode;
489 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 // Allocate memory.
491 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
492 (void **) &pLinkStateParams,
493 sizeof(tLinkStateParams)))
494 {
495 limLog( pMac, LOGP,
496 FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
498 return retCode;
499 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 pLinkStateParams->state = state;
502 pLinkStateParams->callback = callback;
503 pLinkStateParams->callbackArg = callbackArg;
504
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 /* Copy Mac address */
506 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
507 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
508
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 msgQ.type = WDA_SET_LINK_STATE;
510 msgQ.reserved = 0;
511 msgQ.bodyptr = pLinkStateParams;
512 msgQ.bodyval = 0;
513
Jeff Johnsone7245742012-09-05 17:12:55 -0700514 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700515
516 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
517 if (retCode != eSIR_SUCCESS)
518 {
519 palFreeMemory(pMac, (void*)pLinkStateParams);
520 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
521 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 return retCode;
523}
Jeff Johnson295189b2012-06-20 16:38:30 -0700524#ifdef WLAN_FEATURE_VOWIFI_11R
525extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
526state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
527{
528 tSirMsgQ msgQ;
529 tSirRetStatus retCode;
530 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 // Allocate memory.
532 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
533 (void **) &pLinkStateParams,
534 sizeof(tLinkStateParams)))
535 {
536 limLog( pMac, LOGP,
537 FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
539 return retCode;
540 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 pLinkStateParams->state = state;
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 /* Copy Mac address */
544 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
545 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
546 pLinkStateParams->ft = 1;
547 pLinkStateParams->session = psessionEntry;
548
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 msgQ.type = WDA_SET_LINK_STATE;
550 msgQ.reserved = 0;
551 msgQ.bodyptr = pLinkStateParams;
552 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800553 if(NULL == psessionEntry)
554 {
555 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
556 }
557 else
558 {
559 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
560 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700561
562 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
563 if (retCode != eSIR_SUCCESS)
564 {
565 palFreeMemory(pMac, (void*)pLinkStateParams);
566 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
567 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 return retCode;
569}
570#endif
571
Jeff Johnson295189b2012-06-20 16:38:30 -0700572/** ---------------------------------------------------------
573\fn limSendSetTxPowerReq
574\brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA
575\param tpAniSirGlobal pMac
576\param tpSirSetTxPowerReq request message
577\return None
578 -----------------------------------------------------------*/
schang86c22c42013-03-13 18:41:24 -0700579tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -0700580{
schang86c22c42013-03-13 18:41:24 -0700581 tSirSetTxPowerReq *txPowerReq;
582 tSirRetStatus retCode = eSIR_SUCCESS;
583 tSirMsgQ msgQ;
584 tpPESession psessionEntry;
585 tANI_U8 sessionId = 0;
586
587 if (NULL == pMsgBuf)
588 return eSIR_FAILURE;
589
590 palAllocateMemory(pMac->hHdd, (void **)&txPowerReq, sizeof(tSirSetTxPowerReq));
591 if (NULL == txPowerReq)
592 {
593 return eSIR_FAILURE;
594 }
595 palCopyMemory(pMac->hHdd, txPowerReq, (tSirSetTxPowerReq *)pMsgBuf, sizeof(tSirSetTxPowerReq));
596
597 /* Found corresponding seesion to find BSS IDX */
598 psessionEntry = peFindSessionByBssid(pMac, txPowerReq->bssId, &sessionId);
599 if (NULL == psessionEntry)
600 {
601 palFreeMemory(pMac->hHdd, (tANI_U8 *) txPowerReq);
602 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
603 return eSIR_FAILURE;
604 }
605
606 /* FW API requests BSS IDX */
607 txPowerReq->bssIdx = psessionEntry->bssIdx;
608
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 msgQ.type = WDA_SET_TX_POWER_REQ;
610 msgQ.reserved = 0;
schang86c22c42013-03-13 18:41:24 -0700611 msgQ.bodyptr = txPowerReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 msgQ.bodyval = 0;
schang86c22c42013-03-13 18:41:24 -0700613 PELOGW(limLog(pMac, LOGW, FL("Sending WDA_SET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700614 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
schang86c22c42013-03-13 18:41:24 -0700615 retCode = wdaPostCtrlMsg(pMac, &msgQ);
616 if (eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 {
schang86c22c42013-03-13 18:41:24 -0700618 limLog(pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode);
619 palFreeMemory(pMac->hHdd, (tANI_U8 *) txPowerReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 return retCode;
621 }
schang86c22c42013-03-13 18:41:24 -0700622
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 return retCode;
624}
Jeff Johnson295189b2012-06-20 16:38:30 -0700625/** ---------------------------------------------------------
626\fn limSendGetTxPowerReq
627\brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA
628\param tpAniSirGlobal pMac
629\param tpSirGetTxPowerReq request message
630\return None
631 -----------------------------------------------------------*/
632tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq)
633{
634 tSirRetStatus retCode = eSIR_SUCCESS;
635 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700636 if (NULL == pTxPowerReq)
637 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700638 msgQ.type = WDA_GET_TX_POWER_REQ;
639 msgQ.reserved = 0;
640 msgQ.bodyptr = pTxPowerReq;
641 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
645 {
646 limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
647 if (NULL != pTxPowerReq)
648 {
649 palFreeMemory( pMac->hHdd, (tANI_U8 *) pTxPowerReq);
650 }
651 return retCode;
652 }
653 return retCode;
654}
Jeff Johnson295189b2012-06-20 16:38:30 -0700655/** ---------------------------------------------------------
656\fn limSendBeaconFilterInfo
657\brief LIM sends beacon filtering info to WDA
658\param tpAniSirGlobal pMac
659\return None
660 -----------------------------------------------------------*/
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700661tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac,tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700662{
663 tpBeaconFilterMsg pBeaconFilterMsg = NULL;
664 tSirRetStatus retCode = eSIR_SUCCESS;
665 tSirMsgQ msgQ;
666 tANI_U8 *ptr;
667 tANI_U32 i;
668 tANI_U32 msgSize;
669 tpBeaconFilterIe pIe;
Jeff Johnson295189b2012-06-20 16:38:30 -0700670
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700671 if( psessionEntry == NULL )
672 {
673 limLog( pMac, LOGE, FL("Fail to find the right session \n"));
674 retCode = eSIR_FAILURE;
675 return retCode;
676 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
678 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
679 (void **) &pBeaconFilterMsg, msgSize) )
680 {
681 limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg \n"));
682 retCode = eSIR_MEM_ALLOC_FAILED;
683 return retCode;
684 }
685 palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconFilterMsg, msgSize);
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 // Fill in capability Info and mask
687 //TBD-RAJESH get the BSS capability from session.
688 //Don't send this message if no active Infra session is found.
689 pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
690 pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 // Fill in number of IEs in beaconFilterTable
693 pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700694 //Fill the BSSIDX
695 pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx;
696
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 //Fill message with info contained in the beaconFilterTable
698 ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
699 for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
700 {
701 pIe = (tpBeaconFilterIe) ptr;
702 pIe->elementId = beaconFilterTable[i].elementId;
703 pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
704 pIe->byte.offset = beaconFilterTable[i].byte.offset;
705 pIe->byte.value = beaconFilterTable[i].byte.value;
706 pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask;
707 pIe->byte.ref = beaconFilterTable[i].byte.ref;
708 ptr += sizeof(tBeaconFilterIe);
709 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 msgQ.type = WDA_BEACON_FILTER_IND;
711 msgQ.reserved = 0;
712 msgQ.bodyptr = pBeaconFilterMsg;
713 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700715 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
717 {
718 palFreeMemory(pMac->hHdd, pBeaconFilterMsg);
719 limLog( pMac, LOGP,
720 FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X\n"),
721 retCode );
722 return retCode;
723 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 return retCode;
725}
Mohit Khanna4a70d262012-09-11 16:30:12 -0700726
727#ifdef WLAN_FEATURE_11AC
728tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac,
729 tUpdateVHTOpMode *pTempParam,
730 tpPESession psessionEntry )
731{
732 tUpdateVHTOpMode *pVhtOpMode = NULL;
733 tSirRetStatus retCode = eSIR_SUCCESS;
734 tSirMsgQ msgQ;
735
736 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
737 (void **) &pVhtOpMode, sizeof(tUpdateVHTOpMode)))
738 {
739 limLog( pMac, LOGP,
740 FL( "Unable to PAL allocate memory during Update Op Mode\n" ));
741 return eSIR_MEM_ALLOC_FAILED;
742 }
743 palCopyMemory( pMac->hHdd, (tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode));
744 msgQ.type = WDA_UPDATE_OP_MODE;
745 msgQ.reserved = 0;
746 msgQ.bodyptr = pVhtOpMode;
747 msgQ.bodyval = 0;
748 PELOG3(limLog( pMac, LOG3,
749 FL( "Sending WDA_UPDATE_OP_MODE" ));)
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800750 if(NULL == psessionEntry)
751 {
752 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
753 }
754 else
755 {
756 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
757 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700758 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
759 {
760 palFreeMemory(pMac->hHdd, pVhtOpMode);
761 limLog( pMac, LOGP,
762 FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X\n"),
763 retCode );
764 }
765
766 return retCode;
767}
768#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800769
770#ifdef FEATURE_WLAN_TDLS_INTERNAL
771/** ---------------------------------------------------------
772\fn limSendTdlsLinkEstablish
773\brief LIM sends a message to HAL to set tdls direct link
774\param tpAniSirGlobal pMac
775\param
776\return None
777 -----------------------------------------------------------*/
778tSirRetStatus limSendTdlsLinkEstablish(tpAniSirGlobal pMac, tANI_U8 bIsPeerResponder, tANI_U8 linkIdenOffset,
779 tANI_U8 ptiBufStatusOffset, tANI_U8 ptiFrameLen, tANI_U8 *ptiFrame, tANI_U8 *extCapability)
780{
781 tSirMsgQ msgQ;
782 tSirRetStatus retCode;
783 tpSirTdlsLinkEstablishInd pTdlsLinkEstablish = NULL;
784
785 // Allocate memory.
786 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
787 (void **) &pTdlsLinkEstablish,
788 sizeof(tSirTdlsLinkEstablishInd)))
789 {
790 limLog( pMac, LOGP,
791 FL( "Unable to PAL allocate memory while sending Tdls Link Establish \n" ));
792
793 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
794 return retCode;
795 }
796
797 palZeroMemory( pMac->hHdd, (tANI_U8 *) pTdlsLinkEstablish, sizeof(tSirTdlsLinkEstablishInd));
798
799 pTdlsLinkEstablish->bIsResponder = !!bIsPeerResponder;
800 pTdlsLinkEstablish->linkIdenOffset = linkIdenOffset;
801 pTdlsLinkEstablish->ptiBufStatusOffset = ptiBufStatusOffset;
802 pTdlsLinkEstablish->ptiTemplateLen = ptiFrameLen;
803 /* Copy ptiFrame template */
804 palCopyMemory( pMac->hHdd, pTdlsLinkEstablish->ptiTemplateBuf, ptiFrame, ptiFrameLen);
805 /* Copy extended capabilities */
806 palCopyMemory( pMac->hHdd, (tANI_U8 *) pTdlsLinkEstablish->extCapability, extCapability, sizeof(pTdlsLinkEstablish->extCapability));
807
808 msgQ.type = SIR_HAL_TDLS_LINK_ESTABLISH;
809 msgQ.reserved = 0;
810 msgQ.bodyptr = pTdlsLinkEstablish;
811 msgQ.bodyval = 0;
812
813 MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
814
815 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
816 if (retCode != eSIR_SUCCESS)
817 {
818 palFreeMemory(pMac, (void*)pTdlsLinkEstablish);
819 limLog(pMac, LOGP, FL("Posting tdls link establish %d failed, reason = %x \n"), retCode);
820 }
821
822 return retCode;
823}
824
825/** ---------------------------------------------------------
826\fn limSendTdlsLinkTeardown
827\brief LIM sends a message to HAL to indicate tdls direct link is teardowned
828\param tpAniSirGlobal pMac
829\param
830\return None
831 -----------------------------------------------------------*/
832tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId)
833{
834 tSirMsgQ msgQ;
835 tSirRetStatus retCode;
836 tpSirTdlsLinkTeardownInd pTdlsLinkTeardown = NULL;
837
838 // Allocate memory.
839 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
840 (void **) &pTdlsLinkTeardown,
841 sizeof(tSirTdlsLinkTeardownInd)))
842 {
843 limLog( pMac, LOGP,
844 FL( "Unable to PAL allocate memory while sending Tdls Link Teardown \n" ));
845
846 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
847 return retCode;
848 }
849
850 palZeroMemory( pMac->hHdd, (tANI_U8 *) pTdlsLinkTeardown, sizeof(tSirTdlsLinkTeardownInd));
851
852 pTdlsLinkTeardown->staId = staId;
853
854 msgQ.type = SIR_HAL_TDLS_LINK_TEARDOWN;
855 msgQ.reserved = 0;
856 msgQ.bodyptr = pTdlsLinkTeardown;
857 msgQ.bodyval = 0;
858
859 MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
860
861 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
862 if (retCode != eSIR_SUCCESS)
863 {
864 palFreeMemory(pMac, (void*)pTdlsLinkTeardown);
865 limLog(pMac, LOGP, FL("Posting tdls link teardown %d failed, reason = %x \n"), retCode);
866 }
867
868 return retCode;
869}
870
871#endif
872