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 |
Abhishek Singh | 5fef404 | 2014-11-25 18:33:00 +0530 | [diff] [blame^] | 74 | ,{SIR_MAC_RSN_EID, 1, {0, 0, 0, 0}} |
| 75 | ,{SIR_MAC_WPA_EID, 1, {0, 0, 0, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 78 | /** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | tSirRetStatus 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 105 | pCFParams = vos_mem_malloc(sizeof( tUpdateCFParams )); |
| 106 | if ( NULL == pCFParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | { |
| 108 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 109 | FL( "Unable to allocate memory during Update CF Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 111 | goto returnFailure; |
| 112 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 113 | vos_mem_set( (tANI_U8 *) pCFParams, sizeof(tUpdateCFParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 114 | pCFParams->cfpCount = cfpCount; |
| 115 | pCFParams->cfpPeriod = cfpPeriod; |
| 116 | pCFParams->bssIdx = bssIdx; |
| 117 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | msgQ.type = WDA_UPDATE_CF_IND; |
| 119 | msgQ.reserved = 0; |
| 120 | msgQ.bodyptr = pCFParams; |
| 121 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 122 | limLog( pMac, LOG3, |
| 123 | FL( "Sending WDA_UPDATE_CF_IND..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 124 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 126 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 127 | vos_mem_free(pCFParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 128 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 129 | FL("Posting WDA_UPDATE_CF_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 130 | retCode ); |
| 131 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 132 | returnFailure: |
| 133 | return retCode; |
| 134 | } |
| 135 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 136 | /** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 157 | tSirRetStatus limSendBeaconParams(tpAniSirGlobal pMac, |
| 158 | tpUpdateBeaconParams pUpdatedBcnParams, |
| 159 | tpPESession psessionEntry ) |
| 160 | { |
| 161 | tpUpdateBeaconParams pBcnParams = NULL; |
| 162 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 163 | tSirMsgQ msgQ; |
| 164 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 165 | pBcnParams = vos_mem_malloc(sizeof(*pBcnParams)); |
| 166 | if ( NULL == pBcnParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 167 | { |
| 168 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 169 | FL( "Unable to allocate memory during Update Beacon Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 170 | return eSIR_MEM_ALLOC_FAILED; |
| 171 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 172 | vos_mem_copy((tANI_U8 *) pBcnParams, pUpdatedBcnParams, sizeof(*pBcnParams)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 173 | msgQ.type = WDA_UPDATE_BEACON_IND; |
| 174 | msgQ.reserved = 0; |
| 175 | msgQ.bodyptr = pBcnParams; |
| 176 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | PELOG3(limLog( pMac, LOG3, |
| 178 | FL( "Sending WDA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x" ), |
| 179 | pUpdatedBcnParams->paramChangeBitmap);) |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 180 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 188 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 189 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 190 | vos_mem_free(pBcnParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 191 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 192 | FL("Posting WDA_UPDATE_BEACON_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | retCode ); |
| 194 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | limSendBeaconInd(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 196 | return retCode; |
| 197 | } |
| 198 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 199 | /** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 220 | #if !defined WLAN_FEATURE_VOWIFI |
| 221 | tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, |
| 222 | tANI_U8 chnlNumber, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 223 | ePhyChanBondState secondaryChnlOffset, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 224 | tANI_U8 localPwrConstraint, tANI_U8 peSessionId) |
| 225 | #else |
| 226 | tSirRetStatus limSendSwitchChnlParams(tpAniSirGlobal pMac, |
| 227 | tANI_U8 chnlNumber, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 228 | ePhyChanBondState secondaryChnlOffset, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | tPowerdBm maxTxPower, tANI_U8 peSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 230 | #endif |
| 231 | { |
| 232 | tpSwitchChannelParams pChnlParams = NULL; |
| 233 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 234 | tSirMsgQ msgQ; |
| 235 | tpPESession pSessionEntry; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 236 | if((pSessionEntry = peFindSessionBySessionId(pMac, peSessionId)) == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | { |
| 238 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 239 | FL( "Unable to get Session for session Id %d" ), peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 240 | return eSIR_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 241 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 242 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 247 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 248 | goto returnFailure; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 249 | } |
| 250 | vos_mem_set((tANI_U8 *) pChnlParams, sizeof(tSwitchChannelParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | pChnlParams->secondaryChannelOffset = secondaryChnlOffset; |
| 252 | pChnlParams->channelNumber= chnlNumber; |
| 253 | #if defined WLAN_FEATURE_VOWIFI |
| 254 | pChnlParams->maxTxPower = maxTxPower; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 255 | vos_mem_copy( pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 256 | #else |
| 257 | pChnlParams->localPowerConstraint = localPwrConstraint; |
| 258 | #endif |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 259 | vos_mem_copy( pChnlParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | pChnlParams->peSessionId = peSessionId; |
Kalikinkar dhara | 085c02f | 2014-02-28 15:32:12 -0800 | [diff] [blame] | 261 | |
| 262 | if (LIM_SWITCH_CHANNEL_CSA == pSessionEntry->channelChangeCSA ) |
| 263 | { |
| 264 | pChnlParams->channelSwitchSrc = eHAL_CHANNEL_SWITCH_SOURCE_CSA; |
| 265 | pSessionEntry->channelChangeCSA = 0; |
| 266 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 267 | //we need to defer the message until we get the response back from WDA. |
| 268 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 269 | msgQ.type = WDA_CHNL_SWITCH_REQ; |
| 270 | msgQ.reserved = 0; |
| 271 | msgQ.bodyptr = pChnlParams; |
| 272 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 273 | #if defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | 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 Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 282 | MTRACE(macTraceMsgTx(pMac, peSessionId, msgQ.type)); |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 283 | limLog(pMac,LOG1,"SessionId:%d WDA_CHNL_SWITCH_REQ for SSID:%s",peSessionId, |
| 284 | pSessionEntry->ssId.ssId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 286 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 287 | vos_mem_free(pChnlParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 288 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 289 | FL("Posting WDA_CHNL_SWITCH_REQ to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | retCode ); |
| 291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 292 | returnFailure: |
| 293 | return retCode; |
| 294 | } |
| 295 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 296 | /** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 317 | tSirRetStatus 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 322 | |
| 323 | pEdcaParams = vos_mem_malloc(sizeof(tEdcaParams)); |
| 324 | if ( NULL == pEdcaParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 325 | { |
| 326 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 327 | FL( "Unable to allocate memory during Update EDCA Params" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 328 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 329 | return retCode; |
| 330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 331 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | msgQ.type = WDA_UPDATE_EDCA_PROFILE_IND; |
| 338 | msgQ.reserved = 0; |
| 339 | msgQ.bodyptr = pEdcaParams; |
| 340 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 341 | { |
| 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 Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 346 | 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] | 347 | i, pUpdatedEdcaParams[i].aci.aifsn, pUpdatedEdcaParams[i].aci.acm, |
| 348 | pUpdatedEdcaParams[i].cw.min, pUpdatedEdcaParams[i].cw.max, pUpdatedEdcaParams[i].txoplimit);) |
| 349 | } |
| 350 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 351 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 353 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 354 | vos_mem_free(pEdcaParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 356 | FL("Posting WDA_UPDATE_EDCA_PROFILE_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | retCode ); |
| 358 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | return retCode; |
| 360 | } |
| 361 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | /** |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | // 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 391 | /* 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 Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 404 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | 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 Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 409 | 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] | 410 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 454 | /** --------------------------------------------------------- |
| 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 |
| 463 | tSirRetStatus limSetLinkState(tpAniSirGlobal pMac, tSirLinkState state,tSirMacAddr bssId) |
| 464 | { |
| 465 | tSirMsgQ msg; |
| 466 | tSirRetStatus retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | msg.type = WDA_SET_LINK_STATE; |
| 468 | msg.bodyval = (tANI_U32) state; |
| 469 | msg.bodyptr = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 470 | MTRACE(macTraceMsgTx(pMac, 0, msg.type)); |
| 471 | retCode = wdaPostCtrlMsg(pMac, &msg); |
| 472 | if (retCode != eSIR_SUCCESS) |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 473 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 474 | return retCode; |
| 475 | } |
| 476 | #endif //0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | tSirRetStatus 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 484 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 485 | pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams)); |
| 486 | if ( NULL == pLinkStateParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 487 | { |
| 488 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 489 | FL( "Unable to allocate memory while sending Set Link State" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 491 | return retCode; |
| 492 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 493 | vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | pLinkStateParams->state = state; |
| 495 | pLinkStateParams->callback = callback; |
| 496 | pLinkStateParams->callbackArg = callbackArg; |
| 497 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 498 | /* Copy Mac address */ |
| 499 | sirCopyMacAddr(pLinkStateParams->bssid,bssId); |
| 500 | sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 501 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 502 | msgQ.type = WDA_SET_LINK_STATE; |
| 503 | msgQ.reserved = 0; |
| 504 | msgQ.bodyptr = pLinkStateParams; |
| 505 | msgQ.bodyval = 0; |
| 506 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 507 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | |
| 509 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 510 | if (retCode != eSIR_SUCCESS) |
| 511 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 512 | vos_mem_free(pLinkStateParams); |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 513 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), |
| 514 | state, retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | return retCode; |
| 517 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 519 | extern tSirRetStatus limSetLinkStateFT(tpAniSirGlobal pMac, tSirLinkState |
| 520 | state,tSirMacAddr bssId, tSirMacAddr selfMacAddr, int ft, tpPESession psessionEntry) |
| 521 | { |
| 522 | tSirMsgQ msgQ; |
| 523 | tSirRetStatus retCode; |
| 524 | tpLinkStateParams pLinkStateParams = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 526 | pLinkStateParams = vos_mem_malloc(sizeof(tLinkStateParams)); |
| 527 | if ( NULL == pLinkStateParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 528 | { |
| 529 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 530 | FL( "Unable to allocate memory while sending Set Link State" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 532 | return retCode; |
| 533 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 534 | vos_mem_set((tANI_U8 *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | pLinkStateParams->state = state; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 536 | /* Copy Mac address */ |
| 537 | sirCopyMacAddr(pLinkStateParams->bssid,bssId); |
| 538 | sirCopyMacAddr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 539 | pLinkStateParams->ft = 1; |
| 540 | pLinkStateParams->session = psessionEntry; |
| 541 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | msgQ.type = WDA_SET_LINK_STATE; |
| 543 | msgQ.reserved = 0; |
| 544 | msgQ.bodyptr = pLinkStateParams; |
| 545 | msgQ.bodyval = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 546 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 554 | |
| 555 | retCode = (tANI_U32)wdaPostCtrlMsg(pMac, &msgQ); |
| 556 | if (retCode != eSIR_SUCCESS) |
| 557 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 558 | vos_mem_free(pLinkStateParams); |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 559 | limLog(pMac, LOGP, FL("Posting link state %d failed, reason = %x "), |
| 560 | state, retCode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 561 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 562 | return retCode; |
| 563 | } |
| 564 | #endif |
| 565 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 566 | /** --------------------------------------------------------- |
| 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 | -----------------------------------------------------------*/ |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 573 | tSirRetStatus limSendSetTxPowerReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 574 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 575 | 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 584 | txPowerReq = vos_mem_malloc(sizeof(tSirSetTxPowerReq)); |
| 585 | if ( NULL == txPowerReq ) |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 586 | { |
| 587 | return eSIR_FAILURE; |
| 588 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 589 | vos_mem_copy(txPowerReq, (tSirSetTxPowerReq *)pMsgBuf, sizeof(tSirSetTxPowerReq)); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 590 | |
| 591 | /* Found corresponding seesion to find BSS IDX */ |
| 592 | psessionEntry = peFindSessionByBssid(pMac, txPowerReq->bssId, &sessionId); |
| 593 | if (NULL == psessionEntry) |
| 594 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 595 | vos_mem_free(txPowerReq); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 596 | 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | msgQ.type = WDA_SET_TX_POWER_REQ; |
| 604 | msgQ.reserved = 0; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 605 | msgQ.bodyptr = txPowerReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 606 | msgQ.bodyval = 0; |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 607 | 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] | 608 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 609 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 610 | if (eSIR_SUCCESS != retCode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | { |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 612 | 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] | 613 | vos_mem_free(txPowerReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 614 | return retCode; |
| 615 | } |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 616 | 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 | -----------------------------------------------------------*/ |
| 626 | tSirRetStatus limSendHT40OBSSScanInd(tpAniSirGlobal pMac, |
| 627 | tpPESession psessionEntry) |
| 628 | { |
| 629 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 630 | tSirHT40OBSSScanInd *ht40OBSSScanInd; |
| 631 | tANI_U32 validChannelNum; |
| 632 | tSirMsgQ msgQ; |
Mukul Sharma | d2b8186 | 2014-07-01 21:01:04 +0530 | [diff] [blame] | 633 | tANI_U8 validChanList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 634 | 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 Patel | d391203 | 2014-11-21 16:54:07 +0530 | [diff] [blame] | 663 | ht40OBSSScanInd->currentOperatingClass = 81; |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 664 | |
| 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 | -----------------------------------------------------------*/ |
| 717 | tSirRetStatus 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 | } |
schang | 86c22c4 | 2013-03-13 18:41:24 -0700 | [diff] [blame] | 744 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 745 | return retCode; |
| 746 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | /** --------------------------------------------------------- |
| 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 | -----------------------------------------------------------*/ |
| 754 | tSirRetStatus limSendGetTxPowerReq(tpAniSirGlobal pMac, tpSirGetTxPowerReq pTxPowerReq) |
| 755 | { |
| 756 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 757 | tSirMsgQ msgQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 758 | if (NULL == pTxPowerReq) |
| 759 | return retCode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | msgQ.type = WDA_GET_TX_POWER_REQ; |
| 761 | msgQ.reserved = 0; |
| 762 | msgQ.bodyptr = pTxPowerReq; |
| 763 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 764 | 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] | 765 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 766 | 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 771 | vos_mem_free(pTxPowerReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 772 | } |
| 773 | return retCode; |
| 774 | } |
| 775 | return retCode; |
| 776 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 777 | /** --------------------------------------------------------- |
| 778 | \fn limSendBeaconFilterInfo |
| 779 | \brief LIM sends beacon filtering info to WDA |
| 780 | \param tpAniSirGlobal pMac |
| 781 | \return None |
| 782 | -----------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 783 | tSirRetStatus limSendBeaconFilterInfo(tpAniSirGlobal pMac,tpPESession psessionEntry) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 784 | { |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 792 | |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 793 | if( psessionEntry == NULL ) |
| 794 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 795 | limLog( pMac, LOGE, FL("Fail to find the right session ")); |
Madan Mohan Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 796 | retCode = eSIR_FAILURE; |
| 797 | return retCode; |
| 798 | } |
Abhishek Singh | 5fef404 | 2014-11-25 18:33:00 +0530 | [diff] [blame^] | 799 | /* |
| 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 809 | pBeaconFilterMsg = vos_mem_malloc(msgSize); |
| 810 | if ( NULL == pBeaconFilterMsg ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 811 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 812 | limLog( pMac, LOGP, FL("Fail to allocate memory for beaconFiilterMsg ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 814 | return retCode; |
| 815 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 816 | vos_mem_set((tANI_U8 *) pBeaconFilterMsg, msgSize, 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 817 | // 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 822 | pBeaconFilterMsg->beaconInterval = (tANI_U16) psessionEntry->beaconParams.beaconInterval; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 823 | // Fill in number of IEs in beaconFilterTable |
Abhishek Singh | 5fef404 | 2014-11-25 18:33:00 +0530 | [diff] [blame^] | 824 | /* |
| 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 Koyyalamudi | a84edda | 2012-10-15 14:58:25 -0700 | [diff] [blame] | 834 | //Fill the BSSIDX |
| 835 | pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx; |
| 836 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 837 | //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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 850 | msgQ.type = WDA_BEACON_FILTER_IND; |
| 851 | msgQ.reserved = 0; |
| 852 | msgQ.bodyptr = pBeaconFilterMsg; |
| 853 | msgQ.bodyval = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 854 | limLog( pMac, LOG3, FL( "Sending WDA_BEACON_FILTER_IND..." )); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 855 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 856 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 857 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 858 | vos_mem_free(pBeaconFilterMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 859 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 860 | FL("Posting WDA_BEACON_FILTER_IND to WDA failed, reason=%X"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 861 | retCode ); |
| 862 | return retCode; |
| 863 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 864 | return retCode; |
| 865 | } |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 866 | |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 867 | /** |
| 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 Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 876 | tSirRetStatus limSendModeUpdate(tpAniSirGlobal pMac, |
| 877 | tUpdateVHTOpMode *pTempParam, |
| 878 | tpPESession psessionEntry ) |
| 879 | { |
| 880 | tUpdateVHTOpMode *pVhtOpMode = NULL; |
| 881 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 882 | tSirMsgQ msgQ; |
| 883 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 884 | pVhtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode)); |
| 885 | if ( NULL == pVhtOpMode ) |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 886 | { |
| 887 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 888 | FL( "Unable to allocate memory during Update Op Mode" )); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 889 | return eSIR_MEM_ALLOC_FAILED; |
| 890 | } |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 891 | vos_mem_copy((tANI_U8 *)pVhtOpMode, pTempParam, sizeof(tUpdateVHTOpMode)); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 892 | msgQ.type = WDA_UPDATE_OP_MODE; |
| 893 | msgQ.reserved = 0; |
| 894 | msgQ.bodyptr = pVhtOpMode; |
| 895 | msgQ.bodyval = 0; |
Abhishek Singh | df8eb31 | 2014-11-15 00:49:28 +0530 | [diff] [blame] | 896 | limLog( pMac, LOG1, |
| 897 | FL( "Sending WDA_UPDATE_OP_MODE, opMode = %d staid = %d" ), |
| 898 | pVhtOpMode->opMode,pVhtOpMode->staId); |
Leela Venkata Kiran Kumar Reddy Chirala | 68a6abe | 2013-02-28 07:43:16 -0800 | [diff] [blame] | 899 | 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 Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 907 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 908 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 909 | vos_mem_free(pVhtOpMode); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 910 | limLog( pMac, LOGP, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 911 | FL("Posting WDA_UPDATE_OP_MODE to WDA failed, reason=%X"), |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 912 | retCode ); |
| 913 | } |
| 914 | |
| 915 | return retCode; |
| 916 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 917 | |
| 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 | -----------------------------------------------------------*/ |
| 926 | tSirRetStatus 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 934 | pTdlsLinkEstablish = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishInd)); |
| 935 | if ( NULL == pTdlsLinkEstablish ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 936 | { |
| 937 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 938 | FL( "Unable to allocate memory while sending Tdls Link Establish " )); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 939 | |
| 940 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 941 | return retCode; |
| 942 | } |
| 943 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 944 | vos_mem_set((tANI_U8 *) pTdlsLinkEstablish, sizeof(tSirTdlsLinkEstablishInd), 0); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 945 | |
| 946 | pTdlsLinkEstablish->bIsResponder = !!bIsPeerResponder; |
| 947 | pTdlsLinkEstablish->linkIdenOffset = linkIdenOffset; |
| 948 | pTdlsLinkEstablish->ptiBufStatusOffset = ptiBufStatusOffset; |
| 949 | pTdlsLinkEstablish->ptiTemplateLen = ptiFrameLen; |
| 950 | /* Copy ptiFrame template */ |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 951 | vos_mem_copy(pTdlsLinkEstablish->ptiTemplateBuf, ptiFrame, ptiFrameLen); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 952 | /* Copy extended capabilities */ |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 953 | vos_mem_copy((tANI_U8 *) pTdlsLinkEstablish->extCapability, extCapability, sizeof(pTdlsLinkEstablish->extCapability)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 954 | |
| 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 965 | vos_mem_free(pTdlsLinkEstablish); |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 966 | 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] | 967 | } |
| 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 | -----------------------------------------------------------*/ |
| 979 | tSirRetStatus limSendTdlsLinkTeardown(tpAniSirGlobal pMac, tANI_U16 staId) |
| 980 | { |
| 981 | tSirMsgQ msgQ; |
| 982 | tSirRetStatus retCode; |
| 983 | tpSirTdlsLinkTeardownInd pTdlsLinkTeardown = NULL; |
| 984 | |
| 985 | // Allocate memory. |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 986 | pTdlsLinkTeardown = vos_mem_malloc(sizeof(tSirTdlsLinkTeardownInd)); |
| 987 | if ( NULL == pTdlsLinkTeardown ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 988 | { |
| 989 | limLog( pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 990 | FL( "Unable to allocate memory while sending Tdls Link Teardown " )); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 991 | |
| 992 | retCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 993 | return retCode; |
| 994 | } |
| 995 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 996 | vos_mem_set((tANI_U8 *) pTdlsLinkTeardown, sizeof(tSirTdlsLinkTeardownInd), 0); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 997 | |
| 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 Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1010 | vos_mem_free(pTdlsLinkTeardown); |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 1011 | 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] | 1012 | } |
| 1013 | |
| 1014 | return retCode; |
| 1015 | } |
| 1016 | |
| 1017 | #endif |
| 1018 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1019 | #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 | -----------------------------------------------------------*/ |
| 1030 | tSirRetStatus limSendExcludeUnencryptInd(tpAniSirGlobal pMac, |
| 1031 | tANI_BOOLEAN excludeUnenc, |
| 1032 | tpPESession psessionEntry) |
| 1033 | { |
| 1034 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 1035 | tSirMsgQ msgQ; |
| 1036 | tSirWlanExcludeUnencryptParam * pExcludeUnencryptParam; |
| 1037 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1038 | pExcludeUnencryptParam = vos_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam)); |
| 1039 | if ( NULL == pExcludeUnencryptParam ) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1040 | { |
| 1041 | limLog(pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1042 | FL( "Unable to allocate memory during limSendExcludeUnencryptInd")); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1043 | 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 Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 1056 | retCode = wdaPostCtrlMsg(pMac, &msgQ); |
| 1057 | if (eSIR_SUCCESS != retCode) |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1058 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1059 | vos_mem_free(pExcludeUnencryptParam); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 1060 | 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 | |