blob: b71640f94f1331c2e2a2dd72e749e00ee19d96bf [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2011-2014 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
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 PELOG3(limLog( pMac, LOG3,
275 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"),
276 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);)
277#else
278 PELOG3(limLog( pMac, LOG3,
279 FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"),
280 pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);)
281#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700282 MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type));
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530283 limLog(pMac,LOG1,"SessionId:%d WDA_CHNL_SWITCH_REQ for SSID:%s",peSessionId,
284 pSessionEntry->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
286 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530287 vos_mem_free(pChnlParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700289 FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 retCode );
291 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700292returnFailure:
293 return retCode;
294}
295
Jeff Johnson295189b2012-06-20 16:38:30 -0700296/**
297 * limSendEdcaParams()
298 *
299 *FUNCTION:
300 * This function is called to send dynamically changing EDCA Parameters to WDA.
301 *
302 *LOGIC:
303 *
304 *ASSUMPTIONS:
305 * NA
306 *
307 *NOTE:
308 * NA
309 *
310 * @param pMac pointer to Global Mac structure.
311 * @param tpUpdatedEdcaParams pointer to the structure which contains
312 * dynamically changing EDCA parameters.
313 * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true.
314 *
315 * @return success if message send is ok, else false.
316 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700317tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance)
318{
319 tEdcaParams *pEdcaParams = NULL;
320 tSirRetStatus retCode = eSIR_SUCCESS;
321 tSirMsgQ msgQ;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530322
323 pEdcaParams = vos_mem_malloc(sizeof(tEdcaParams));
324 if ( NULL == pEdcaParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 {
326 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530327 FL( "Unable to allocate memory during Update EDCA Params" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 retCode = eSIR_MEM_ALLOC_FAILED;
329 return retCode;
330 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 pEdcaParams->bssIdx = bssIdx;
332 pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE];
333 pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK];
334 pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI];
335 pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO];
336 pEdcaParams->highPerformance = highPerformance;
Jeff Johnson295189b2012-06-20 16:38:30 -0700337 msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND;
338 msgQ.reserved = 0;
339 msgQ.bodyptr = pEdcaParams;
340 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 {
342 tANI_U8 i;
343 PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));)
344 for(i=0; i<MAX_NUM_AC; i++)
345 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700346 PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm,
348 pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);)
349 }
350 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700351 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
353 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530354 vos_mem_free(pEdcaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700356 FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 retCode );
358 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 return retCode;
360}
361
Jeff Johnson295189b2012-06-20 16:38:30 -0700362/**
363 * limSetActiveEdcaParams()
364 *
365 * FUNCTION:
366 * This function is called to set the most up-to-date EDCA parameters
367 * given the default local EDCA parameters. The rules are as following:
368 * - If ACM bit is set for all ACs, then downgrade everything to Best Effort.
369 * - If ACM is not set for any AC, then PE will use the default EDCA
370 * parameters as advertised by AP.
371 * - If ACM is set in any of the ACs, PE will use the EDCA parameters
372 * from the next best AC for which ACM is not enabled.
373 *
374 * @param pMac pointer to Global Mac structure.
375 * @param plocalEdcaParams pointer to the local EDCA parameters
376 * @ param psessionEntry point to the session entry
377 * @return none
378 */
379 void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry)
380{
381 tANI_U8 ac, newAc, i;
382 tANI_U8 acAdmitted;
383#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
384 vos_log_qos_edca_pkt_type *log_ptr = NULL;
385#endif //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams
387 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE];
388 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK];
389 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI];
390 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO];
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 /* An AC requires downgrade if the ACM bit is set, and the AC has not
392 * yet been admitted in uplink or bi-directions.
393 * If an AC requires downgrade, it will downgrade to the next beset AC
394 * for which ACM is not enabled.
395 *
396 * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence
397 * start the for loop with AC_BK.
398 * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then
399 * traverse thru the AC list. If we do find the next best AC which is
400 * better than AC_BE, then use that one. For example, if ACM bits are set
401 * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0
402 * then all AC will be downgraded to AC_BE.
403 */
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700404 limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] );
405 limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] );
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++)
407 {
408 acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac );
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700409 limLog(pMac, LOG1, FL("For AC[%d]: acm=%d, acAdmit=%d "), ac, plocalEdcaParams[ac].aci.acm, acAdmitted);
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) )
411 {
412 limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac);
413 newAc = EDCA_AC_BE;
414 for (i=ac-1; i>0; i--)
415 {
416 if (plocalEdcaParams[i].aci.acm == 0)
417 {
418 newAc = i;
419 break;
420 }
421 }
422 limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc);
423 psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc];
424 }
425 }
426//log: LOG_WLAN_QOS_EDCA_C
427#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
428 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
429 if(log_ptr)
430 {
431 log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci;
432 log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 |
433 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min;
434 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit;
435 log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci;
436 log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 |
437 psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min;
438 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit;
439 log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci;
440 log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 |
441 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min;
442 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit;
443 log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci;
444 log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 |
445 psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min;
446 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit;
447 }
448 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
449#endif //FEATURE_WLAN_DIAG_SUPPORT
450
451 return;
452 }
453
Jeff Johnson295189b2012-06-20 16:38:30 -0700454/** ---------------------------------------------------------
455\fn limSetLinkState
456\brief LIM sends a message to WDA to set the link state
457\param tpAniSirGlobal pMac
458\param tSirLinkState state
459\return None
460 -----------------------------------------------------------*/
461 //Original code with out anu's change
462#if 0
463tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId)
464{
465 tSirMsgQ msg;
466 tSirRetStatus retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 msg.type = WDA_SET_LINK_STATE;
468 msg.bodyval = (tANI_U32) state;
469 msg.bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 MTRACE(macTraceMsgTx(pMac, 0, msg.type));
471 retCode = wdaPostCtrlMsg(pMac, &msg);
472 if (retCode != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700473 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 return retCode;
475}
476#endif //0
Jeff Johnson295189b2012-06-20 16:38:30 -0700477tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId,
478 tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback,
479 void *callbackArg)
480{
481 tSirMsgQ msgQ;
482 tSirRetStatus retCode;
483 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530485 pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams));
486 if ( NULL == pLinkStateParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 {
488 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530489 FL( "Unable to allocate memory while sending Set Link State" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
491 return retCode;
492 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530493 vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 pLinkStateParams->state = state;
495 pLinkStateParams->callback = callback;
496 pLinkStateParams->callbackArg = callbackArg;
497
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 /* Copy Mac address */
499 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
500 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
501
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 msgQ.type = WDA_SET_LINK_STATE;
503 msgQ.reserved = 0;
504 msgQ.bodyptr = pLinkStateParams;
505 msgQ.bodyval = 0;
506
Jeff Johnsone7245742012-09-05 17:12:55 -0700507 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700508
509 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
510 if (retCode != eSIR_SUCCESS)
511 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530512 vos_mem_free(pLinkStateParams);
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800513 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "),
514 state, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 return retCode;
517}
Jeff Johnson295189b2012-06-20 16:38:30 -0700518#ifdef WLAN_FEATURE_VOWIFI_11R
519extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState
520state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry)
521{
522 tSirMsgQ msgQ;
523 tSirRetStatus retCode;
524 tpLinkStateParams pLinkStateParams = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530526 pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams));
527 if ( NULL == pLinkStateParams )
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 {
529 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530530 FL( "Unable to allocate memory while sending Set Link State" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
532 return retCode;
533 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530534 vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 pLinkStateParams->state = state;
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 /* Copy Mac address */
537 sirCopyMacAddr(pLinkStateParams->bssid,bssId);
538 sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr);
539 pLinkStateParams->ft = 1;
540 pLinkStateParams->session = psessionEntry;
541
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 msgQ.type = WDA_SET_LINK_STATE;
543 msgQ.reserved = 0;
544 msgQ.bodyptr = pLinkStateParams;
545 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800546 if(NULL == psessionEntry)
547 {
548 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
549 }
550 else
551 {
552 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
553 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700554
555 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
556 if (retCode != eSIR_SUCCESS)
557 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530558 vos_mem_free(pLinkStateParams);
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800559 limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "),
560 state, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 return retCode;
563}
564#endif
565
Jeff Johnson295189b2012-06-20 16:38:30 -0700566/** ---------------------------------------------------------
567\fn limSendSetTxPowerReq
568\brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA
569\param tpAniSirGlobal pMac
570\param tpSirSetTxPowerReq request message
571\return None
572 -----------------------------------------------------------*/
schang86c22c42013-03-13 18:41:24 -0700573tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -0700574{
schang86c22c42013-03-13 18:41:24 -0700575 tSirSetTxPowerReq *txPowerReq;
576 tSirRetStatus retCode = eSIR_SUCCESS;
577 tSirMsgQ msgQ;
578 tpPESession psessionEntry;
579 tANI_U8 sessionId = 0;
580
581 if (NULL == pMsgBuf)
582 return eSIR_FAILURE;
583
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530584 txPowerReq = vos_mem_malloc(sizeof(tSirSetTxPowerReq));
585 if ( NULL == txPowerReq )
schang86c22c42013-03-13 18:41:24 -0700586 {
587 return eSIR_FAILURE;
588 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530589 vos_mem_copy(txPowerReq, (tSirSetTxPowerReq *)pMsgBuf, sizeof(tSirSetTxPowerReq));
schang86c22c42013-03-13 18:41:24 -0700590
591 /* Found corresponding seesion to find BSS IDX */
592 psessionEntry = peFindSessionByBssid(pMac, txPowerReq->bssId, &sessionId);
593 if (NULL == psessionEntry)
594 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530595 vos_mem_free(txPowerReq);
schang86c22c42013-03-13 18:41:24 -0700596 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
597 return eSIR_FAILURE;
598 }
599
600 /* FW API requests BSS IDX */
601 txPowerReq->bssIdx = psessionEntry->bssIdx;
602
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 msgQ.type = WDA_SET_TX_POWER_REQ;
604 msgQ.reserved = 0;
schang86c22c42013-03-13 18:41:24 -0700605 msgQ.bodyptr = txPowerReq;
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 msgQ.bodyval = 0;
schang86c22c42013-03-13 18:41:24 -0700607 PELOGW(limLog(pMac, LOGW, FL("Sending WDA_SET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700608 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
schang86c22c42013-03-13 18:41:24 -0700609 retCode = wdaPostCtrlMsg(pMac, &msgQ);
610 if (eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 {
schang86c22c42013-03-13 18:41:24 -0700612 limLog(pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530613 vos_mem_free(txPowerReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 return retCode;
615 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530616 return retCode;
617}
618
619/** ---------------------------------------------------------
620\fn limSendHT40OBSSScanInd
621\brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA
622\param tpAniSirGlobal pMac
623\param psessionEntry session Entry
624\return None
625 -----------------------------------------------------------*/
626tSirRetStatus limSendHT40OBSSScanInd(tpAniSirGlobal pMac,
627 tpPESession psessionEntry)
628{
629 tSirRetStatus retCode = eSIR_SUCCESS;
630 tSirHT40OBSSScanInd *ht40OBSSScanInd;
631 tANI_U32 validChannelNum;
632 tSirMsgQ msgQ;
Mukul Sharmad2b81862014-07-01 21:01:04 +0530633 tANI_U8 validChanList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530634 tANI_U8 channel24GNum, count;
635
636 ht40OBSSScanInd = vos_mem_malloc(sizeof(tSirHT40OBSSScanInd));
637 if ( NULL == ht40OBSSScanInd)
638 {
639 return eSIR_FAILURE;
640 }
641
642 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
643 "OBSS Scan Indication bssIdx- %d staId %d",
644 psessionEntry->bssIdx, psessionEntry->staId);
645
646 ht40OBSSScanInd->cmdType = HT40_OBSS_SCAN_PARAM_START;
647 ht40OBSSScanInd->scanType = eSIR_ACTIVE_SCAN;
648 ht40OBSSScanInd->OBSSScanPassiveDwellTime =
649 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
650 ht40OBSSScanInd->OBSSScanActiveDwellTime =
651 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
652 ht40OBSSScanInd->BSSChannelWidthTriggerScanInterval =
653 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
654 ht40OBSSScanInd->OBSSScanPassiveTotalPerChannel =
655 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
656 ht40OBSSScanInd->OBSSScanActiveTotalPerChannel =
657 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
658 ht40OBSSScanInd->BSSWidthChannelTransitionDelayFactor =
659 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
660 ht40OBSSScanInd->OBSSScanActivityThreshold =
661 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
662 /* TODO update it from the associated BSS*/
Hardik Kantilal Pateld3912032014-11-21 16:54:07 +0530663 ht40OBSSScanInd->currentOperatingClass = 81;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +0530664
665 validChannelNum = WNI_CFG_VALID_CHANNEL_LIST_LEN;
666 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
667 validChanList,
668 &validChannelNum) != eSIR_SUCCESS)
669 {
670 limLog(pMac, LOGE,
671 FL("could not retrieve Valid channel list"));
672 }
673 /* Extract 24G channel list */
674 channel24GNum = 0;
675 for( count =0 ;count < validChannelNum ;count++)
676 {
677 if ((validChanList[count]> RF_CHAN_1) &&
678 (validChanList[count] < RF_CHAN_14))
679 {
680 ht40OBSSScanInd->channels[channel24GNum] = validChanList[count];
681 channel24GNum++;
682 }
683 }
684 ht40OBSSScanInd->channelCount = channel24GNum;
685 /* FW API requests BSS IDX */
686 ht40OBSSScanInd->selfStaIdx = psessionEntry->staId;
687 ht40OBSSScanInd->bssIdx = psessionEntry->bssIdx;
688 ht40OBSSScanInd->fortyMHZIntolerent = 0;
689 ht40OBSSScanInd->ieFieldLen = 0;
690
691 msgQ.type = WDA_HT40_OBSS_SCAN_IND;
692 msgQ.reserved = 0;
693 msgQ.bodyptr = (void *)ht40OBSSScanInd;
694 msgQ.bodyval = 0;
695 PELOGW(limLog(pMac, LOGW, FL("Sending WDA_HT40_OBSS_SCAN_IND to WDA"));)
696 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
697 retCode = wdaPostCtrlMsg(pMac, &msgQ);
698 if (eSIR_SUCCESS != retCode)
699 {
700 limLog(pMac, LOGP, FL("Posting WDA_HT40_OBSS_SCAN_IND "
701 "to WDA failed, reason=%X"), retCode);
702 vos_mem_free(ht40OBSSScanInd);
703 return retCode;
704 }
705 return retCode;
706}
707/** ---------------------------------------------------------
708\fn limSendHT40OBSSScanInd
709\brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA
710\ Stop command support is only for debugging
711\ As per 802.11 spec OBSS scan is mandatory while
712\ operating in HT40 on 2.4GHz band
713\param tpAniSirGlobal pMac
714\param psessionEntry Session entry
715\return None
716 -----------------------------------------------------------*/
717tSirRetStatus limSendHT40OBSSStopScanInd(tpAniSirGlobal pMac,
718 tpPESession psessionEntry)
719{
720 tSirRetStatus retCode = eSIR_SUCCESS;
721 tSirMsgQ msgQ;
722 tANI_U8 bssIdx;
723
724 bssIdx = psessionEntry->bssIdx;
725
726 VOS_TRACE (VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
727 " Sending STOP OBSS cmd, bssid %d staid %d \n",
728 psessionEntry->bssIdx, psessionEntry->staId);
729
730 msgQ.type = WDA_HT40_OBSS_STOP_SCAN_IND;
731 msgQ.reserved = 0;
732 msgQ.bodyptr = (void *)&bssIdx;
733 msgQ.bodyval = 0;
734 PELOGW(limLog(pMac, LOGW,
735 FL("Sending WDA_HT40_OBSS_STOP_SCAN_IND to WDA"));)
736 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
737 retCode = wdaPostCtrlMsg(pMac, &msgQ);
738 if (eSIR_SUCCESS != retCode)
739 {
740 limLog(pMac, LOGE, FL("Posting WDA_HT40_OBSS_SCAN_IND "
741 "to WDA failed, reason=%X"), retCode);
742 return retCode;
743 }
schang86c22c42013-03-13 18:41:24 -0700744
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 return retCode;
746}
Jeff Johnson295189b2012-06-20 16:38:30 -0700747/** ---------------------------------------------------------
748\fn limSendGetTxPowerReq
749\brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA
750\param tpAniSirGlobal pMac
751\param tpSirGetTxPowerReq request message
752\return None
753 -----------------------------------------------------------*/
754tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq)
755{
756 tSirRetStatus retCode = eSIR_SUCCESS;
757 tSirMsgQ msgQ;
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 if (NULL == pTxPowerReq)
759 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 msgQ.type = WDA_GET_TX_POWER_REQ;
761 msgQ.reserved = 0;
762 msgQ.bodyptr = pTxPowerReq;
763 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700765 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
767 {
768 limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode );
769 if (NULL != pTxPowerReq)
770 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530771 vos_mem_free(pTxPowerReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 }
773 return retCode;
774 }
775 return retCode;
776}
Jeff Johnson295189b2012-06-20 16:38:30 -0700777/** ---------------------------------------------------------
778\fn limSendBeaconFilterInfo
779\brief LIM sends beacon filtering info to WDA
780\param tpAniSirGlobal pMac
781\return None
782 -----------------------------------------------------------*/
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700783tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac,tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700784{
785 tpBeaconFilterMsg pBeaconFilterMsg = NULL;
786 tSirRetStatus retCode = eSIR_SUCCESS;
787 tSirMsgQ msgQ;
788 tANI_U8 *ptr;
789 tANI_U32 i;
790 tANI_U32 msgSize;
791 tpBeaconFilterIe pIe;
Jeff Johnson295189b2012-06-20 16:38:30 -0700792
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700793 if( psessionEntry == NULL )
794 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700795 limLog( pMac, LOGE, FL("Fail to find the right session "));
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700796 retCode = eSIR_FAILURE;
797 return retCode;
798 }
Abhishek Singh5fef4042014-11-25 18:33:00 +0530799 /*
800 * Dont send the WPA and RSN iE in filter if FW doesnt support
801 * IS_FEATURE_BCN_FLT_DELTA_ENABLE,
802 * else host will get all beacons which have RSN IE or WPA IE
803 */
804 if(IS_FEATURE_BCN_FLT_DELTA_ENABLE)
805 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable);
806 else
807 msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable) - (2 * sizeof(tBeaconFilterIe));
808
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530809 pBeaconFilterMsg = vos_mem_malloc(msgSize);
810 if ( NULL == pBeaconFilterMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700812 limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 retCode = eSIR_MEM_ALLOC_FAILED;
814 return retCode;
815 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530816 vos_mem_set((tANI_U8 *) pBeaconFilterMsg, msgSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 // Fill in capability Info and mask
818 //TBD-RAJESH get the BSS capability from session.
819 //Don't send this message if no active Infra session is found.
820 pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps;
821 pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK;
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 // Fill in number of IEs in beaconFilterTable
Abhishek Singh5fef4042014-11-25 18:33:00 +0530824 /*
825 * Dont send the WPA and RSN iE in filter if FW doesnt support
826 * IS_FEATURE_BCN_FLT_DELTA_ENABLE,
827 * else host will get all beacons which have RSN IE or WPA IE
828 */
829 if(IS_FEATURE_BCN_FLT_DELTA_ENABLE)
830 pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe));
831 else
832 pBeaconFilterMsg->ieNum = (tANI_U16) ((sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe)) - 2);
833
Madan Mohan Koyyalamudia84edda2012-10-15 14:58:25 -0700834 //Fill the BSSIDX
835 pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx;
836
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 //Fill message with info contained in the beaconFilterTable
838 ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg);
839 for(i=0; i < (pBeaconFilterMsg->ieNum); i++)
840 {
841 pIe = (tpBeaconFilterIe) ptr;
842 pIe->elementId = beaconFilterTable[i].elementId;
843 pIe->checkIePresence = beaconFilterTable[i].checkIePresence;
844 pIe->byte.offset = beaconFilterTable[i].byte.offset;
845 pIe->byte.value = beaconFilterTable[i].byte.value;
846 pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask;
847 pIe->byte.ref = beaconFilterTable[i].byte.ref;
848 ptr += sizeof(tBeaconFilterIe);
849 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 msgQ.type = WDA_BEACON_FILTER_IND;
851 msgQ.reserved = 0;
852 msgQ.bodyptr = pBeaconFilterMsg;
853 msgQ.bodyval = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." ));
Jeff Johnsone7245742012-09-05 17:12:55 -0700855 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
857 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530858 vos_mem_free(pBeaconFilterMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700860 FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 retCode );
862 return retCode;
863 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 return retCode;
865}
Mohit Khanna4a70d262012-09-11 16:30:12 -0700866
Sandeep Puligilla60342762014-01-30 21:05:37 +0530867/**
868 * \brief Send CB mode update to WDA
869 *
870 * \param pMac Pointer to the global MAC structure
871 *
872 * \param psessionEntry session entry
873 * pTempParam CB mode
874 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
875 */
Mohit Khanna4a70d262012-09-11 16:30:12 -0700876tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac,
877 tUpdateVHTOpMode *pTempParam,
878 tpPESession psessionEntry )
879{
880 tUpdateVHTOpMode *pVhtOpMode = NULL;
881 tSirRetStatus retCode = eSIR_SUCCESS;
882 tSirMsgQ msgQ;
883
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530884 pVhtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
885 if ( NULL == pVhtOpMode )
Mohit Khanna4a70d262012-09-11 16:30:12 -0700886 {
887 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530888 FL( "Unable to allocate memory during Update Op Mode" ));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700889 return eSIR_MEM_ALLOC_FAILED;
890 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530891 vos_mem_copy((tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode));
Mohit Khanna4a70d262012-09-11 16:30:12 -0700892 msgQ.type = WDA_UPDATE_OP_MODE;
893 msgQ.reserved = 0;
894 msgQ.bodyptr = pVhtOpMode;
895 msgQ.bodyval = 0;
Abhishek Singhdf8eb312014-11-15 00:49:28 +0530896 limLog( pMac, LOG1,
897 FL( "Sending WDA_UPDATE_OP_MODE, opMode = %d staid = %d" ),
898 pVhtOpMode->opMode,pVhtOpMode->staId);
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -0800899 if(NULL == psessionEntry)
900 {
901 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
902 }
903 else
904 {
905 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
906 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700907 if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ )))
908 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530909 vos_mem_free(pVhtOpMode);
Mohit Khanna4a70d262012-09-11 16:30:12 -0700910 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700911 FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700912 retCode );
913 }
914
915 return retCode;
916}
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800917
918#ifdef FEATURE_WLAN_TDLS_INTERNAL
919/** ---------------------------------------------------------
920\fn limSendTdlsLinkEstablish
921\brief LIM sends a message to HAL to set tdls direct link
922\param tpAniSirGlobal pMac
923\param
924\return None
925 -----------------------------------------------------------*/
926tSirRetStatus limSendTdlsLinkEstablish(tpAniSirGlobal pMac, tANI_U8 bIsPeerResponder, tANI_U8 linkIdenOffset,
927 tANI_U8 ptiBufStatusOffset, tANI_U8 ptiFrameLen, tANI_U8 *ptiFrame, tANI_U8 *extCapability)
928{
929 tSirMsgQ msgQ;
930 tSirRetStatus retCode;
931 tpSirTdlsLinkEstablishInd pTdlsLinkEstablish = NULL;
932
933 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530934 pTdlsLinkEstablish = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishInd));
935 if ( NULL == pTdlsLinkEstablish )
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800936 {
937 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530938 FL( "Unable to allocate memory while sending Tdls Link Establish " ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800939
940 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
941 return retCode;
942 }
943
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530944 vos_mem_set((tANI_U8 *) pTdlsLinkEstablish, sizeof(tSirTdlsLinkEstablishInd), 0);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800945
946 pTdlsLinkEstablish->bIsResponder = !!bIsPeerResponder;
947 pTdlsLinkEstablish->linkIdenOffset = linkIdenOffset;
948 pTdlsLinkEstablish->ptiBufStatusOffset = ptiBufStatusOffset;
949 pTdlsLinkEstablish->ptiTemplateLen = ptiFrameLen;
950 /* Copy ptiFrame template */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530951 vos_mem_copy(pTdlsLinkEstablish->ptiTemplateBuf, ptiFrame, ptiFrameLen);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800952 /* Copy extended capabilities */
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530953 vos_mem_copy((tANI_U8 *) pTdlsLinkEstablish->extCapability, extCapability, sizeof(pTdlsLinkEstablish->extCapability));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800954
955 msgQ.type = SIR_HAL_TDLS_LINK_ESTABLISH;
956 msgQ.reserved = 0;
957 msgQ.bodyptr = pTdlsLinkEstablish;
958 msgQ.bodyval = 0;
959
960 MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
961
962 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
963 if (retCode != eSIR_SUCCESS)
964 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530965 vos_mem_free(pTdlsLinkEstablish);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700966 limLog(pMac, LOGP, FL("Posting tdls link establish %d failed, reason = %x "), retCode);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800967 }
968
969 return retCode;
970}
971
972/** ---------------------------------------------------------
973\fn limSendTdlsLinkTeardown
974\brief LIM sends a message to HAL to indicate tdls direct link is teardowned
975\param tpAniSirGlobal pMac
976\param
977\return None
978 -----------------------------------------------------------*/
979tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId)
980{
981 tSirMsgQ msgQ;
982 tSirRetStatus retCode;
983 tpSirTdlsLinkTeardownInd pTdlsLinkTeardown = NULL;
984
985 // Allocate memory.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530986 pTdlsLinkTeardown = vos_mem_malloc(sizeof(tSirTdlsLinkTeardownInd));
987 if ( NULL == pTdlsLinkTeardown )
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800988 {
989 limLog( pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530990 FL( "Unable to allocate memory while sending Tdls Link Teardown " ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800991
992 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
993 return retCode;
994 }
995
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530996 vos_mem_set((tANI_U8 *) pTdlsLinkTeardown, sizeof(tSirTdlsLinkTeardownInd), 0);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800997
998 pTdlsLinkTeardown->staId = staId;
999
1000 msgQ.type = SIR_HAL_TDLS_LINK_TEARDOWN;
1001 msgQ.reserved = 0;
1002 msgQ.bodyptr = pTdlsLinkTeardown;
1003 msgQ.bodyval = 0;
1004
1005 MTRACE(macTraceMsgTx(pMac, 0, msgQ.type));
1006
1007 retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ);
1008 if (retCode != eSIR_SUCCESS)
1009 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301010 vos_mem_free(pTdlsLinkTeardown);
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001011 limLog(pMac, LOGP, FL("Posting tdls link teardown %d failed, reason = %x "), retCode);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001012 }
1013
1014 return retCode;
1015}
1016
1017#endif
1018
Chet Lanctot186b5732013-03-18 10:26:30 -07001019#ifdef WLAN_FEATURE_11W
1020/** ---------------------------------------------------------
1021\fn limSendExcludeUnencryptInd
1022\brief LIM sends a message to HAL to indicate whether to
1023 ignore or indicate the unprotected packet error
1024\param tpAniSirGlobal pMac
1025\param tANI_BOOLEAN excludeUnenc - true: ignore, false:
1026 indicate
1027\param tpPESession psessionEntry - session context
1028\return status
1029 -----------------------------------------------------------*/
1030tSirRetStatus limSendExcludeUnencryptInd(tpAniSirGlobal pMac,
1031 tANI_BOOLEAN excludeUnenc,
1032 tpPESession psessionEntry)
1033{
1034 tSirRetStatus retCode = eSIR_SUCCESS;
1035 tSirMsgQ msgQ;
1036 tSirWlanExcludeUnencryptParam * pExcludeUnencryptParam;
1037
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301038 pExcludeUnencryptParam = vos_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam));
1039 if ( NULL == pExcludeUnencryptParam )
Chet Lanctot186b5732013-03-18 10:26:30 -07001040 {
1041 limLog(pMac, LOGP,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301042 FL( "Unable to allocate memory during limSendExcludeUnencryptInd"));
Chet Lanctot186b5732013-03-18 10:26:30 -07001043 return eSIR_MEM_ALLOC_FAILED;
1044 }
1045
1046 pExcludeUnencryptParam->excludeUnencrypt = excludeUnenc;
1047 sirCopyMacAddr(pExcludeUnencryptParam->bssId, psessionEntry->bssId);
1048
1049 msgQ.type = WDA_EXCLUDE_UNENCRYPTED_IND;
1050 msgQ.reserved = 0;
1051 msgQ.bodyptr = pExcludeUnencryptParam;
1052 msgQ.bodyval = 0;
1053 PELOG3(limLog(pMac, LOG3,
1054 FL("Sending WDA_EXCLUDE_UNENCRYPTED_IND"));)
1055 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Chet Lanctotb2b0d552013-03-22 16:58:44 -07001056 retCode = wdaPostCtrlMsg(pMac, &msgQ);
1057 if (eSIR_SUCCESS != retCode)
Chet Lanctot186b5732013-03-18 10:26:30 -07001058 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301059 vos_mem_free(pExcludeUnencryptParam);
Chet Lanctot186b5732013-03-18 10:26:30 -07001060 limLog(pMac, LOGP,
1061 FL("Posting WDA_EXCLUDE_UNENCRYPTED_IND to WDA failed, reason=%X"),
1062 retCode);
1063 }
1064
1065 return retCode;
1066}
1067#endif
1068