Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3 | * |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 31 | * 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 40 | #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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 46 | /* 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 | */ |
| 57 | static 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 Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 63 | {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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 66 | {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 Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 70 | #ifdef WLAN_FEATURE_11AC |
| 71 | ,{SIR_MAC_VHT_OPMODE_EID, 0, {0, 0, 0, 0}} |
Kiran Kumar Lokere | 6e45533 | 2013-06-21 19:31:12 -0700 | [diff] [blame] | 72 | ,{SIR_MAC_VHT_OPERATION_EID, 0, {0, 0, VHTOP_CHWIDTH_MASK, 0}} |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 73 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 74 | }; |
| 75 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | /** |
| 77 | * limSendCFParams() |
| 78 | * |
| 79 | *FUNCTION: |
| 80 | * This function is called to send CFP Parameters to WDA, when they are changed. |
| 81 | * |
| 82 | *LOGIC: |
| 83 | * |
| 84 | *ASSUMPTIONS: |
| 85 | * NA |
| 86 | * |
| 87 | *NOTE: |
| 88 | * NA |
| 89 | * |
| 90 | * @param pMac pointer to Global Mac structure. |
| 91 | * @param bssIdx Bss Index of the BSS to which STA is associated. |
| 92 | * @param cfpCount CFP Count, if that is changed. |
| 93 | * @param cfpPeriod CFP Period if that is changed. |
| 94 | * |
| 95 | * @return success if message send is ok, else false. |
| 96 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 97 | tSirRetStatus limSendCFParams(tpAniSirGlobal pMac, tANI_U8 bssIdx, tANI_U8 cfpCount, tANI_U8 cfpPeriod) |
| 98 | { |
| 99 | tpUpdateCFParams pCFParams = NULL; |
| 100 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 101 | tSirMsgQ msgQ; |
| 102 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 103 | pCFParams = vos_mem_malloc(sizeof( tUpdateCFParams )); |
| 104 | if ( NULL == pCFParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | { |
| 106 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 107 | FL( "Unable to allocate memory during Update CF Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 109 | goto returnFailure; |
| 110 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 111 | vos_mem_set( (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 112 | pCFParams->cfpCount = cfpCount; |
| 113 | pCFParams->cfpPeriod = cfpPeriod; |
| 114 | pCFParams->bssIdx = bssIdx; |
| 115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 116 | msgQ.type = WDA_UPDATE_CF_IND; |
| 117 | msgQ.reserved = 0; |
| 118 | msgQ.bodyptr = pCFParams; |
| 119 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 120 | limLog( pMac, LOG3, |
| 121 | FL( "Sending WDA_UPDATE_CF_IND..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 122 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 123 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 124 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 125 | vos_mem_free(pCFParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 126 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 127 | FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | retCode ); |
| 129 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | returnFailure: |
| 131 | return retCode; |
| 132 | } |
| 133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | /** |
| 135 | * limSendBeaconParams() |
| 136 | * |
| 137 | *FUNCTION: |
| 138 | * This function is called to send beacnon interval, short preamble or other |
| 139 | * parameters to WDA, which are changed and indication is received in beacon. |
| 140 | * |
| 141 | *LOGIC: |
| 142 | * |
| 143 | *ASSUMPTIONS: |
| 144 | * NA |
| 145 | * |
| 146 | *NOTE: |
| 147 | * NA |
| 148 | * |
| 149 | * @param pMac pointer to Global Mac structure. |
| 150 | * @param tpUpdateBeaconParams pointer to the structure, |
| 151 | which contains the beacon parameters which are changed. |
| 152 | * |
| 153 | * @return success if message send is ok, else false. |
| 154 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, |
| 156 | tpUpdateBeaconParams pUpdatedBcnParams, |
| 157 | tpPESession psessionEntry ) |
| 158 | { |
| 159 | tpUpdateBeaconParams pBcnParams = NULL; |
| 160 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 161 | tSirMsgQ msgQ; |
| 162 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 163 | pBcnParams = vos_mem_malloc(sizeof(*pBcnParams)); |
| 164 | if ( NULL == pBcnParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | { |
| 166 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 167 | FL( "Unable to allocate memory during Update Beacon Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | return eSIR_MEM_ALLOC_FAILED; |
| 169 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 170 | vos_mem_copy((tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | msgQ.type = WDA_UPDATE_BEACON_IND; |
| 172 | msgQ.reserved = 0; |
| 173 | msgQ.bodyptr = pBcnParams; |
| 174 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 175 | PELOG3(limLog( pMac, LOG3, |
| 176 | FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ), |
| 177 | pUpdatedBcnParams->paramChangeBitmap);) |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 178 | if(NULL == psessionEntry) |
| 179 | { |
| 180 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 185 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 186 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 187 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 188 | vos_mem_free(pBcnParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 189 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 190 | FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 191 | retCode ); |
| 192 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | limSendBeaconInd(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 194 | return retCode; |
| 195 | } |
| 196 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | /** |
| 198 | * limSendSwitchChnlParams() |
| 199 | * |
| 200 | *FUNCTION: |
| 201 | * This function is called to send Channel Switch Indication to WDA |
| 202 | * |
| 203 | *LOGIC: |
| 204 | * |
| 205 | *ASSUMPTIONS: |
| 206 | * NA |
| 207 | * |
| 208 | *NOTE: |
| 209 | * NA |
| 210 | * |
| 211 | * @param pMac pointer to Global Mac structure. |
| 212 | * @param chnlNumber New Channel Number to be switched to. |
| 213 | * @param secondaryChnlOffset an enum for secondary channel offset. |
| 214 | * @param localPowerConstraint 11h local power constraint value |
| 215 | * |
| 216 | * @return success if message send is ok, else false. |
| 217 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 218 | #if !defined WLAN_FEATURE_VOWIFI |
| 219 | tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, |
| 220 | tANI_U8 chnlNumber, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 221 | ePhyChanBondState secondaryChnlOffset, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 222 | tANI_U8 localPwrConstraint, tANI_U8 peSessionId) |
| 223 | #else |
| 224 | tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, |
| 225 | tANI_U8 chnlNumber, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 226 | ePhyChanBondState secondaryChnlOffset, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 227 | tPowerdBm maxTxPower, tANI_U8 peSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 228 | #endif |
| 229 | { |
| 230 | tpSwitchChannelParams pChnlParams = NULL; |
| 231 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 232 | tSirMsgQ msgQ; |
| 233 | tpPESession pSessionEntry; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 234 | if((pSessionEntry = peFindSessionBySessionId(pMac, peSessionId)) == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | { |
| 236 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 237 | FL( "Unable to get Session for session Id %d" ), peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 238 | return eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 239 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 240 | pChnlParams = vos_mem_malloc(sizeof( tSwitchChannelParams )); |
| 241 | if ( NULL == pChnlParams ) |
| 242 | { |
| 243 | limLog( pMac, LOGP, |
| 244 | FL( "Unable to allocate memory during Switch Channel Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 245 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 246 | goto returnFailure; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 247 | } |
| 248 | vos_mem_set((tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 249 | pChnlParams->secondaryChannelOffset = secondaryChnlOffset; |
| 250 | pChnlParams->channelNumber= chnlNumber; |
| 251 | #if defined WLAN_FEATURE_VOWIFI |
| 252 | pChnlParams->maxTxPower = maxTxPower; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 253 | vos_mem_copy( pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 254 | #else |
| 255 | pChnlParams->localPowerConstraint = localPwrConstraint; |
| 256 | #endif |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 257 | vos_mem_copy( pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 258 | pChnlParams->peSessionId = peSessionId; |
Kalikinkar dhara | 085c02f | 2014-02-28 15:32:12 -0800 | [diff] [blame] | 259 | |
| 260 | if (LIM_SWITCH_CHANNEL_CSA == pSessionEntry->channelChangeCSA ) |
| 261 | { |
| 262 | pChnlParams->channelSwitchSrc = eHAL_CHANNEL_SWITCH_SOURCE_CSA; |
| 263 | pSessionEntry->channelChangeCSA = 0; |
| 264 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 265 | //we need to defer the message until we get the response back from WDA. |
| 266 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 267 | msgQ.type = WDA_CHNL_SWITCH_REQ; |
| 268 | msgQ.reserved = 0; |
| 269 | msgQ.bodyptr = pChnlParams; |
| 270 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 271 | #if defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | PELOG3(limLog( pMac, LOG3, |
| 273 | FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, maxTxPower - %d"), |
| 274 | pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->maxTxPower);) |
| 275 | #else |
| 276 | PELOG3(limLog( pMac, LOG3, |
| 277 | FL( "Sending WDA_CHNL_SWITCH_REQ with SecondaryChnOffset - %d, ChannelNumber - %d, LocalPowerConstraint - %d"), |
| 278 | pChnlParams->secondaryChannelOffset, pChnlParams->channelNumber, pChnlParams->localPowerConstraint);) |
| 279 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 280 | MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type)); |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 281 | limLog(pMac,LOG1,"SessionId:%d WDA_CHNL_SWITCH_REQ for SSID:%s",peSessionId, |
| 282 | pSessionEntry->ssId.ssId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 284 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 285 | vos_mem_free(pChnlParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 286 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 287 | FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | retCode ); |
| 289 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | returnFailure: |
| 291 | return retCode; |
| 292 | } |
| 293 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 294 | /** |
| 295 | * limSendEdcaParams() |
| 296 | * |
| 297 | *FUNCTION: |
| 298 | * This function is called to send dynamically changing EDCA Parameters to WDA. |
| 299 | * |
| 300 | *LOGIC: |
| 301 | * |
| 302 | *ASSUMPTIONS: |
| 303 | * NA |
| 304 | * |
| 305 | *NOTE: |
| 306 | * NA |
| 307 | * |
| 308 | * @param pMac pointer to Global Mac structure. |
| 309 | * @param tpUpdatedEdcaParams pointer to the structure which contains |
| 310 | * dynamically changing EDCA parameters. |
| 311 | * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true. |
| 312 | * |
| 313 | * @return success if message send is ok, else false. |
| 314 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 315 | tSirRetStatus limSendEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *pUpdatedEdcaParams, tANI_U16 bssIdx, tANI_BOOLEAN highPerformance) |
| 316 | { |
| 317 | tEdcaParams *pEdcaParams = NULL; |
| 318 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 319 | tSirMsgQ msgQ; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 320 | |
| 321 | pEdcaParams = vos_mem_malloc(sizeof(tEdcaParams)); |
| 322 | if ( NULL == pEdcaParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 323 | { |
| 324 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 325 | FL( "Unable to allocate memory during Update EDCA Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 326 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 327 | return retCode; |
| 328 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | pEdcaParams->bssIdx = bssIdx; |
| 330 | pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE]; |
| 331 | pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK]; |
| 332 | pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI]; |
| 333 | pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO]; |
| 334 | pEdcaParams->highPerformance = highPerformance; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND; |
| 336 | msgQ.reserved = 0; |
| 337 | msgQ.bodyptr = pEdcaParams; |
| 338 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 339 | { |
| 340 | tANI_U8 i; |
| 341 | PELOG1(limLog( pMac, LOG1,FL("Sending WDA_UPDATE_EDCA_PROFILE_IND with EDCA Parameters:" ));) |
| 342 | for(i=0; i<MAX_NUM_AC; i++) |
| 343 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 344 | PELOG1(limLog(pMac, LOG1, FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 345 | i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm, |
| 346 | pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);) |
| 347 | } |
| 348 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 349 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 350 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 351 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 352 | vos_mem_free(pEdcaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 353 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 354 | FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | retCode ); |
| 356 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | return retCode; |
| 358 | } |
| 359 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 360 | /** |
| 361 | * limSetActiveEdcaParams() |
| 362 | * |
| 363 | * FUNCTION: |
| 364 | * This function is called to set the most up-to-date EDCA parameters |
| 365 | * given the default local EDCA parameters. The rules are as following: |
| 366 | * - If ACM bit is set for all ACs, then downgrade everything to Best Effort. |
| 367 | * - If ACM is not set for any AC, then PE will use the default EDCA |
| 368 | * parameters as advertised by AP. |
| 369 | * - If ACM is set in any of the ACs, PE will use the EDCA parameters |
| 370 | * from the next best AC for which ACM is not enabled. |
| 371 | * |
| 372 | * @param pMac pointer to Global Mac structure. |
| 373 | * @param plocalEdcaParams pointer to the local EDCA parameters |
| 374 | * @ param psessionEntry point to the session entry |
| 375 | * @return none |
| 376 | */ |
| 377 | void limSetActiveEdcaParams(tpAniSirGlobal pMac, tSirMacEdcaParamRecord *plocalEdcaParams, tpPESession psessionEntry) |
| 378 | { |
| 379 | tANI_U8 ac, newAc, i; |
| 380 | tANI_U8 acAdmitted; |
| 381 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 382 | vos_log_qos_edca_pkt_type *log_ptr = NULL; |
| 383 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 384 | // Initialize gLimEdcaParamsActive[] to be same as localEdcaParams |
| 385 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE] = plocalEdcaParams[EDCA_AC_BE]; |
| 386 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK] = plocalEdcaParams[EDCA_AC_BK]; |
| 387 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI] = plocalEdcaParams[EDCA_AC_VI]; |
| 388 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO] = plocalEdcaParams[EDCA_AC_VO]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 389 | /* An AC requires downgrade if the ACM bit is set, and the AC has not |
| 390 | * yet been admitted in uplink or bi-directions. |
| 391 | * If an AC requires downgrade, it will downgrade to the next beset AC |
| 392 | * for which ACM is not enabled. |
| 393 | * |
| 394 | * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence |
| 395 | * start the for loop with AC_BK. |
| 396 | * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then |
| 397 | * traverse thru the AC list. If we do find the next best AC which is |
| 398 | * better than AC_BE, then use that one. For example, if ACM bits are set |
| 399 | * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0 |
| 400 | * then all AC will be downgraded to AC_BE. |
| 401 | */ |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 402 | limLog(pMac, LOG1, FL("adAdmitMask[UPLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] ); |
| 403 | limLog(pMac, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x "), pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 404 | for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++) |
| 405 | { |
| 406 | acAdmitted = ( (pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & (1 << ac)) >> ac ); |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 407 | limLog(pMac, LOG1, FL("For AC[%d]: acm=%d, acAdmit=%d "), ac, plocalEdcaParams[ac].aci.acm, acAdmitted); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | if ( (plocalEdcaParams[ac].aci.acm == 1) && (acAdmitted == 0) ) |
| 409 | { |
| 410 | limLog(pMac, LOG1, FL("We need to downgrade AC %d!! "), ac); |
| 411 | newAc = EDCA_AC_BE; |
| 412 | for (i=ac-1; i>0; i--) |
| 413 | { |
| 414 | if (plocalEdcaParams[i].aci.acm == 0) |
| 415 | { |
| 416 | newAc = i; |
| 417 | break; |
| 418 | } |
| 419 | } |
| 420 | limLog(pMac, LOGW, FL("Downgrading AC %d ---> AC %d "), ac, newAc); |
| 421 | psessionEntry->gLimEdcaParamsActive[ac] = plocalEdcaParams[newAc]; |
| 422 | } |
| 423 | } |
| 424 | //log: LOG_WLAN_QOS_EDCA_C |
| 425 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT |
| 426 | WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C); |
| 427 | if(log_ptr) |
| 428 | { |
| 429 | log_ptr->aci_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].aci.aci; |
| 430 | log_ptr->cw_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.max << 4 | |
| 431 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].cw.min; |
| 432 | log_ptr->txoplimit_be = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BE].txoplimit; |
| 433 | log_ptr->aci_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].aci.aci; |
| 434 | log_ptr->cw_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.max << 4 | |
| 435 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].cw.min; |
| 436 | log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParamsActive[EDCA_AC_BK].txoplimit; |
| 437 | log_ptr->aci_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].aci.aci; |
| 438 | log_ptr->cw_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.max << 4 | |
| 439 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].cw.min; |
| 440 | log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VI].txoplimit; |
| 441 | log_ptr->aci_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].aci.aci; |
| 442 | log_ptr->cw_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.max << 4 | |
| 443 | psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].cw.min; |
| 444 | log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParamsActive[EDCA_AC_VO].txoplimit; |
| 445 | } |
| 446 | WLAN_VOS_DIAG_LOG_REPORT(log_ptr); |
| 447 | #endif //FEATURE_WLAN_DIAG_SUPPORT |
| 448 | |
| 449 | return; |
| 450 | } |
| 451 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 452 | /** --------------------------------------------------------- |
| 453 | \fn limSetLinkState |
| 454 | \brief LIM sends a message to WDA to set the link state |
| 455 | \param tpAniSirGlobal pMac |
| 456 | \param tSirLinkState state |
| 457 | \return None |
| 458 | -----------------------------------------------------------*/ |
| 459 | //Original code with out anu's change |
| 460 | #if 0 |
| 461 | tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId) |
| 462 | { |
| 463 | tSirMsgQ msg; |
| 464 | tSirRetStatus retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 465 | msg.type = WDA_SET_LINK_STATE; |
| 466 | msg.bodyval = (tANI_U32) state; |
| 467 | msg.bodyptr = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 468 | MTRACE(macTraceMsgTx(pMac, 0, msg.type)); |
| 469 | retCode = wdaPostCtrlMsg(pMac, &msg); |
| 470 | if (retCode != eSIR_SUCCESS) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 471 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 472 | return retCode; |
| 473 | } |
| 474 | #endif //0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 475 | tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId, |
| 476 | tSirMacAddr selfMacAddr, tpSetLinkStateCallback callback, |
| 477 | void *callbackArg) |
| 478 | { |
| 479 | tSirMsgQ msgQ; |
| 480 | tSirRetStatus retCode; |
| 481 | tpLinkStateParams pLinkStateParams = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 482 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 483 | pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams)); |
| 484 | if ( NULL == pLinkStateParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | { |
| 486 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 487 | FL( "Unable to allocate memory while sending Set Link State" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 489 | return retCode; |
| 490 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 491 | vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | pLinkStateParams->state = state; |
| 493 | pLinkStateParams->callback = callback; |
| 494 | pLinkStateParams->callbackArg = callbackArg; |
| 495 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 496 | /* Copy Mac address */ |
| 497 | sirCopyMacAddr(pLinkStateParams->bssid,bssId); |
| 498 | sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 499 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 500 | msgQ.type = WDA_SET_LINK_STATE; |
| 501 | msgQ.reserved = 0; |
| 502 | msgQ.bodyptr = pLinkStateParams; |
| 503 | msgQ.bodyval = 0; |
| 504 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 505 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 506 | |
| 507 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 508 | if (retCode != eSIR_SUCCESS) |
| 509 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 510 | vos_mem_free(pLinkStateParams); |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 511 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), |
| 512 | state, retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 513 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | return retCode; |
| 515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 517 | extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState |
| 518 | state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry) |
| 519 | { |
| 520 | tSirMsgQ msgQ; |
| 521 | tSirRetStatus retCode; |
| 522 | tpLinkStateParams pLinkStateParams = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 523 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 524 | pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams)); |
| 525 | if ( NULL == pLinkStateParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 526 | { |
| 527 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 528 | FL( "Unable to allocate memory while sending Set Link State" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 529 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 530 | return retCode; |
| 531 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 532 | vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 533 | pLinkStateParams->state = state; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 534 | /* Copy Mac address */ |
| 535 | sirCopyMacAddr(pLinkStateParams->bssid,bssId); |
| 536 | sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 537 | pLinkStateParams->ft = 1; |
| 538 | pLinkStateParams->session = psessionEntry; |
| 539 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | msgQ.type = WDA_SET_LINK_STATE; |
| 541 | msgQ.reserved = 0; |
| 542 | msgQ.bodyptr = pLinkStateParams; |
| 543 | msgQ.bodyval = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 544 | if(NULL == psessionEntry) |
| 545 | { |
| 546 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 547 | } |
| 548 | else |
| 549 | { |
| 550 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 551 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 552 | |
| 553 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 554 | if (retCode != eSIR_SUCCESS) |
| 555 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 556 | vos_mem_free(pLinkStateParams); |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 557 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), |
| 558 | state, retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 559 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 560 | return retCode; |
| 561 | } |
| 562 | #endif |
| 563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 564 | /** --------------------------------------------------------- |
| 565 | \fn limSendSetTxPowerReq |
| 566 | \brief LIM sends a WDA_SET_TX_POWER_REQ message to WDA |
| 567 | \param tpAniSirGlobal pMac |
| 568 | \param tpSirSetTxPowerReq request message |
| 569 | \return None |
| 570 | -----------------------------------------------------------*/ |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 571 | tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 572 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 573 | tSirSetTxPowerReq *txPowerReq; |
| 574 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 575 | tSirMsgQ msgQ; |
| 576 | tpPESession psessionEntry; |
| 577 | tANI_U8 sessionId = 0; |
| 578 | |
| 579 | if (NULL == pMsgBuf) |
| 580 | return eSIR_FAILURE; |
| 581 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 582 | txPowerReq = vos_mem_malloc(sizeof(tSirSetTxPowerReq)); |
| 583 | if ( NULL == txPowerReq ) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 584 | { |
| 585 | return eSIR_FAILURE; |
| 586 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 587 | vos_mem_copy(txPowerReq, (tSirSetTxPowerReq *)pMsgBuf, sizeof(tSirSetTxPowerReq)); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 588 | |
| 589 | /* Found corresponding seesion to find BSS IDX */ |
| 590 | psessionEntry = peFindSessionByBssid(pMac, txPowerReq->bssId, &sessionId); |
| 591 | if (NULL == psessionEntry) |
| 592 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 593 | vos_mem_free(txPowerReq); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 594 | limLog(pMac, LOGE, FL("Session does not exist for given BSSID")); |
| 595 | return eSIR_FAILURE; |
| 596 | } |
| 597 | |
| 598 | /* FW API requests BSS IDX */ |
| 599 | txPowerReq->bssIdx = psessionEntry->bssIdx; |
| 600 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | msgQ.type = WDA_SET_TX_POWER_REQ; |
| 602 | msgQ.reserved = 0; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 603 | msgQ.bodyptr = txPowerReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 604 | msgQ.bodyval = 0; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 605 | PELOGW(limLog(pMac, LOGW, FL("Sending WDA_SET_TX_POWER_REQ to WDA"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 606 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 607 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 608 | if (eSIR_SUCCESS != retCode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 609 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 610 | limLog(pMac, LOGP, FL("Posting WDA_SET_TX_POWER_REQ to WDA failed, reason=%X"), retCode); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 611 | vos_mem_free(txPowerReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 612 | return retCode; |
| 613 | } |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 614 | return retCode; |
| 615 | } |
| 616 | |
| 617 | /** --------------------------------------------------------- |
| 618 | \fn limSendHT40OBSSScanInd |
| 619 | \brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA |
| 620 | \param tpAniSirGlobal pMac |
| 621 | \param psessionEntry session Entry |
| 622 | \return None |
| 623 | -----------------------------------------------------------*/ |
| 624 | tSirRetStatus limSendHT40OBSSScanInd(tpAniSirGlobal pMac, |
| 625 | tpPESession psessionEntry) |
| 626 | { |
| 627 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 628 | tSirHT40OBSSScanInd *ht40OBSSScanInd; |
| 629 | tANI_U32 validChannelNum; |
| 630 | tSirMsgQ msgQ; |
Mukul Sharma | d2b8186 | 2014-07-01 21:01:04 +0530 | [diff] [blame] | 631 | tANI_U8 validChanList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 632 | tANI_U8 channel24GNum, count; |
| 633 | |
| 634 | ht40OBSSScanInd = vos_mem_malloc(sizeof(tSirHT40OBSSScanInd)); |
| 635 | if ( NULL == ht40OBSSScanInd) |
| 636 | { |
| 637 | return eSIR_FAILURE; |
| 638 | } |
| 639 | |
| 640 | VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO, |
| 641 | "OBSS Scan Indication bssIdx- %d staId %d", |
| 642 | psessionEntry->bssIdx, psessionEntry->staId); |
| 643 | |
| 644 | ht40OBSSScanInd->cmdType = HT40_OBSS_SCAN_PARAM_START; |
| 645 | ht40OBSSScanInd->scanType = eSIR_ACTIVE_SCAN; |
| 646 | ht40OBSSScanInd->OBSSScanPassiveDwellTime = |
| 647 | psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime; |
| 648 | ht40OBSSScanInd->OBSSScanActiveDwellTime = |
| 649 | psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime; |
| 650 | ht40OBSSScanInd->BSSChannelWidthTriggerScanInterval = |
| 651 | psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval; |
| 652 | ht40OBSSScanInd->OBSSScanPassiveTotalPerChannel = |
| 653 | psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel; |
| 654 | ht40OBSSScanInd->OBSSScanActiveTotalPerChannel = |
| 655 | psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel; |
| 656 | ht40OBSSScanInd->BSSWidthChannelTransitionDelayFactor = |
| 657 | psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor; |
| 658 | ht40OBSSScanInd->OBSSScanActivityThreshold = |
| 659 | psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold; |
| 660 | /* TODO update it from the associated BSS*/ |
| 661 | ht40OBSSScanInd->currentOperatingClass = 1; |
| 662 | |
| 663 | validChannelNum = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 664 | if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST, |
| 665 | validChanList, |
| 666 | &validChannelNum) != eSIR_SUCCESS) |
| 667 | { |
| 668 | limLog(pMac, LOGE, |
| 669 | FL("could not retrieve Valid channel list")); |
| 670 | } |
| 671 | /* Extract 24G channel list */ |
| 672 | channel24GNum = 0; |
| 673 | for( count =0 ;count < validChannelNum ;count++) |
| 674 | { |
| 675 | if ((validChanList[count]> RF_CHAN_1) && |
| 676 | (validChanList[count] < RF_CHAN_14)) |
| 677 | { |
| 678 | ht40OBSSScanInd->channels[channel24GNum] = validChanList[count]; |
| 679 | channel24GNum++; |
| 680 | } |
| 681 | } |
| 682 | ht40OBSSScanInd->channelCount = channel24GNum; |
| 683 | /* FW API requests BSS IDX */ |
| 684 | ht40OBSSScanInd->selfStaIdx = psessionEntry->staId; |
| 685 | ht40OBSSScanInd->bssIdx = psessionEntry->bssIdx; |
| 686 | ht40OBSSScanInd->fortyMHZIntolerent = 0; |
| 687 | ht40OBSSScanInd->ieFieldLen = 0; |
| 688 | |
| 689 | msgQ.type = WDA_HT40_OBSS_SCAN_IND; |
| 690 | msgQ.reserved = 0; |
| 691 | msgQ.bodyptr = (void *)ht40OBSSScanInd; |
| 692 | msgQ.bodyval = 0; |
| 693 | PELOGW(limLog(pMac, LOGW, FL("Sending WDA_HT40_OBSS_SCAN_IND to WDA"));) |
| 694 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 695 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 696 | if (eSIR_SUCCESS != retCode) |
| 697 | { |
| 698 | limLog(pMac, LOGP, FL("Posting WDA_HT40_OBSS_SCAN_IND " |
| 699 | "to WDA failed, reason=%X"), retCode); |
| 700 | vos_mem_free(ht40OBSSScanInd); |
| 701 | return retCode; |
| 702 | } |
| 703 | return retCode; |
| 704 | } |
| 705 | /** --------------------------------------------------------- |
| 706 | \fn limSendHT40OBSSScanInd |
| 707 | \brief LIM sends a WDA_HT40_OBSS_SCAN_IND message to WDA |
| 708 | \ Stop command support is only for debugging |
| 709 | \ As per 802.11 spec OBSS scan is mandatory while |
| 710 | \ operating in HT40 on 2.4GHz band |
| 711 | \param tpAniSirGlobal pMac |
| 712 | \param psessionEntry Session entry |
| 713 | \return None |
| 714 | -----------------------------------------------------------*/ |
| 715 | tSirRetStatus limSendHT40OBSSStopScanInd(tpAniSirGlobal pMac, |
| 716 | tpPESession psessionEntry) |
| 717 | { |
| 718 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 719 | tSirMsgQ msgQ; |
| 720 | tANI_U8 bssIdx; |
| 721 | |
| 722 | bssIdx = psessionEntry->bssIdx; |
| 723 | |
| 724 | VOS_TRACE (VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO, |
| 725 | " Sending STOP OBSS cmd, bssid %d staid %d \n", |
| 726 | psessionEntry->bssIdx, psessionEntry->staId); |
| 727 | |
| 728 | msgQ.type = WDA_HT40_OBSS_STOP_SCAN_IND; |
| 729 | msgQ.reserved = 0; |
| 730 | msgQ.bodyptr = (void *)&bssIdx; |
| 731 | msgQ.bodyval = 0; |
| 732 | PELOGW(limLog(pMac, LOGW, |
| 733 | FL("Sending WDA_HT40_OBSS_STOP_SCAN_IND to WDA"));) |
| 734 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 735 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 736 | if (eSIR_SUCCESS != retCode) |
| 737 | { |
| 738 | limLog(pMac, LOGE, FL("Posting WDA_HT40_OBSS_SCAN_IND " |
| 739 | "to WDA failed, reason=%X"), retCode); |
| 740 | return retCode; |
| 741 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 742 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 743 | return retCode; |
| 744 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | /** --------------------------------------------------------- |
| 746 | \fn limSendGetTxPowerReq |
| 747 | \brief LIM sends a WDA_GET_TX_POWER_REQ message to WDA |
| 748 | \param tpAniSirGlobal pMac |
| 749 | \param tpSirGetTxPowerReq request message |
| 750 | \return None |
| 751 | -----------------------------------------------------------*/ |
| 752 | tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq) |
| 753 | { |
| 754 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 755 | tSirMsgQ msgQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 756 | if (NULL == pTxPowerReq) |
| 757 | return retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 758 | msgQ.type = WDA_GET_TX_POWER_REQ; |
| 759 | msgQ.reserved = 0; |
| 760 | msgQ.bodyptr = pTxPowerReq; |
| 761 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 762 | PELOGW(limLog(pMac, LOGW, FL( "Sending WDA_GET_TX_POWER_REQ to WDA"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 763 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 765 | { |
| 766 | limLog( pMac, LOGP, FL("Posting WDA_GET_TX_POWER_REQ to WDA failed, reason=%X"), retCode ); |
| 767 | if (NULL != pTxPowerReq) |
| 768 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 769 | vos_mem_free(pTxPowerReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 770 | } |
| 771 | return retCode; |
| 772 | } |
| 773 | return retCode; |
| 774 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 775 | /** --------------------------------------------------------- |
| 776 | \fn limSendBeaconFilterInfo |
| 777 | \brief LIM sends beacon filtering info to WDA |
| 778 | \param tpAniSirGlobal pMac |
| 779 | \return None |
| 780 | -----------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 781 | tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac,tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 782 | { |
| 783 | tpBeaconFilterMsg pBeaconFilterMsg = NULL; |
| 784 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 785 | tSirMsgQ msgQ; |
| 786 | tANI_U8 *ptr; |
| 787 | tANI_U32 i; |
| 788 | tANI_U32 msgSize; |
| 789 | tpBeaconFilterIe pIe; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 790 | |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 791 | if( psessionEntry == NULL ) |
| 792 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 793 | limLog( pMac, LOGE, FL("Fail to find the right session ")); |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 794 | retCode = eSIR_FAILURE; |
| 795 | return retCode; |
| 796 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 797 | msgSize = sizeof(tBeaconFilterMsg) + sizeof(beaconFilterTable); |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 798 | pBeaconFilterMsg = vos_mem_malloc(msgSize); |
| 799 | if ( NULL == pBeaconFilterMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 800 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 801 | limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 802 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 803 | return retCode; |
| 804 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 805 | vos_mem_set((tANI_U8 *) pBeaconFilterMsg, msgSize, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 806 | // Fill in capability Info and mask |
| 807 | //TBD-RAJESH get the BSS capability from session. |
| 808 | //Don't send this message if no active Infra session is found. |
| 809 | pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps; |
| 810 | pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 812 | // Fill in number of IEs in beaconFilterTable |
| 813 | pBeaconFilterMsg->ieNum = (tANI_U16) (sizeof(beaconFilterTable) / sizeof(tBeaconFilterIe)); |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 814 | //Fill the BSSIDX |
| 815 | pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx; |
| 816 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | //Fill message with info contained in the beaconFilterTable |
| 818 | ptr = (tANI_U8 *)pBeaconFilterMsg + sizeof(tBeaconFilterMsg); |
| 819 | for(i=0; i < (pBeaconFilterMsg->ieNum); i++) |
| 820 | { |
| 821 | pIe = (tpBeaconFilterIe) ptr; |
| 822 | pIe->elementId = beaconFilterTable[i].elementId; |
| 823 | pIe->checkIePresence = beaconFilterTable[i].checkIePresence; |
| 824 | pIe->byte.offset = beaconFilterTable[i].byte.offset; |
| 825 | pIe->byte.value = beaconFilterTable[i].byte.value; |
| 826 | pIe->byte.bitMask = beaconFilterTable[i].byte.bitMask; |
| 827 | pIe->byte.ref = beaconFilterTable[i].byte.ref; |
| 828 | ptr += sizeof(tBeaconFilterIe); |
| 829 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 830 | msgQ.type = WDA_BEACON_FILTER_IND; |
| 831 | msgQ.reserved = 0; |
| 832 | msgQ.bodyptr = pBeaconFilterMsg; |
| 833 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 835 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 836 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 837 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 838 | vos_mem_free(pBeaconFilterMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 839 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 840 | FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 841 | retCode ); |
| 842 | return retCode; |
| 843 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 844 | return retCode; |
| 845 | } |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 846 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 847 | /** |
| 848 | * \brief Send CB mode update to WDA |
| 849 | * |
| 850 | * \param pMac Pointer to the global MAC structure |
| 851 | * |
| 852 | * \param psessionEntry session entry |
| 853 | * pTempParam CB mode |
| 854 | * \return eSIR_SUCCESS on success, eSIR_FAILURE else |
| 855 | */ |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 856 | tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac, |
| 857 | tUpdateVHTOpMode *pTempParam, |
| 858 | tpPESession psessionEntry ) |
| 859 | { |
| 860 | tUpdateVHTOpMode *pVhtOpMode = NULL; |
| 861 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 862 | tSirMsgQ msgQ; |
| 863 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 864 | pVhtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode)); |
| 865 | if ( NULL == pVhtOpMode ) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 866 | { |
| 867 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 868 | FL( "Unable to allocate memory during Update Op Mode" )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 869 | return eSIR_MEM_ALLOC_FAILED; |
| 870 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 871 | vos_mem_copy((tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 872 | msgQ.type = WDA_UPDATE_OP_MODE; |
| 873 | msgQ.reserved = 0; |
| 874 | msgQ.bodyptr = pVhtOpMode; |
| 875 | msgQ.bodyval = 0; |
Abhishek Singh | df8eb31 | 2014-11-15 00:49:28 +0530 | [diff] [blame^] | 876 | limLog( pMac, LOG1, |
| 877 | FL( "Sending WDA_UPDATE_OP_MODE, opMode = %d staid = %d" ), |
| 878 | pVhtOpMode->opMode,pVhtOpMode->staId); |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 879 | if(NULL == psessionEntry) |
| 880 | { |
| 881 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
| 882 | } |
| 883 | else |
| 884 | { |
| 885 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 886 | } |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 887 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 888 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 889 | vos_mem_free(pVhtOpMode); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 890 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 891 | FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 892 | retCode ); |
| 893 | } |
| 894 | |
| 895 | return retCode; |
| 896 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 897 | |
| 898 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 899 | /** --------------------------------------------------------- |
| 900 | \fn limSendTdlsLinkEstablish |
| 901 | \brief LIM sends a message to HAL to set tdls direct link |
| 902 | \param tpAniSirGlobal pMac |
| 903 | \param |
| 904 | \return None |
| 905 | -----------------------------------------------------------*/ |
| 906 | tSirRetStatus limSendTdlsLinkEstablish(tpAniSirGlobal pMac, tANI_U8 bIsPeerResponder, tANI_U8 linkIdenOffset, |
| 907 | tANI_U8 ptiBufStatusOffset, tANI_U8 ptiFrameLen, tANI_U8 *ptiFrame, tANI_U8 *extCapability) |
| 908 | { |
| 909 | tSirMsgQ msgQ; |
| 910 | tSirRetStatus retCode; |
| 911 | tpSirTdlsLinkEstablishInd pTdlsLinkEstablish = NULL; |
| 912 | |
| 913 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 914 | pTdlsLinkEstablish = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishInd)); |
| 915 | if ( NULL == pTdlsLinkEstablish ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 916 | { |
| 917 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 918 | FL( "Unable to allocate memory while sending Tdls Link Establish " )); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 919 | |
| 920 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 921 | return retCode; |
| 922 | } |
| 923 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 924 | vos_mem_set((tANI_U8 *) pTdlsLinkEstablish, sizeof(tSirTdlsLinkEstablishInd), 0); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 925 | |
| 926 | pTdlsLinkEstablish->bIsResponder = !!bIsPeerResponder; |
| 927 | pTdlsLinkEstablish->linkIdenOffset = linkIdenOffset; |
| 928 | pTdlsLinkEstablish->ptiBufStatusOffset = ptiBufStatusOffset; |
| 929 | pTdlsLinkEstablish->ptiTemplateLen = ptiFrameLen; |
| 930 | /* Copy ptiFrame template */ |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 931 | vos_mem_copy(pTdlsLinkEstablish->ptiTemplateBuf, ptiFrame, ptiFrameLen); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 932 | /* Copy extended capabilities */ |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 933 | vos_mem_copy((tANI_U8 *) pTdlsLinkEstablish->extCapability, extCapability, sizeof(pTdlsLinkEstablish->extCapability)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 934 | |
| 935 | msgQ.type = SIR_HAL_TDLS_LINK_ESTABLISH; |
| 936 | msgQ.reserved = 0; |
| 937 | msgQ.bodyptr = pTdlsLinkEstablish; |
| 938 | msgQ.bodyval = 0; |
| 939 | |
| 940 | MTRACE(macTraceMsgTx(pMac, 0, msgQ.type)); |
| 941 | |
| 942 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 943 | if (retCode != eSIR_SUCCESS) |
| 944 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 945 | vos_mem_free(pTdlsLinkEstablish); |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 946 | limLog(pMac, LOGP, FL("Posting tdls link establish %d failed, reason = %x "), retCode); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 947 | } |
| 948 | |
| 949 | return retCode; |
| 950 | } |
| 951 | |
| 952 | /** --------------------------------------------------------- |
| 953 | \fn limSendTdlsLinkTeardown |
| 954 | \brief LIM sends a message to HAL to indicate tdls direct link is teardowned |
| 955 | \param tpAniSirGlobal pMac |
| 956 | \param |
| 957 | \return None |
| 958 | -----------------------------------------------------------*/ |
| 959 | tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId) |
| 960 | { |
| 961 | tSirMsgQ msgQ; |
| 962 | tSirRetStatus retCode; |
| 963 | tpSirTdlsLinkTeardownInd pTdlsLinkTeardown = NULL; |
| 964 | |
| 965 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 966 | pTdlsLinkTeardown = vos_mem_malloc(sizeof(tSirTdlsLinkTeardownInd)); |
| 967 | if ( NULL == pTdlsLinkTeardown ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 968 | { |
| 969 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 970 | FL( "Unable to allocate memory while sending Tdls Link Teardown " )); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 971 | |
| 972 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 973 | return retCode; |
| 974 | } |
| 975 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 976 | vos_mem_set((tANI_U8 *) pTdlsLinkTeardown, sizeof(tSirTdlsLinkTeardownInd), 0); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 977 | |
| 978 | pTdlsLinkTeardown->staId = staId; |
| 979 | |
| 980 | msgQ.type = SIR_HAL_TDLS_LINK_TEARDOWN; |
| 981 | msgQ.reserved = 0; |
| 982 | msgQ.bodyptr = pTdlsLinkTeardown; |
| 983 | msgQ.bodyval = 0; |
| 984 | |
| 985 | MTRACE(macTraceMsgTx(pMac, 0, msgQ.type)); |
| 986 | |
| 987 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 988 | if (retCode != eSIR_SUCCESS) |
| 989 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 990 | vos_mem_free(pTdlsLinkTeardown); |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 991 | limLog(pMac, LOGP, FL("Posting tdls link teardown %d failed, reason = %x "), retCode); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | return retCode; |
| 995 | } |
| 996 | |
| 997 | #endif |
| 998 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 999 | #ifdef WLAN_FEATURE_11W |
| 1000 | /** --------------------------------------------------------- |
| 1001 | \fn limSendExcludeUnencryptInd |
| 1002 | \brief LIM sends a message to HAL to indicate whether to |
| 1003 | ignore or indicate the unprotected packet error |
| 1004 | \param tpAniSirGlobal pMac |
| 1005 | \param tANI_BOOLEAN excludeUnenc - true: ignore, false: |
| 1006 | indicate |
| 1007 | \param tpPESession psessionEntry - session context |
| 1008 | \return status |
| 1009 | -----------------------------------------------------------*/ |
| 1010 | tSirRetStatus limSendExcludeUnencryptInd(tpAniSirGlobal pMac, |
| 1011 | tANI_BOOLEAN excludeUnenc, |
| 1012 | tpPESession psessionEntry) |
| 1013 | { |
| 1014 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 1015 | tSirMsgQ msgQ; |
| 1016 | tSirWlanExcludeUnencryptParam * pExcludeUnencryptParam; |
| 1017 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1018 | pExcludeUnencryptParam = vos_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam)); |
| 1019 | if ( NULL == pExcludeUnencryptParam ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1020 | { |
| 1021 | limLog(pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1022 | FL( "Unable to allocate memory during limSendExcludeUnencryptInd")); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1023 | return eSIR_MEM_ALLOC_FAILED; |
| 1024 | } |
| 1025 | |
| 1026 | pExcludeUnencryptParam->excludeUnencrypt = excludeUnenc; |
| 1027 | sirCopyMacAddr(pExcludeUnencryptParam->bssId, psessionEntry->bssId); |
| 1028 | |
| 1029 | msgQ.type = WDA_EXCLUDE_UNENCRYPTED_IND; |
| 1030 | msgQ.reserved = 0; |
| 1031 | msgQ.bodyptr = pExcludeUnencryptParam; |
| 1032 | msgQ.bodyval = 0; |
| 1033 | PELOG3(limLog(pMac, LOG3, |
| 1034 | FL("Sending WDA_EXCLUDE_UNENCRYPTED_IND"));) |
| 1035 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 1036 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 1037 | if (eSIR_SUCCESS != retCode) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1038 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1039 | vos_mem_free(pExcludeUnencryptParam); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1040 | limLog(pMac, LOGP, |
| 1041 | FL("Posting WDA_EXCLUDE_UNENCRYPTED_IND to WDA failed, reason=%X"), |
| 1042 | retCode); |
| 1043 | } |
| 1044 | |
| 1045 | return retCode; |
| 1046 | } |
| 1047 | #endif |
| 1048 | |