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