blob: f1cbc729abda91cdb647cc6328c5e56e836e622b [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 *
24 * Airgo Networks, Inc proprietary. All rights reserved.
25 * limSendMessages.c: Provides functions to send messages or Indications to HAL.
26 * Author: Sunit Bhatia
27 * Date: 09/21/2006
28 * History:-
29 * Date Modified by Modification Information
30 *
31 * --------------------------------------------------------------------------
32 *
33 */
Jeff Johnson295189b2012-06-20 16:38:30 -070034#include "limSendMessages.h"
35#include "cfgApi.h"
36#include "limTrace.h"
37#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
38#include "vos_diag_core_log.h"
39#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070040/* When beacon filtering is enabled, firmware will
41 * analyze the selected beacons received during BMPS,
42 * and monitor any changes in the IEs as listed below.
43 * The format of the table is:
44 * - EID
45 * - Check for IE presence
46 * - Byte offset
47 * - Byte value
48 * - Bit Mask
49 * - Byte refrence
50 */
51static tBeaconFilterIe beaconFilterTable[] = {
52 {SIR_MAC_DS_PARAM_SET_EID, 0, {0, 0, DS_PARAM_CHANNEL_MASK, 0}},
53 {SIR_MAC_ERP_INFO_EID, 0, {0, 0, ERP_FILTER_MASK, 0}},
54 {SIR_MAC_EDCA_PARAM_SET_EID, 0, {0, 0, EDCA_FILTER_MASK, 0}},
55 {SIR_MAC_QOS_CAPABILITY_EID, 0, {0, 0, QOS_FILTER_MASK, 0}},
56 {SIR_MAC_CHNL_SWITCH_ANN_EID, 1, {0, 0, 0, 0}},
57 {SIR_MAC_QUIET_EID, 1, {0, 0, 0, 0}},
58 {SIR_MAC_HT_INFO_EID, 0, {0, 0, HT_BYTE0_FILTER_MASK, 0}},
59 {SIR_MAC_HT_INFO_EID, 0, {2, 0, HT_BYTE2_FILTER_MASK, 0}},
60 {SIR_MAC_HT_INFO_EID, 0, {5, 0, HT_BYTE5_FILTER_MASK, 0}}
61#if defined WLAN_FEATURE_VOWIFI
62 ,{SIR_MAC_PWR_CONSTRAINT_EID, 0, {0, 0, 0, 0}}
63#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -070064#ifdef WLAN_FEATURE_11AC
65 ,{SIR_MAC_VHT_OPMODE_EID, 0, {0, 0, 0, 0}}
66#endif
Jeff Johnson295189b2012-06-20 16:38:30 -070067};
68
Jeff Johnson295189b2012-06-20 16:38:30 -070069/**
70 * limSendCFParams()
71 *
72 *FUNCTION:
73 * This function is called to send CFP Parameters to WDA, when they are changed.
74 *
75 *LOGIC:
76 *
77 *ASSUMPTIONS:
78 * NA
79 *
80 *NOTE:
81 * NA
82 *
83 * @param pMac pointer to Global Mac structure.
84 * @param bssIdx Bss Index of the BSS to which STA is associated.
85 * @param cfpCount CFP Count, if that is changed.
86 * @param cfpPeriod CFP Period if that is changed.
87 *
88 * @return success if message send is ok, else false.
89 */
Jeff Johnson295189b2012-06-20 16:38:30 -070090tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
91{
92 tpUpdateCFParams pCFParams = NULL;
93 tSirRetStatus retCode = eSIR_SUCCESS;
94 tSirMsgQ msgQ;
95
Jeff Johnson295189b2012-06-20 16:38:30 -070096 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
97 (void **) &pCFParams,
98 sizeof( tUpdateCFParams )))
99 {
100 limLog( pMac, LOGP,
101 FL( "Unable to PAL allocate memory during Update CF Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700102 retCode = eSIR_MEM_ALLOC_FAILED;
103 goto returnFailure;
104 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 palZeroMemory( pMac->hHdd, (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 pCFParams->cfpCount = cfpCount;
107 pCFParams->cfpPeriod = cfpPeriod;
108 pCFParams->bssIdx = bssIdx;
109
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 msgQ.type = WDA_UPDATE_CF_IND;
111 msgQ.reserved = 0;
112 msgQ.bodyptr = pCFParams;
113 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700114 limLog( pMac, LOG3,
115 FL( "Sending WDA_UPDATE_CF_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700116 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
118 {
119 palFreeMemory(pMac->hHdd, pCFParams);
120 limLog( pMac, LOGP,
121 FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X\n"),
122 retCode );
123 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700124returnFailure:
125 return retCode;
126}
127
Jeff Johnson295189b2012-06-20 16:38:30 -0700128/**
129 * limSendBeaconParams()
130 *
131 *FUNCTION:
132 * This function is called to send beacnon interval, short preamble or other
133 * parameters to WDA, which are changed and indication is received in beacon.
134 *
135 *LOGIC:
136 *
137 *ASSUMPTIONS:
138 * NA
139 *
140 *NOTE:
141 * NA
142 *
143 * @param pMac pointer to Global Mac structure.
144 * @param tpUpdateBeaconParams pointer to the structure,
145 which contains the beacon parameters which are changed.
146 *
147 * @return success if message send is ok, else false.
148 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700149tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac,
150 tpUpdateBeaconParams pUpdatedBcnParams,
151 tpPESession psessionEntry )
152{
153 tpUpdateBeaconParams pBcnParams = NULL;
154 tSirRetStatus retCode = eSIR_SUCCESS;
155 tSirMsgQ msgQ;
156
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
158 (void **) &pBcnParams, sizeof(*pBcnParams)))
159 {
160 limLog( pMac, LOGP,
161 FL( "Unable to PAL allocate memory during Update Beacon Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700162 return eSIR_MEM_ALLOC_FAILED;
163 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 palCopyMemory( pMac->hHdd, (tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700165 msgQ.type = WDA_UPDATE_BEACON_IND;
166 msgQ.reserved = 0;
167 msgQ.bodyptr = pBcnParams;
168 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700169 PELOG3(limLog( pMac, LOG3,
170 FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
171 pUpdatedBcnParams->paramChangeBitmap);)
Jeff Johnsone7245742012-09-05 17:12:55 -0700172 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
174 {
175 palFreeMemory(pMac->hHdd, pBcnParams);
176 limLog( pMac, LOGP,
177 FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X\n"),
178 retCode );
179 }
180#ifdef WLAN_SOFTAP_FEATURE
181 limSendBeaconInd(pMac, psessionEntry);
182#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 return retCode;
184}
185
Jeff Johnson295189b2012-06-20 16:38:30 -0700186/**
187 * limSendSwitchChnlParams()
188 *
189 *FUNCTION:
190 * This function is called to send Channel Switch Indication to WDA
191 *
192 *LOGIC:
193 *
194 *ASSUMPTIONS:
195 * NA
196 *
197 *NOTE:
198 * NA
199 *
200 * @param pMac pointer to Global Mac structure.
201 * @param chnlNumber New Channel Number to be switched to.
202 * @param secondaryChnlOffset an enum for secondary channel offset.
203 * @param localPowerConstraint 11h local power constraint value
204 *
205 * @return success if message send is ok, else false.
206 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700207#if !defined WLAN_FEATURE_VOWIFI
208tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
209 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700210 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700211 tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
212#else
213tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
214 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700215 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 tPowerdBm maxTxPower, tANI_U8 peSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -0700217#endif
218{
219 tpSwitchChannelParams pChnlParams = NULL;
220 tSirRetStatus retCode = eSIR_SUCCESS;
221 tSirMsgQ msgQ;
222 tpPESession pSessionEntry;
Jeff Johnson295189b2012-06-20 16:38:30 -0700223 if((pSessionEntry = peFindSessionBySessionId(pMac , peSessionId)) == NULL)
224 {
225 limLog( pMac, LOGP,
226 FL( "Unable to get Session for session Id %d\n" ), peSessionId);
227 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700228 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
230 (void **) &pChnlParams,
231 sizeof( tSwitchChannelParams )))
232 {
233 limLog( pMac, LOGP,
234 FL( "Unable to PAL allocate memory during Switch Channel Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 retCode = eSIR_MEM_ALLOC_FAILED;
236 goto returnFailure;
237 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700238 palZeroMemory( pMac->hHdd, (tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700239 pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
240 pChnlParams->channelNumber= chnlNumber;
241#if defined WLAN_FEATURE_VOWIFI
242 pChnlParams->maxTxPower = maxTxPower;
243 palCopyMemory( pMac->hHdd, pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
244#else
245 pChnlParams->localPowerConstraint = localPwrConstraint;
246#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 palCopyMemory( pMac->hHdd, pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
248 pChnlParams->peSessionId = peSessionId;
249
250 //we need to defer the message until we get the response back from WDA.
251 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson295189b2012-06-20 16:38:30 -0700252 msgQ.type = WDA_CHNL_SWITCH_REQ;
253 msgQ.reserved = 0;
254 msgQ.bodyptr = pChnlParams;
255 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700256#if defined WLAN_FEATURE_VOWIFI
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 PELOG3(limLog( pMac, LOG3,
258 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
259 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
260#else
261 PELOG3(limLog( pMac, LOG3,
262 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
263 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
264#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700265 MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700266 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
267 {
268 palFreeMemory(pMac->hHdd, pChnlParams);
269 limLog( pMac, LOGP,
270 FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X\n"),
271 retCode );
272 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700273returnFailure:
274 return retCode;
275}
276
Jeff Johnson295189b2012-06-20 16:38:30 -0700277/**
278 * limSendEdcaParams()
279 *
280 *FUNCTION:
281 * This function is called to send dynamically changing EDCA Parameters to WDA.
282 *
283 *LOGIC:
284 *
285 *ASSUMPTIONS:
286 * NA
287 *
288 *NOTE:
289 * NA
290 *
291 * @param pMac pointer to Global Mac structure.
292 * @param tpUpdatedEdcaParams pointer to the structure which contains
293 * dynamically changing EDCA parameters.
294 * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true.
295 *
296 * @return success if message send is ok, else false.
297 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700298tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
299{
300 tEdcaParams *pEdcaParams = NULL;
301 tSirRetStatus retCode = eSIR_SUCCESS;
302 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
304 (void **) &pEdcaParams,
305 sizeof(tEdcaParams)))
306 {
307 limLog( pMac, LOGP,
308 FL( "Unable to PAL allocate memory during Update EDCA Params\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 retCode = eSIR_MEM_ALLOC_FAILED;
310 return retCode;
311 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 pEdcaParams->bssIdx = bssIdx;
313 pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
314 pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
315 pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
316 pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
317 pEdcaParams->highPerformance = highPerformance;
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
319 msgQ.reserved = 0;
320 msgQ.bodyptr = pEdcaParams;
321 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 {
323 tANI_U8 i;
324 PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
325 for(i=0; i<MAX_NUM_AC; i++)
326 {
327 PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d \n"),
328 i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm,
329 pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
330 }
331 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700332 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
334 {
335 palFreeMemory(pMac->hHdd, pEdcaParams);
336 limLog( pMac, LOGP,
337 FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X\n"),
338 retCode );
339 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 return retCode;
341}
342
Jeff Johnson295189b2012-06-20 16:38:30 -0700343/**
344 * limSetActiveEdcaParams()
345 *
346 * FUNCTION:
347 * This function is called to set the most up-to-date EDCA parameters
348 * given the default local EDCA parameters. The rules are as following:
349 * - If ACM bit is set for all ACs, then downgrade everything to Best Effort.
350 * - If ACM is not set for any AC, then PE will use the default EDCA
351 * parameters as advertised by AP.
352 * - If ACM is set in any of the ACs, PE will use the EDCA parameters
353 * from the next best AC for which ACM is not enabled.
354 *
355 * @param pMac pointer to Global Mac structure.
356 * @param plocalEdcaParams pointer to the local EDCA parameters
357 * @ param psessionEntry point to the session entry
358 * @return none
359 */
360 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry)
361{
362 tANI_U8 ac, newAc, i;
363 tANI_U8 acAdmitted;
364#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
365 vos_log_qos_edca_pkt_type *log_ptr = NULL;
366#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
368 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
369 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
370 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
371 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 /* An AC requires downgrade if the ACM bit is set, and the AC has not
373 * yet been admitted in uplink or bi-directions.
374 * If an AC requires downgrade, it will downgrade to the next beset AC
375 * for which ACM is not enabled.
376 *
377 * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence
378 * start the for loop with AC_BK.
379 * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then
380 * traverse thru the AC list. If we do find the next best AC which is
381 * better than AC_BE, then use that one. For example, if ACM bits are set
382 * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0
383 * then all AC will be downgraded to AC_BE.
384 */
385 limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] );
386 limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x \n"), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] );
387 for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++)
388 {
389 acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
390 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 -0700391 if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
392 {
393 limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
394 newAc = EDCA_AC_BE;
395 for (i=ac-1; i>0; i--)
396 {
397 if (plocalEdcaParams[i].aci.acm == 0)
398 {
399 newAc = i;
400 break;
401 }
402 }
403 limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc);
404 psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc];
405 }
406 }
407//log: LOG_WLAN_QOS_EDCA_C
408#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
409 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
410 if(log_ptr)
411 {
412 log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci;
413 log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 |
414 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min;
415 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit;
416 log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci;
417 log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 |
418 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min;
419 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit;
420 log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci;
421 log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 |
422 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min;
423 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit;
424 log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci;
425 log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 |
426 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min;
427 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit;
428 }
429 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
430#endif //FEATURE_WLAN_DIAG_SUPPORT
431
432 return;
433 }
434
Jeff Johnson295189b2012-06-20 16:38:30 -0700435/** ---------------------------------------------------------
436\fn limSetLinkState
437\brief LIM sends a message to WDA to set the link state
438\param tpAniSirGlobal pMac
439\param tSirLinkState state
440\return None
441 -----------------------------------------------------------*/
442 //Original code with out anu's change
443#if 0
444tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId)
445{
446 tSirMsgQ msg;
447 tSirRetStatus retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 msg.type = WDA_SET_LINK_STATE;
449 msg.bodyval = (tANI_U32) state;
450 msg.bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 MTRACE(macTraceMsgTx(pMac, 0, msg.type));
452 retCode = wdaPostCtrlMsg(pMac, &msg);
453 if (retCode != eSIR_SUCCESS)
454 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 return retCode;
456}
457#endif //0
Jeff Johnson295189b2012-06-20 16:38:30 -0700458tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId,
459 tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback,
460 void *callbackArg)
461{
462 tSirMsgQ msgQ;
463 tSirRetStatus retCode;
464 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 // Allocate memory.
466 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
467 (void **) &pLinkStateParams,
468 sizeof(tLinkStateParams)))
469 {
470 limLog( pMac, LOGP,
471 FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700472 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
473 return retCode;
474 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 pLinkStateParams->state = state;
477 pLinkStateParams->callback = callback;
478 pLinkStateParams->callbackArg = callbackArg;
479
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 /* Copy Mac address */
481 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
482 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
483
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 msgQ.type = WDA_SET_LINK_STATE;
485 msgQ.reserved = 0;
486 msgQ.bodyptr = pLinkStateParams;
487 msgQ.bodyval = 0;
488
Jeff Johnsone7245742012-09-05 17:12:55 -0700489 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490
491 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
492 if (retCode != eSIR_SUCCESS)
493 {
494 palFreeMemory(pMac, (void*)pLinkStateParams);
495 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
496 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 return retCode;
498}
Jeff Johnson295189b2012-06-20 16:38:30 -0700499#ifdef WLAN_FEATURE_VOWIFI_11R
500extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
501state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
502{
503 tSirMsgQ msgQ;
504 tSirRetStatus retCode;
505 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 // Allocate memory.
507 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
508 (void **) &pLinkStateParams,
509 sizeof(tLinkStateParams)))
510 {
511 limLog( pMac, LOGP,
512 FL( "Unable to PAL allocate memory while sending Set Link State\n" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
514 return retCode;
515 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 palZeroMemory( pMac->hHdd, (tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 pLinkStateParams->state = state;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 /* Copy Mac address */
519 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
520 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
521 pLinkStateParams->ft = 1;
522 pLinkStateParams->session = psessionEntry;
523
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 msgQ.type = WDA_SET_LINK_STATE;
525 msgQ.reserved = 0;
526 msgQ.bodyptr = pLinkStateParams;
527 msgQ.bodyval = 0;
528
Jeff Johnsone7245742012-09-05 17:12:55 -0700529 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700530
531 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
532 if (retCode != eSIR_SUCCESS)
533 {
534 palFreeMemory(pMac, (void*)pLinkStateParams);
535 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x \n"), retCode);
536 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 return retCode;
538}
539#endif
540
Jeff Johnson295189b2012-06-20 16:38:30 -0700541/** ---------------------------------------------------------
542\fn limSendSetTxPowerReq
543\brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA
544\param tpAniSirGlobal pMac
545\param tpSirSetTxPowerReq request message
546\return None
547 -----------------------------------------------------------*/
548tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tpSirSetTxPowerReq pTxPowerReq)
549{
550 tSirRetStatus retCode = eSIR_SUCCESS;
551 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 if (NULL == pTxPowerReq)
553 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 msgQ.type = WDA_SET_TX_POWER_REQ;
555 msgQ.reserved = 0;
556 msgQ.bodyptr = pTxPowerReq;
557 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_SET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700559 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
561 {
562 limLog( pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
563 if (NULL != pTxPowerReq)
564 {
565 palFreeMemory( pMac->hHdd, (tANI_U8 *) pTxPowerReq);
566 }
567 return retCode;
568 }
569 return retCode;
570}
Jeff Johnson295189b2012-06-20 16:38:30 -0700571/** ---------------------------------------------------------
572\fn limSendGetTxPowerReq
573\brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA
574\param tpAniSirGlobal pMac
575\param tpSirGetTxPowerReq request message
576\return None
577 -----------------------------------------------------------*/
578tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq)
579{
580 tSirRetStatus retCode = eSIR_SUCCESS;
581 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 if (NULL == pTxPowerReq)
583 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 msgQ.type = WDA_GET_TX_POWER_REQ;
585 msgQ.reserved = 0;
586 msgQ.bodyptr = pTxPowerReq;
587 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700589 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
591 {
592 limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
593 if (NULL != pTxPowerReq)
594 {
595 palFreeMemory( pMac->hHdd, (tANI_U8 *) pTxPowerReq);
596 }
597 return retCode;
598 }
599 return retCode;
600}
Jeff Johnson295189b2012-06-20 16:38:30 -0700601/** ---------------------------------------------------------
602\fn limSendBeaconFilterInfo
603\brief LIM sends beacon filtering info to WDA
604\param tpAniSirGlobal pMac
605\return None
606 -----------------------------------------------------------*/
607tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac)
608{
609 tpBeaconFilterMsg pBeaconFilterMsg = NULL;
610 tSirRetStatus retCode = eSIR_SUCCESS;
611 tSirMsgQ msgQ;
612 tANI_U8 *ptr;
613 tANI_U32 i;
614 tANI_U32 msgSize;
615 tpBeaconFilterIe pIe;
616 tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH get the sessionEntry from the caller
617
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
619 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
620 (void **) &pBeaconFilterMsg, msgSize) )
621 {
622 limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg \n"));
623 retCode = eSIR_MEM_ALLOC_FAILED;
624 return retCode;
625 }
626 palZeroMemory( pMac->hHdd, (tANI_U8 *) pBeaconFilterMsg, msgSize);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 // Fill in capability Info and mask
628 //TBD-RAJESH get the BSS capability from session.
629 //Don't send this message if no active Infra session is found.
630 pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
631 pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 // Fill in number of IEs in beaconFilterTable
634 pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
Jeff Johnson295189b2012-06-20 16:38:30 -0700635 //Fill message with info contained in the beaconFilterTable
636 ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
637 for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
638 {
639 pIe = (tpBeaconFilterIe) ptr;
640 pIe->elementId = beaconFilterTable[i].elementId;
641 pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
642 pIe->byte.offset = beaconFilterTable[i].byte.offset;
643 pIe->byte.value = beaconFilterTable[i].byte.value;
644 pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask;
645 pIe->byte.ref = beaconFilterTable[i].byte.ref;
646 ptr += sizeof(tBeaconFilterIe);
647 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 msgQ.type = WDA_BEACON_FILTER_IND;
649 msgQ.reserved = 0;
650 msgQ.bodyptr = pBeaconFilterMsg;
651 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700653 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
655 {
656 palFreeMemory(pMac->hHdd, pBeaconFilterMsg);
657 limLog( pMac, LOGP,
658 FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X\n"),
659 retCode );
660 return retCode;
661 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 return retCode;
663}
Mohit Khanna4a70d262012-09-11 16:30:12 -0700664
665#ifdef WLAN_FEATURE_11AC
666tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac,
667 tUpdateVHTOpMode *pTempParam,
668 tpPESession psessionEntry )
669{
670 tUpdateVHTOpMode *pVhtOpMode = NULL;
671 tSirRetStatus retCode = eSIR_SUCCESS;
672 tSirMsgQ msgQ;
673
674 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
675 (void **) &pVhtOpMode, sizeof(tUpdateVHTOpMode)))
676 {
677 limLog( pMac, LOGP,
678 FL( "Unable to PAL allocate memory during Update Op Mode\n" ));
679 return eSIR_MEM_ALLOC_FAILED;
680 }
681 palCopyMemory( pMac->hHdd, (tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode));
682 msgQ.type = WDA_UPDATE_OP_MODE;
683 msgQ.reserved = 0;
684 msgQ.bodyptr = pVhtOpMode;
685 msgQ.bodyval = 0;
686 PELOG3(limLog( pMac, LOG3,
687 FL( "Sending WDA_UPDATE_OP_MODE" ));)
688 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
689 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
690 {
691 palFreeMemory(pMac->hHdd, pVhtOpMode);
692 limLog( pMac, LOGP,
693 FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X\n"),
694 retCode );
695 }
696
697 return retCode;
698}
699#endif