blob: 3f064aa301313f88c032adfcafa0261e93e7e482 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singhdfe0f742017-01-03 11:26:38 +05302 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
Kiet Lam842dad02014-02-18 18:44:02 -08004 * 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 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
29
30 *
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * limSendMessages.c: Provides functions to send messages or Indications to HAL.
32 * Author: Sunit Bhatia
33 * Date: 09/21/2006
34 * History:-
35 * Date Modified by Modification Information
36 *
37 * --------------------------------------------------------------------------
38 *
39 */
Jeff Johnson295189b2012-06-20 16:38:30 -070040#include "limSendMessages.h"
41#include "cfgApi.h"
42#include "limTrace.h"
43#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
44#include "vos_diag_core_log.h"
45#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -070046/* When beacon filtering is enabled, firmware will
47 * analyze the selected beacons received during BMPS,
48 * and monitor any changes in the IEs as listed below.
49 * The format of the table is:
50 * - EID
51 * - Check for IE presence
52 * - Byte offset
53 * - Byte value
54 * - Bit Mask
55 * - Byte refrence
56 */
57static tBeaconFilterIe beaconFilterTable[] = {
58 {SIR_MAC_DS_PARAM_SET_EID, 0, {0, 0, DS_PARAM_CHANNEL_MASK, 0}},
59 {SIR_MAC_ERP_INFO_EID, 0, {0, 0, ERP_FILTER_MASK, 0}},
60 {SIR_MAC_EDCA_PARAM_SET_EID, 0, {0, 0, EDCA_FILTER_MASK, 0}},
61 {SIR_MAC_QOS_CAPABILITY_EID, 0, {0, 0, QOS_FILTER_MASK, 0}},
62 {SIR_MAC_CHNL_SWITCH_ANN_EID, 1, {0, 0, 0, 0}},
Sandeep Puligilla60342762014-01-30 21:05:37 +053063 {SIR_MAC_HT_INFO_EID, 0, {0, 0, HT_BYTE0_FILTER_MASK, 0}}, //primary channel
64 {SIR_MAC_HT_INFO_EID, 0, {1, 0, HT_BYTE1_FILTER_MASK, 0}}, //Secondary Channel
65 {SIR_MAC_HT_INFO_EID, 0, {2, 0, HT_BYTE2_FILTER_MASK, 0}}, //HT protection
Jeff Johnson295189b2012-06-20 16:38:30 -070066 {SIR_MAC_HT_INFO_EID, 0, {5, 0, HT_BYTE5_FILTER_MASK, 0}}
67#if defined WLAN_FEATURE_VOWIFI
68 ,{SIR_MAC_PWR_CONSTRAINT_EID, 0, {0, 0, 0, 0}}
69#endif
Mohit Khanna4a70d262012-09-11 16:30:12 -070070#ifdef WLAN_FEATURE_11AC
71 ,{SIR_MAC_VHT_OPMODE_EID, 0, {0, 0, 0, 0}}
Kiran Kumar Lokere6e455332013-06-21 19:31:12 -070072 ,{SIR_MAC_VHT_OPERATION_EID, 0, {0, 0, VHTOP_CHWIDTH_MASK, 0}}
Mohit Khanna4a70d262012-09-11 16:30:12 -070073#endif
Abhishek Singh5fef4042014-11-25 18:33:00 +053074 ,{SIR_MAC_RSN_EID, 1, {0, 0, 0, 0}}
75 ,{SIR_MAC_WPA_EID, 1, {0, 0, 0, 0}}
Jeff Johnson295189b2012-06-20 16:38:30 -070076};
77
Jeff Johnson295189b2012-06-20 16:38:30 -070078/**
79 * limSendCFParams()
80 *
81 *FUNCTION:
82 * This function is called to send CFP Parameters to WDA, when they are changed.
83 *
84 *LOGIC:
85 *
86 *ASSUMPTIONS:
87 * NA
88 *
89 *NOTE:
90 * NA
91 *
92 * @param pMac pointer to Global Mac structure.
93 * @param bssIdx Bss Index of the BSS to which STA is associated.
94 * @param cfpCount CFP Count, if that is changed.
95 * @param cfpPeriod CFP Period if that is changed.
96 *
97 * @return success if message send is ok, else false.
98 */
Jeff Johnson295189b2012-06-20 16:38:30 -070099tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod)
100{
101 tpUpdateCFParams pCFParams = NULL;
102 tSirRetStatus retCode = eSIR_SUCCESS;
103 tSirMsgQ msgQ;
104
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530105 pCFParams = vos_mem_malloc(sizeof( tUpdateCFParams ));
106 if ( NULL == pCFParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 {
108 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530109 FL( "Unable to allocate memory during Update CF Params" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700110 retCode = eSIR_MEM_ALLOC_FAILED;
111 goto returnFailure;
112 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530113 vos_mem_set( (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700114 pCFParams->cfpCount = cfpCount;
115 pCFParams->cfpPeriod = cfpPeriod;
116 pCFParams->bssIdx = bssIdx;
117
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 msgQ.type = WDA_UPDATE_CF_IND;
119 msgQ.reserved = 0;
120 msgQ.bodyptr = pCFParams;
121 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700122 limLog( pMac, LOG3,
123 FL( "Sending WDA_UPDATE_CF_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700124 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700125 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
126 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530127 vos_mem_free(pCFParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700129 FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700130 retCode );
131 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700132returnFailure:
133 return retCode;
134}
135
Jeff Johnson295189b2012-06-20 16:38:30 -0700136/**
137 * limSendBeaconParams()
138 *
139 *FUNCTION:
140 * This function is called to send beacnon interval, short preamble or other
141 * parameters to WDA, which are changed and indication is received in beacon.
142 *
143 *LOGIC:
144 *
145 *ASSUMPTIONS:
146 * NA
147 *
148 *NOTE:
149 * NA
150 *
151 * @param pMac pointer to Global Mac structure.
152 * @param tpUpdateBeaconParams pointer to the structure,
153 which contains the beacon parameters which are changed.
154 *
155 * @return success if message send is ok, else false.
156 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700157tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac,
158 tpUpdateBeaconParams pUpdatedBcnParams,
159 tpPESession psessionEntry )
160{
161 tpUpdateBeaconParams pBcnParams = NULL;
162 tSirRetStatus retCode = eSIR_SUCCESS;
163 tSirMsgQ msgQ;
164
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530165 pBcnParams = vos_mem_malloc(sizeof(*pBcnParams));
166 if ( NULL == pBcnParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700167 {
168 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530169 FL( "Unable to allocate memory during Update Beacon Params" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 return eSIR_MEM_ALLOC_FAILED;
171 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530172 vos_mem_copy((tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 msgQ.type = WDA_UPDATE_BEACON_IND;
174 msgQ.reserved = 0;
175 msgQ.bodyptr = pBcnParams;
176 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700177 PELOG3(limLog( pMac, LOG3,
178 FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ),
179 pUpdatedBcnParams->paramChangeBitmap);)
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800180 if(NULL == psessionEntry)
181 {
182 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
183 }
184 else
185 {
186 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
187 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700188 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
189 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530190 vos_mem_free(pBcnParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700191 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700192 FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700193 retCode );
194 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700196 return retCode;
197}
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199/**
200 * limSendSwitchChnlParams()
201 *
202 *FUNCTION:
203 * This function is called to send Channel Switch Indication to WDA
204 *
205 *LOGIC:
206 *
207 *ASSUMPTIONS:
208 * NA
209 *
210 *NOTE:
211 * NA
212 *
213 * @param pMac pointer to Global Mac structure.
214 * @param chnlNumber New Channel Number to be switched to.
215 * @param secondaryChnlOffset an enum for secondary channel offset.
216 * @param localPowerConstraint 11h local power constraint value
217 *
218 * @return success if message send is ok, else false.
219 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700220#if !defined WLAN_FEATURE_VOWIFI
221tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
222 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700223 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 tANI_U8 localPwrConstraint, tANI_U8 peSessionId)
225#else
226tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac,
227 tANI_U8 chnlNumber,
Jeff Johnsone7245742012-09-05 17:12:55 -0700228 ePhyChanBondState secondaryChnlOffset,
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 tPowerdBm maxTxPower, tANI_U8 peSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -0700230#endif
231{
232 tpSwitchChannelParams pChnlParams = NULL;
233 tSirRetStatus retCode = eSIR_SUCCESS;
234 tSirMsgQ msgQ;
235 tpPESession pSessionEntry;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530236 if((pSessionEntry = peFindSessionBySessionId(pMac, peSessionId)) == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 {
238 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700239 FL( "Unable to get Session for session Id %d" ), peSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700241 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530242 pChnlParams = vos_mem_malloc(sizeof( tSwitchChannelParams ));
243 if ( NULL == pChnlParams )
244 {
245 limLog( pMac, LOGP,
246 FL( "Unable to allocate memory during Switch Channel Params" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 retCode = eSIR_MEM_ALLOC_FAILED;
248 goto returnFailure;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530249 }
250 vos_mem_set((tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 pChnlParams->secondaryChannelOffset = secondaryChnlOffset;
252 pChnlParams->channelNumber= chnlNumber;
253#if defined WLAN_FEATURE_VOWIFI
254 pChnlParams->maxTxPower = maxTxPower;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530255 vos_mem_copy( pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700256#else
257 pChnlParams->localPowerConstraint = localPwrConstraint;
258#endif
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530259 vos_mem_copy( pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -0700260 pChnlParams->peSessionId = peSessionId;
Kalikinkar dhara085c02f2014-02-28 15:32:12 -0800261
262 if (LIM_SWITCH_CHANNEL_CSA == pSessionEntry->channelChangeCSA )
263 {
264 pChnlParams->channelSwitchSrc = eHAL_CHANNEL_SWITCH_SOURCE_CSA;
265 pSessionEntry->channelChangeCSA = 0;
266 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 //we need to defer the message until we get the response back from WDA.
268 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 msgQ.type = WDA_CHNL_SWITCH_REQ;
270 msgQ.reserved = 0;
271 msgQ.bodyptr = pChnlParams;
272 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700273#if defined WLAN_FEATURE_VOWIFI
Abhishek Singh127a8442014-12-15 17:31:27 +0530274 limLog( pMac, LOG1,
275 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d,"
276 " ChannelNumber - %d, maxTxPower - %d"),
277 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber,
278 pChnlParams->maxTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -0700279#else
Abhishek Singh127a8442014-12-15 17:31:27 +0530280 limLog( pMac, LOG1,
281 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, "
282 "ChannelNumber - %d, LocalPowerConstraint - %d"),
283 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber,
284 pChnlParams->localPowerConstraint);
Jeff Johnson295189b2012-06-20 16:38:30 -0700285#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700286 MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530287 limLog(pMac,LOG1,"SessionId:%d WDA_CHNL_SWITCH_REQ for SSID:%s",peSessionId,
288 pSessionEntry->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
290 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530291 vos_mem_free(pChnlParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700293 FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 retCode );
295 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700296returnFailure:
297 return retCode;
298}
299
Jeff Johnson295189b2012-06-20 16:38:30 -0700300/**
301 * limSendEdcaParams()
302 *
303 *FUNCTION:
304 * This function is called to send dynamically changing EDCA Parameters to WDA.
305 *
306 *LOGIC:
307 *
308 *ASSUMPTIONS:
309 * NA
310 *
311 *NOTE:
312 * NA
313 *
314 * @param pMac pointer to Global Mac structure.
315 * @param tpUpdatedEdcaParams pointer to the structure which contains
316 * dynamically changing EDCA parameters.
317 * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true.
318 *
319 * @return success if message send is ok, else false.
320 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700321tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
322{
323 tEdcaParams *pEdcaParams = NULL;
324 tSirRetStatus retCode = eSIR_SUCCESS;
325 tSirMsgQ msgQ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530326
327 pEdcaParams = vos_mem_malloc(sizeof(tEdcaParams));
328 if ( NULL == pEdcaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 {
330 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530331 FL( "Unable to allocate memory during Update EDCA Params" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 retCode = eSIR_MEM_ALLOC_FAILED;
333 return retCode;
334 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 pEdcaParams->bssIdx = bssIdx;
336 pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
337 pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
338 pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
339 pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
340 pEdcaParams->highPerformance = highPerformance;
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
342 msgQ.reserved = 0;
343 msgQ.bodyptr = pEdcaParams;
344 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 {
346 tANI_U8 i;
347 PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
348 for(i=0; i<MAX_NUM_AC; i++)
349 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700350 PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm,
352 pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
353 }
354 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700355 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
357 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530358 vos_mem_free(pEdcaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700360 FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 retCode );
362 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 return retCode;
364}
365
Jeff Johnson295189b2012-06-20 16:38:30 -0700366/**
367 * limSetActiveEdcaParams()
368 *
369 * FUNCTION:
370 * This function is called to set the most up-to-date EDCA parameters
371 * given the default local EDCA parameters. The rules are as following:
372 * - If ACM bit is set for all ACs, then downgrade everything to Best Effort.
373 * - If ACM is not set for any AC, then PE will use the default EDCA
374 * parameters as advertised by AP.
375 * - If ACM is set in any of the ACs, PE will use the EDCA parameters
376 * from the next best AC for which ACM is not enabled.
377 *
378 * @param pMac pointer to Global Mac structure.
379 * @param plocalEdcaParams pointer to the local EDCA parameters
380 * @ param psessionEntry point to the session entry
381 * @return none
382 */
383 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry)
384{
385 tANI_U8 ac, newAc, i;
386 tANI_U8 acAdmitted;
387#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
388 vos_log_qos_edca_pkt_type *log_ptr = NULL;
389#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
391 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
392 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
393 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
394 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 /* An AC requires downgrade if the ACM bit is set, and the AC has not
396 * yet been admitted in uplink or bi-directions.
397 * If an AC requires downgrade, it will downgrade to the next beset AC
398 * for which ACM is not enabled.
399 *
400 * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence
401 * start the for loop with AC_BK.
402 * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then
403 * traverse thru the AC list. If we do find the next best AC which is
404 * better than AC_BE, then use that one. For example, if ACM bits are set
405 * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0
406 * then all AC will be downgraded to AC_BE.
407 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700408 limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] );
409 limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] );
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++)
411 {
412 acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700413 limLog(pMac, LOG1, FL("For AC[%d]: acm=%d, acAdmit=%d "), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
415 {
416 limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
417 newAc = EDCA_AC_BE;
418 for (i=ac-1; i>0; i--)
419 {
420 if (plocalEdcaParams[i].aci.acm == 0)
421 {
422 newAc = i;
423 break;
424 }
425 }
426 limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc);
427 psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc];
428 }
429 }
430//log: LOG_WLAN_QOS_EDCA_C
431#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
432 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
433 if(log_ptr)
434 {
435 log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci;
436 log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 |
437 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min;
438 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit;
439 log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci;
440 log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 |
441 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min;
442 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit;
443 log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci;
444 log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 |
445 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min;
446 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit;
447 log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci;
448 log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 |
449 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min;
450 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit;
451 }
452 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
453#endif //FEATURE_WLAN_DIAG_SUPPORT
454
455 return;
456 }
457
Jeff Johnson295189b2012-06-20 16:38:30 -0700458/** ---------------------------------------------------------
459\fn limSetLinkState
460\brief LIM sends a message to WDA to set the link state
461\param tpAniSirGlobal pMac
462\param tSirLinkState state
463\return None
464 -----------------------------------------------------------*/
465 //Original code with out anu's change
466#if 0
467tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId)
468{
469 tSirMsgQ msg;
470 tSirRetStatus retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 msg.type = WDA_SET_LINK_STATE;
472 msg.bodyval = (tANI_U32) state;
473 msg.bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 MTRACE(macTraceMsgTx(pMac, 0, msg.type));
475 retCode = wdaPostCtrlMsg(pMac, &msg);
476 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700477 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 return retCode;
479}
480#endif //0
Jeff Johnson295189b2012-06-20 16:38:30 -0700481tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId,
482 tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback,
483 void *callbackArg)
484{
485 tSirMsgQ msgQ;
486 tSirRetStatus retCode;
487 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530489 pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams));
490 if ( NULL == pLinkStateParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 {
492 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530493 FL( "Unable to allocate memory while sending Set Link State" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
495 return retCode;
496 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530497 vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 pLinkStateParams->state = state;
499 pLinkStateParams->callback = callback;
500 pLinkStateParams->callbackArg = callbackArg;
501
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 /* Copy Mac address */
503 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
504 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
505
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 msgQ.type = WDA_SET_LINK_STATE;
507 msgQ.reserved = 0;
508 msgQ.bodyptr = pLinkStateParams;
509 msgQ.bodyval = 0;
510
Jeff Johnsone7245742012-09-05 17:12:55 -0700511 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700512
513 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
514 if (retCode != eSIR_SUCCESS)
515 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530516 vos_mem_free(pLinkStateParams);
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800517 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "),
518 state, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 return retCode;
521}
Jeff Johnson295189b2012-06-20 16:38:30 -0700522#ifdef WLAN_FEATURE_VOWIFI_11R
523extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
524state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
525{
526 tSirMsgQ msgQ;
527 tSirRetStatus retCode;
528 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530530 pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams));
531 if ( NULL == pLinkStateParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 {
533 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530534 FL( "Unable to allocate memory while sending Set Link State" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
536 return retCode;
537 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530538 vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 pLinkStateParams->state = state;
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 /* Copy Mac address */
541 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
542 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
543 pLinkStateParams->ft = 1;
544 pLinkStateParams->session = psessionEntry;
545
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 msgQ.type = WDA_SET_LINK_STATE;
547 msgQ.reserved = 0;
548 msgQ.bodyptr = pLinkStateParams;
549 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800550 if(NULL == psessionEntry)
551 {
552 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
553 }
554 else
555 {
556 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
557 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700558
559 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
560 if (retCode != eSIR_SUCCESS)
561 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530562 vos_mem_free(pLinkStateParams);
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800563 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "),
564 state, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 return retCode;
567}
568#endif
569
Jeff Johnson295189b2012-06-20 16:38:30 -0700570/** ---------------------------------------------------------
571\fn limSendSetTxPowerReq
572\brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA
573\param tpAniSirGlobal pMac
574\param tpSirSetTxPowerReq request message
575\return None
576 -----------------------------------------------------------*/
schang86c22c42013-03-13 18:41:24 -0700577tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -0700578{
schang86c22c42013-03-13 18:41:24 -0700579 tSirSetTxPowerReq *txPowerReq;
580 tSirRetStatus retCode = eSIR_SUCCESS;
581 tSirMsgQ msgQ;
582 tpPESession psessionEntry;
583 tANI_U8 sessionId = 0;
584
585 if (NULL == pMsgBuf)
586 return eSIR_FAILURE;
587
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530588 txPowerReq = vos_mem_malloc(sizeof(tSirSetTxPowerReq));
589 if ( NULL == txPowerReq )
schang86c22c42013-03-13 18:41:24 -0700590 {
591 return eSIR_FAILURE;
592 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530593 vos_mem_copy(txPowerReq, (tSirSetTxPowerReq *)pMsgBuf, sizeof(tSirSetTxPowerReq));
schang86c22c42013-03-13 18:41:24 -0700594
595 /* Found corresponding seesion to find BSS IDX */
596 psessionEntry = peFindSessionByBssid(pMac, txPowerReq->bssId, &sessionId);
597 if (NULL == psessionEntry)
598 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530599 vos_mem_free(txPowerReq);
schang86c22c42013-03-13 18:41:24 -0700600 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
601 return eSIR_FAILURE;
602 }
603
604 /* FW API requests BSS IDX */
605 txPowerReq->bssIdx = psessionEntry->bssIdx;
606
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 msgQ.type = WDA_SET_TX_POWER_REQ;
608 msgQ.reserved = 0;
schang86c22c42013-03-13 18:41:24 -0700609 msgQ.bodyptr = txPowerReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 msgQ.bodyval = 0;
schang86c22c42013-03-13 18:41:24 -0700611 PELOGW(limLog(pMac, LOGW, FL("Sending WDA_SET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700612 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
schang86c22c42013-03-13 18:41:24 -0700613 retCode = wdaPostCtrlMsg(pMac, &msgQ);
614 if (eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 {
schang86c22c42013-03-13 18:41:24 -0700616 limLog(pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530617 vos_mem_free(txPowerReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 return retCode;
619 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530620 return retCode;
621}
622
623/** ---------------------------------------------------------
624\fn limSendHT40OBSSScanInd
625\brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA
626\param tpAniSirGlobal pMac
627\param psessionEntry session Entry
628\return None
629 -----------------------------------------------------------*/
630tSirRetStatus limSendHT40OBSSScanInd(tpAniSirGlobal pMac,
631 tpPESession psessionEntry)
632{
633 tSirRetStatus retCode = eSIR_SUCCESS;
634 tSirHT40OBSSScanInd *ht40OBSSScanInd;
635 tANI_U32 validChannelNum;
636 tSirMsgQ msgQ;
Mukul Sharmad2b81862014-07-01 21:01:04 +0530637 tANI_U8 validChanList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530638 tANI_U8 channel24GNum, count;
639
640 ht40OBSSScanInd = vos_mem_malloc(sizeof(tSirHT40OBSSScanInd));
641 if ( NULL == ht40OBSSScanInd)
642 {
643 return eSIR_FAILURE;
644 }
645
646 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
647 "OBSS Scan Indication bssIdx- %d staId %d",
648 psessionEntry->bssIdx, psessionEntry->staId);
649
650 ht40OBSSScanInd->cmdType = HT40_OBSS_SCAN_PARAM_START;
651 ht40OBSSScanInd->scanType = eSIR_ACTIVE_SCAN;
652 ht40OBSSScanInd->OBSSScanPassiveDwellTime =
653 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
654 ht40OBSSScanInd->OBSSScanActiveDwellTime =
655 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
656 ht40OBSSScanInd->BSSChannelWidthTriggerScanInterval =
657 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
658 ht40OBSSScanInd->OBSSScanPassiveTotalPerChannel =
659 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
660 ht40OBSSScanInd->OBSSScanActiveTotalPerChannel =
661 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
662 ht40OBSSScanInd->BSSWidthChannelTransitionDelayFactor =
663 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
664 ht40OBSSScanInd->OBSSScanActivityThreshold =
665 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
666 /* TODO update it from the associated BSS*/
Hardik Kantilal Pateld3912032014-11-21 16:54:07 +0530667 ht40OBSSScanInd->currentOperatingClass = 81;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530668
669 validChannelNum = WNI_CFG_VALID_CHANNEL_LIST_LEN;
670 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
671 validChanList,
672 &validChannelNum) != eSIR_SUCCESS)
673 {
674 limLog(pMac, LOGE,
675 FL("could not retrieve Valid channel list"));
Sushant Kaushik5b4c8212015-02-20 14:54:25 +0530676 vos_mem_free(ht40OBSSScanInd);
677 return eSIR_FAILURE;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530678 }
679 /* Extract 24G channel list */
680 channel24GNum = 0;
Masti, Narayanraddi2f5dd652015-03-03 22:00:44 +0530681 for( count =0 ;count < validChannelNum &&
682 (channel24GNum < SIR_ROAM_MAX_CHANNELS);count++)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530683 {
684 if ((validChanList[count]> RF_CHAN_1) &&
685 (validChanList[count] < RF_CHAN_14))
686 {
687 ht40OBSSScanInd->channels[channel24GNum] = validChanList[count];
688 channel24GNum++;
689 }
690 }
691 ht40OBSSScanInd->channelCount = channel24GNum;
692 /* FW API requests BSS IDX */
693 ht40OBSSScanInd->selfStaIdx = psessionEntry->staId;
694 ht40OBSSScanInd->bssIdx = psessionEntry->bssIdx;
695 ht40OBSSScanInd->fortyMHZIntolerent = 0;
696 ht40OBSSScanInd->ieFieldLen = 0;
697
698 msgQ.type = WDA_HT40_OBSS_SCAN_IND;
699 msgQ.reserved = 0;
700 msgQ.bodyptr = (void *)ht40OBSSScanInd;
701 msgQ.bodyval = 0;
Sushant Kaushik2a1fcc82015-01-22 19:32:44 +0530702 limLog(pMac, LOG1, FL("Sending WDA_HT40_OBSS_SCAN_IND to WDA"
703 "Obss Scan trigger width = %d, delay factor = %d"),
704 ht40OBSSScanInd->BSSChannelWidthTriggerScanInterval,
705 ht40OBSSScanInd->BSSWidthChannelTransitionDelayFactor);
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530706 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
707 retCode = wdaPostCtrlMsg(pMac, &msgQ);
708 if (eSIR_SUCCESS != retCode)
709 {
710 limLog(pMac, LOGP, FL("Posting WDA_HT40_OBSS_SCAN_IND "
711 "to WDA failed, reason=%X"), retCode);
712 vos_mem_free(ht40OBSSScanInd);
713 return retCode;
714 }
715 return retCode;
716}
717/** ---------------------------------------------------------
718\fn limSendHT40OBSSScanInd
719\brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA
720\ Stop command support is only for debugging
721\ As per 802.11 spec OBSS scan is mandatory while
722\ operating in HT40 on 2.4GHz band
723\param tpAniSirGlobal pMac
724\param psessionEntry Session entry
725\return None
726 -----------------------------------------------------------*/
727tSirRetStatus limSendHT40OBSSStopScanInd(tpAniSirGlobal pMac,
728 tpPESession psessionEntry)
729{
730 tSirRetStatus retCode = eSIR_SUCCESS;
731 tSirMsgQ msgQ;
732 tANI_U8 bssIdx;
733
734 bssIdx = psessionEntry->bssIdx;
735
736 VOS_TRACE (VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
Sushant Kaushik87787972015-09-11 16:05:00 +0530737 " Sending STOP OBSS cmd, bssid %d staid %d ",
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530738 psessionEntry->bssIdx, psessionEntry->staId);
739
740 msgQ.type = WDA_HT40_OBSS_STOP_SCAN_IND;
741 msgQ.reserved = 0;
742 msgQ.bodyptr = (void *)&bssIdx;
743 msgQ.bodyval = 0;
744 PELOGW(limLog(pMac, LOGW,
745 FL("Sending WDA_HT40_OBSS_STOP_SCAN_IND to WDA"));)
746 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
747 retCode = wdaPostCtrlMsg(pMac, &msgQ);
748 if (eSIR_SUCCESS != retCode)
749 {
750 limLog(pMac, LOGE, FL("Posting WDA_HT40_OBSS_SCAN_IND "
751 "to WDA failed, reason=%X"), retCode);
752 return retCode;
753 }
schang86c22c42013-03-13 18:41:24 -0700754
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 return retCode;
756}
Jeff Johnson295189b2012-06-20 16:38:30 -0700757/** ---------------------------------------------------------
758\fn limSendGetTxPowerReq
759\brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA
760\param tpAniSirGlobal pMac
761\param tpSirGetTxPowerReq request message
762\return None
763 -----------------------------------------------------------*/
764tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq)
765{
766 tSirRetStatus retCode = eSIR_SUCCESS;
767 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 if (NULL == pTxPowerReq)
769 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 msgQ.type = WDA_GET_TX_POWER_REQ;
771 msgQ.reserved = 0;
772 msgQ.bodyptr = pTxPowerReq;
773 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700775 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
777 {
778 limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
779 if (NULL != pTxPowerReq)
780 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530781 vos_mem_free(pTxPowerReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700782 }
783 return retCode;
784 }
785 return retCode;
786}
Jeff Johnson295189b2012-06-20 16:38:30 -0700787/** ---------------------------------------------------------
788\fn limSendBeaconFilterInfo
789\brief LIM sends beacon filtering info to WDA
790\param tpAniSirGlobal pMac
791\return None
792 -----------------------------------------------------------*/
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700793tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac,tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700794{
795 tpBeaconFilterMsg pBeaconFilterMsg = NULL;
796 tSirRetStatus retCode = eSIR_SUCCESS;
797 tSirMsgQ msgQ;
798 tANI_U8 *ptr;
799 tANI_U32 i;
800 tANI_U32 msgSize;
jge414fdc42016-05-09 14:40:02 +0800801 tANI_BOOLEAN ignore_secchannel_bcn_filter = false;
Abhishek Singhdfe0f742017-01-03 11:26:38 +0530802 bool filter_skipped = false;
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 tpBeaconFilterIe pIe;
jge414fdc42016-05-09 14:40:02 +0800804 tpDphHashNode pStaDs;
Jeff Johnson295189b2012-06-20 16:38:30 -0700805
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700806 if( psessionEntry == NULL )
807 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700808 limLog( pMac, LOGE, FL("Fail to find the right session "));
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700809 retCode = eSIR_FAILURE;
810 return retCode;
811 }
Abhishek Singh5fef4042014-11-25 18:33:00 +0530812 /*
813 * Dont send the WPA and RSN iE in filter if FW doesnt support
814 * IS_FEATURE_BCN_FLT_DELTA_ENABLE,
815 * else host will get all beacons which have RSN IE or WPA IE
816 */
817 if(IS_FEATURE_BCN_FLT_DELTA_ENABLE)
818 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
819 else
820 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable) - (2 * sizeof(tBeaconFilterIe));
821
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530822 pBeaconFilterMsg = vos_mem_malloc(msgSize);
823 if ( NULL == pBeaconFilterMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700825 limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700826 retCode = eSIR_MEM_ALLOC_FAILED;
827 return retCode;
828 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530829 vos_mem_set((tANI_U8 *) pBeaconFilterMsg, msgSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 // Fill in capability Info and mask
831 //TBD-RAJESH get the BSS capability from session.
832 //Don't send this message if no active Infra session is found.
833 pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
834 pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 // Fill in number of IEs in beaconFilterTable
Abhishek Singh5fef4042014-11-25 18:33:00 +0530837 /*
838 * Dont send the WPA and RSN iE in filter if FW doesnt support
839 * IS_FEATURE_BCN_FLT_DELTA_ENABLE,
840 * else host will get all beacons which have RSN IE or WPA IE
841 */
842 if(IS_FEATURE_BCN_FLT_DELTA_ENABLE)
843 pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
844 else
845 pBeaconFilterMsg->ieNum = (tANI_U16) ((sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe)) - 2);
846
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700847 //Fill the BSSIDX
848 pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx;
849
jge414fdc42016-05-09 14:40:02 +0800850 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER,
851 &psessionEntry->dph.dphHashTable);
852 if((psessionEntry->currentOperChannel <= RF_CHAN_14) &&
853 ((psessionEntry->htSupportedChannelWidthSet ==
854 eHT_CHANNEL_WIDTH_20MHZ) ||
855 (pStaDs != NULL && (pStaDs->htSupportedChannelWidthSet ==
856 eHT_CHANNEL_WIDTH_20MHZ))))
857 {
858 ignore_secchannel_bcn_filter = true;
859 }
860
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 //Fill message with info contained in the beaconFilterTable
862 ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
863 for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
864 {
jge414fdc42016-05-09 14:40:02 +0800865 /*
866 *Interoperability workaround: TP-LINK TL-WDR6300
867 *The value of Secondary Channel Offset in HT Operation element
868 *of beacon frame switching between 1 and 0, which causes dut(sta)
869 *to wake up frequently.
870 */
871 if((ignore_secchannel_bcn_filter == true) &&
872 (beaconFilterTable[i].elementId == SIR_MAC_HT_INFO_EID) &&
873 (beaconFilterTable[i].byte.offset == 1) &&
874 (beaconFilterTable[i].byte.bitMask == HT_BYTE1_FILTER_MASK))
875 {
876 limLog( pMac, LOGW,
877 FL("Skip Secondary Channel bcn filter when channel is 20Mhz"));
Abhishek Singhdfe0f742017-01-03 11:26:38 +0530878 filter_skipped = true;
jge414fdc42016-05-09 14:40:02 +0800879 continue;
880 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pIe = (tpBeaconFilterIe) ptr;
882 pIe->elementId = beaconFilterTable[i].elementId;
883 pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
884 pIe->byte.offset = beaconFilterTable[i].byte.offset;
885 pIe->byte.value = beaconFilterTable[i].byte.value;
886 pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask;
887 pIe->byte.ref = beaconFilterTable[i].byte.ref;
888 ptr += sizeof(tBeaconFilterIe);
889 }
Abhishek Singhdfe0f742017-01-03 11:26:38 +0530890 if (filter_skipped)
891 pBeaconFilterMsg->ieNum--;
892
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 msgQ.type = WDA_BEACON_FILTER_IND;
894 msgQ.reserved = 0;
895 msgQ.bodyptr = pBeaconFilterMsg;
896 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700898 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
900 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530901 vos_mem_free(pBeaconFilterMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700902 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700903 FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 retCode );
905 return retCode;
906 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 return retCode;
908}
Mohit Khanna4a70d262012-09-11 16:30:12 -0700909
Sandeep Puligilla60342762014-01-30 21:05:37 +0530910/**
911 * \brief Send CB mode update to WDA
912 *
913 * \param pMac Pointer to the global MAC structure
914 *
915 * \param psessionEntry session entry
916 * pTempParam CB mode
917 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
918 */
Mohit Khanna4a70d262012-09-11 16:30:12 -0700919tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac,
920 tUpdateVHTOpMode *pTempParam,
921 tpPESession psessionEntry )
922{
923 tUpdateVHTOpMode *pVhtOpMode = NULL;
924 tSirRetStatus retCode = eSIR_SUCCESS;
925 tSirMsgQ msgQ;
926
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530927 pVhtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
928 if ( NULL == pVhtOpMode )
Mohit Khanna4a70d262012-09-11 16:30:12 -0700929 {
930 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530931 FL( "Unable to allocate memory during Update Op Mode" ));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700932 return eSIR_MEM_ALLOC_FAILED;
933 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530934 vos_mem_copy((tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700935 msgQ.type = WDA_UPDATE_OP_MODE;
936 msgQ.reserved = 0;
937 msgQ.bodyptr = pVhtOpMode;
938 msgQ.bodyval = 0;
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530939 limLog( pMac, LOG1,
940 FL( "Sending WDA_UPDATE_OP_MODE, opMode = %d staid = %d" ),
941 pVhtOpMode->opMode,pVhtOpMode->staId);
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800942 if(NULL == psessionEntry)
943 {
944 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
945 }
946 else
947 {
948 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
949 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700950 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
951 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530952 vos_mem_free(pVhtOpMode);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700953 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700954 FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700955 retCode );
956 }
957
958 return retCode;
959}
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800960
Chet Lanctot186b5732013-03-18 10:26:30 -0700961#ifdef WLAN_FEATURE_11W
962/** ---------------------------------------------------------
963\fn limSendExcludeUnencryptInd
964\brief LIM sends a message to HAL to indicate whether to
965 ignore or indicate the unprotected packet error
966\param tpAniSirGlobal pMac
967\param tANI_BOOLEAN excludeUnenc - true: ignore, false:
968 indicate
969\param tpPESession psessionEntry - session context
970\return status
971 -----------------------------------------------------------*/
972tSirRetStatus limSendExcludeUnencryptInd(tpAniSirGlobal pMac,
973 tANI_BOOLEAN excludeUnenc,
974 tpPESession psessionEntry)
975{
976 tSirRetStatus retCode = eSIR_SUCCESS;
977 tSirMsgQ msgQ;
978 tSirWlanExcludeUnencryptParam * pExcludeUnencryptParam;
979
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530980 pExcludeUnencryptParam = vos_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam));
981 if ( NULL == pExcludeUnencryptParam )
Chet Lanctot186b5732013-03-18 10:26:30 -0700982 {
983 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530984 FL( "Unable to allocate memory during limSendExcludeUnencryptInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -0700985 return eSIR_MEM_ALLOC_FAILED;
986 }
987
988 pExcludeUnencryptParam->excludeUnencrypt = excludeUnenc;
989 sirCopyMacAddr(pExcludeUnencryptParam->bssId, psessionEntry->bssId);
990
991 msgQ.type = WDA_EXCLUDE_UNENCRYPTED_IND;
992 msgQ.reserved = 0;
993 msgQ.bodyptr = pExcludeUnencryptParam;
994 msgQ.bodyval = 0;
Abhishek Singh127a8442014-12-15 17:31:27 +0530995 limLog(pMac, LOG1,
996 FL("Sending WDA_EXCLUDE_UNENCRYPTED_IND"));
Chet Lanctot186b5732013-03-18 10:26:30 -0700997 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Chet Lanctotb2b0d552013-03-22 16:58:44 -0700998 retCode = wdaPostCtrlMsg(pMac, &msgQ);
999 if (eSIR_SUCCESS != retCode)
Chet Lanctot186b5732013-03-18 10:26:30 -07001000 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301001 vos_mem_free(pExcludeUnencryptParam);
Chet Lanctot186b5732013-03-18 10:26:30 -07001002 limLog(pMac, LOGP,
1003 FL("Posting WDA_EXCLUDE_UNENCRYPTED_IND to WDA failed, reason=%X"),
1004 retCode);
1005 }
1006
1007 return retCode;
1008}
1009#endif
1010