Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 2 | * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [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 | */ |
| 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 | * lim_send_messages.c: Provides functions to send messages or Indications to HAL. |
| 31 | * Author: Sunit Bhatia |
| 32 | * Date: 09/21/2006 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * |
| 36 | * -------------------------------------------------------------------------- |
| 37 | * |
| 38 | */ |
| 39 | #include "lim_send_messages.h" |
| 40 | #include "cfg_api.h" |
| 41 | #include "lim_trace.h" |
| 42 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 43 | #include "host_diag_core_log.h" |
| 44 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 45 | /* When beacon filtering is enabled, firmware will |
| 46 | * analyze the selected beacons received during BMPS, |
| 47 | * and monitor any changes in the IEs as listed below. |
| 48 | * The format of the table is: |
| 49 | * - EID |
| 50 | * - Check for IE presence |
| 51 | * - Byte offset |
| 52 | * - Byte value |
| 53 | * - Bit Mask |
| 54 | * - Byte refrence |
| 55 | */ |
| 56 | static tBeaconFilterIe beacon_filter_table[] = { |
| 57 | {SIR_MAC_DS_PARAM_SET_EID, 0, {0, 0, DS_PARAM_CHANNEL_MASK, 0} }, |
| 58 | {SIR_MAC_ERP_INFO_EID, 0, {0, 0, ERP_FILTER_MASK, 0} }, |
| 59 | {SIR_MAC_EDCA_PARAM_SET_EID, 0, {0, 0, EDCA_FILTER_MASK, 0} }, |
| 60 | {SIR_MAC_QOS_CAPABILITY_EID, 0, {0, 0, QOS_FILTER_MASK, 0} }, |
| 61 | {SIR_MAC_CHNL_SWITCH_ANN_EID, 1, {0, 0, 0, 0} }, |
| 62 | {SIR_MAC_HT_INFO_EID, 0, {0, 0, HT_BYTE0_FILTER_MASK, 0} }, |
| 63 | {SIR_MAC_HT_INFO_EID, 0, {2, 0, HT_BYTE2_FILTER_MASK, 0} }, |
| 64 | {SIR_MAC_HT_INFO_EID, 0, {5, 0, HT_BYTE5_FILTER_MASK, 0} } |
| 65 | #if defined WLAN_FEATURE_VOWIFI |
| 66 | , {SIR_MAC_PWR_CONSTRAINT_EID, 0, {0, 0, 0, 0} } |
| 67 | #endif |
| 68 | #ifdef WLAN_FEATURE_11AC |
| 69 | , {SIR_MAC_VHT_OPMODE_EID, 0, {0, 0, 0, 0} } |
| 70 | , {SIR_MAC_VHT_OPERATION_EID, 0, {0, 0, VHTOP_CHWIDTH_MASK, 0} } |
| 71 | #endif |
| 72 | }; |
| 73 | |
| 74 | /** |
| 75 | * lim_send_cf_params() |
| 76 | * |
| 77 | ***FUNCTION: |
| 78 | * This function is called to send CFP Parameters to WMA, when they are changed. |
| 79 | * |
| 80 | ***LOGIC: |
| 81 | * |
| 82 | ***ASSUMPTIONS: |
| 83 | * NA |
| 84 | * |
| 85 | ***NOTE: |
| 86 | * NA |
| 87 | * |
| 88 | * @param pMac pointer to Global Mac structure. |
| 89 | * @param bssIdx Bss Index of the BSS to which STA is associated. |
| 90 | * @param cfpCount CFP Count, if that is changed. |
| 91 | * @param cfpPeriod CFP Period if that is changed. |
| 92 | * |
| 93 | * @return success if message send is ok, else false. |
| 94 | */ |
| 95 | tSirRetStatus lim_send_cf_params(tpAniSirGlobal pMac, uint8_t bssIdx, |
| 96 | uint8_t cfpCount, uint8_t cfpPeriod) |
| 97 | { |
| 98 | tpUpdateCFParams pCFParams = NULL; |
| 99 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 100 | tSirMsgQ msgQ; |
| 101 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 102 | pCFParams = qdf_mem_malloc(sizeof(tUpdateCFParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | if (NULL == pCFParams) { |
| 104 | lim_log(pMac, LOGP, |
| 105 | FL("Unable to allocate memory during Update CF Params")); |
| 106 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 107 | goto returnFailure; |
| 108 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 109 | qdf_mem_set((uint8_t *) pCFParams, sizeof(tUpdateCFParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 110 | pCFParams->cfpCount = cfpCount; |
| 111 | pCFParams->cfpPeriod = cfpPeriod; |
| 112 | pCFParams->bssIdx = bssIdx; |
| 113 | |
| 114 | msgQ.type = WMA_UPDATE_CF_IND; |
| 115 | msgQ.reserved = 0; |
| 116 | msgQ.bodyptr = pCFParams; |
| 117 | msgQ.bodyval = 0; |
| 118 | lim_log(pMac, LOG3, FL("Sending WMA_UPDATE_CF_IND...")); |
| 119 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 120 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 121 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 122 | qdf_mem_free(pCFParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 123 | lim_log(pMac, LOGP, |
| 124 | FL("Posting WMA_UPDATE_CF_IND failed, reason=%X"), |
| 125 | retCode); |
| 126 | } |
| 127 | returnFailure: |
| 128 | return retCode; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * lim_send_beacon_params() - updates bcn params to WMA |
| 133 | * |
| 134 | * @pMac : pointer to Global Mac structure. |
| 135 | * @tpUpdateBeaconParams : pointer to the structure, which contains the beacon |
| 136 | * parameters which are changed. |
| 137 | * |
| 138 | * This function is called to send beacon interval, short preamble or other |
| 139 | * parameters to WMA, which are changed and indication is received in beacon. |
| 140 | * |
| 141 | * @return success if message send is ok, else false. |
| 142 | */ |
| 143 | tSirRetStatus lim_send_beacon_params(tpAniSirGlobal pMac, |
| 144 | tpUpdateBeaconParams pUpdatedBcnParams, |
| 145 | tpPESession psessionEntry) |
| 146 | { |
| 147 | tpUpdateBeaconParams pBcnParams = NULL; |
| 148 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 149 | tSirMsgQ msgQ; |
| 150 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 151 | pBcnParams = qdf_mem_malloc(sizeof(*pBcnParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | if (NULL == pBcnParams) { |
| 153 | lim_log(pMac, LOGP, |
| 154 | FL("Unable to allocate memory during Update Beacon Params")); |
| 155 | return eSIR_MEM_ALLOC_FAILED; |
| 156 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 157 | qdf_mem_copy((uint8_t *) pBcnParams, pUpdatedBcnParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 158 | sizeof(*pBcnParams)); |
| 159 | msgQ.type = WMA_UPDATE_BEACON_IND; |
| 160 | msgQ.reserved = 0; |
| 161 | msgQ.bodyptr = pBcnParams; |
| 162 | msgQ.bodyval = 0; |
| 163 | PELOG3(lim_log(pMac, LOG3, |
| 164 | FL("Sending WMA_UPDATE_BEACON_IND, paramChangeBitmap in hex = %x"), |
| 165 | pUpdatedBcnParams->paramChangeBitmap);) |
| 166 | if (NULL == psessionEntry) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 167 | qdf_mem_free(pBcnParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 168 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 169 | return eSIR_FAILURE; |
| 170 | } else { |
| 171 | MTRACE(mac_trace_msg_tx(pMac, |
| 172 | psessionEntry->peSessionId, |
| 173 | msgQ.type)); |
| 174 | } |
| 175 | pBcnParams->smeSessionId = psessionEntry->smeSessionId; |
| 176 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 177 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 178 | qdf_mem_free(pBcnParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 179 | lim_log(pMac, LOGP, |
| 180 | FL("Posting WMA_UPDATE_BEACON_IND, reason=%X"), |
| 181 | retCode); |
| 182 | } |
| 183 | lim_send_beacon_ind(pMac, psessionEntry); |
| 184 | return retCode; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * lim_send_switch_chnl_params() |
| 189 | * |
| 190 | ***FUNCTION: |
| 191 | * This function is called to send Channel Switch Indication to WMA |
| 192 | * |
| 193 | ***LOGIC: |
| 194 | * |
| 195 | ***ASSUMPTIONS: |
| 196 | * NA |
| 197 | * |
| 198 | ***NOTE: |
| 199 | * NA |
| 200 | * |
| 201 | * @param pMac pointer to Global Mac structure. |
| 202 | * @param chnlNumber New Channel Number to be switched to. |
| 203 | * @param ch_width an enum for channel width. |
| 204 | * @param localPowerConstraint 11h local power constraint value |
| 205 | * |
| 206 | * @return success if message send is ok, else false. |
| 207 | */ |
| 208 | #if !defined WLAN_FEATURE_VOWIFI |
| 209 | tSirRetStatus lim_send_switch_chnl_params(tpAniSirGlobal pMac, |
| 210 | uint8_t chnlNumber, |
| 211 | uint8_t ch_center_freq_seg0, |
| 212 | uint8_t ch_center_freq_seg1, |
| 213 | phy_ch_width ch_width, |
| 214 | uint8_t localPwrConstraint, |
| 215 | uint8_t peSessionId, |
| 216 | uint8_t is_restart) |
| 217 | #else |
| 218 | tSirRetStatus lim_send_switch_chnl_params(tpAniSirGlobal pMac, |
| 219 | uint8_t chnlNumber, |
| 220 | uint8_t ch_center_freq_seg0, |
| 221 | uint8_t ch_center_freq_seg1, |
| 222 | phy_ch_width ch_width, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 223 | int8_t maxTxPower, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 224 | uint8_t peSessionId, |
| 225 | uint8_t is_restart) |
| 226 | #endif |
| 227 | { |
| 228 | tpSwitchChannelParams pChnlParams = NULL; |
| 229 | tSirMsgQ msgQ; |
| 230 | tpPESession pSessionEntry; |
| 231 | pSessionEntry = pe_find_session_by_session_id(pMac, peSessionId); |
| 232 | if (pSessionEntry == NULL) { |
| 233 | lim_log(pMac, LOGP, FL( |
| 234 | "Unable to get Session for session Id %d"), |
| 235 | peSessionId); |
| 236 | return eSIR_FAILURE; |
| 237 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 238 | pChnlParams = qdf_mem_malloc(sizeof(tSwitchChannelParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 239 | if (NULL == pChnlParams) { |
| 240 | lim_log(pMac, LOGP, FL( |
| 241 | "Unable to allocate memory for Switch Ch Params")); |
| 242 | return eSIR_MEM_ALLOC_FAILED; |
| 243 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 244 | qdf_mem_set((uint8_t *) pChnlParams, sizeof(tSwitchChannelParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | pChnlParams->channelNumber = chnlNumber; |
| 246 | pChnlParams->ch_center_freq_seg0 = ch_center_freq_seg0; |
| 247 | pChnlParams->ch_center_freq_seg1 = ch_center_freq_seg1; |
| 248 | pChnlParams->ch_width = ch_width; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 249 | qdf_mem_copy(pChnlParams->selfStaMacAddr, pSessionEntry->selfMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 250 | sizeof(tSirMacAddr)); |
| 251 | #if defined WLAN_FEATURE_VOWIFI |
| 252 | pChnlParams->maxTxPower = maxTxPower; |
| 253 | #else |
| 254 | pChnlParams->localPowerConstraint = localPwrConstraint; |
| 255 | #endif |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 256 | qdf_mem_copy(pChnlParams->bssId, pSessionEntry->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 257 | sizeof(tSirMacAddr)); |
| 258 | pChnlParams->peSessionId = peSessionId; |
| 259 | pChnlParams->vhtCapable = pSessionEntry->vhtCapability; |
| 260 | pChnlParams->dot11_mode = pSessionEntry->dot11mode; |
| 261 | pChnlParams->nss = pSessionEntry->nss; |
| 262 | lim_log(pMac, LOG2, FL("nss value: %d"), pChnlParams->nss); |
| 263 | |
| 264 | /*Set DFS flag for DFS channel */ |
| 265 | if (cds_get_channel_state(chnlNumber) == CHANNEL_STATE_DFS) |
| 266 | pChnlParams->isDfsChannel = true; |
| 267 | else |
| 268 | pChnlParams->isDfsChannel = false; |
| 269 | |
| 270 | pChnlParams->restart_on_chan_switch = is_restart; |
| 271 | |
| 272 | /* we need to defer the message until we |
| 273 | * get the response back from WMA |
| 274 | */ |
| 275 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 276 | msgQ.type = WMA_CHNL_SWITCH_REQ; |
| 277 | msgQ.reserved = 0; |
| 278 | msgQ.bodyptr = pChnlParams; |
| 279 | msgQ.bodyval = 0; |
| 280 | #if defined WLAN_FEATURE_VOWIFI |
| 281 | PELOG3(lim_log(pMac, LOG3, FL( |
| 282 | "Sending CH_SWITCH_REQ, ch_width %d, ch_num %d, maxTxPower %d"), |
| 283 | pChnlParams->ch_width, |
| 284 | pChnlParams->channelNumber, pChnlParams->maxTxPower);) |
| 285 | #else |
| 286 | PELOG3(lim_log(pMac, LOG3, FL( |
| 287 | "Sending CH_SWITCH_REQ, ch_width %d, ch_num %d, local_pwr_constraint %d"), |
| 288 | pChnlParams->ch_width, |
| 289 | pChnlParams->channelNumber, |
| 290 | pChnlParams->localPowerConstraint);) |
| 291 | #endif |
| 292 | MTRACE(mac_trace_msg_tx(pMac, peSessionId, msgQ.type)); |
| 293 | if (eSIR_SUCCESS != wma_post_ctrl_msg(pMac, &msgQ)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 294 | qdf_mem_free(pChnlParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | lim_log(pMac, LOGP, FL( |
| 296 | "Posting CH_SWITCH_REQ to WMA failed")); |
| 297 | return eSIR_FAILURE; |
| 298 | } |
| 299 | return eSIR_SUCCESS; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * lim_send_edca_params() |
| 304 | * |
| 305 | ***FUNCTION: |
| 306 | * This function is called to send dynamically changing EDCA Parameters to WMA. |
| 307 | * |
| 308 | ***LOGIC: |
| 309 | * |
| 310 | ***ASSUMPTIONS: |
| 311 | * NA |
| 312 | * |
| 313 | ***NOTE: |
| 314 | * NA |
| 315 | * |
| 316 | * @param pMac pointer to Global Mac structure. |
| 317 | * @param tpUpdatedEdcaParams pointer to the structure which contains |
| 318 | * dynamically changing EDCA parameters. |
| 319 | * @param highPerformance If the peer is Airgo (taurus) then switch to highPerformance is true. |
| 320 | * |
| 321 | * @return success if message send is ok, else false. |
| 322 | */ |
| 323 | tSirRetStatus lim_send_edca_params(tpAniSirGlobal pMac, |
| 324 | tSirMacEdcaParamRecord *pUpdatedEdcaParams, |
| 325 | uint16_t bssIdx) |
| 326 | { |
| 327 | tEdcaParams *pEdcaParams = NULL; |
| 328 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 329 | tSirMsgQ msgQ; |
| 330 | uint8_t i; |
| 331 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 332 | pEdcaParams = qdf_mem_malloc(sizeof(tEdcaParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 333 | if (NULL == pEdcaParams) { |
| 334 | lim_log(pMac, LOGP, |
| 335 | FL("Unable to allocate memory during Update EDCA Params")); |
| 336 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 337 | return retCode; |
| 338 | } |
| 339 | pEdcaParams->bssIdx = bssIdx; |
| 340 | pEdcaParams->acbe = pUpdatedEdcaParams[EDCA_AC_BE]; |
| 341 | pEdcaParams->acbk = pUpdatedEdcaParams[EDCA_AC_BK]; |
| 342 | pEdcaParams->acvi = pUpdatedEdcaParams[EDCA_AC_VI]; |
| 343 | pEdcaParams->acvo = pUpdatedEdcaParams[EDCA_AC_VO]; |
| 344 | msgQ.type = WMA_UPDATE_EDCA_PROFILE_IND; |
| 345 | msgQ.reserved = 0; |
| 346 | msgQ.bodyptr = pEdcaParams; |
| 347 | msgQ.bodyval = 0; |
| 348 | PELOG1(lim_log(pMac, LOG1, |
| 349 | FL("Sending WMA_UPDATE_EDCA_PROFILE_IND, EDCA Parameters:"));) |
| 350 | for (i = 0; i < MAX_NUM_AC; i++) { |
| 351 | PELOG1(lim_log(pMac, LOG1, |
| 352 | FL("AC[%d]: AIFSN %d, ACM %d, CWmin %d, CWmax %d, TxOp %d "), |
| 353 | i, pUpdatedEdcaParams[i].aci.aifsn, |
| 354 | pUpdatedEdcaParams[i].aci.acm, |
| 355 | pUpdatedEdcaParams[i].cw.min, |
| 356 | pUpdatedEdcaParams[i].cw.max, |
| 357 | pUpdatedEdcaParams[i].txoplimit);) |
| 358 | } |
| 359 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 360 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 361 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 362 | qdf_mem_free(pEdcaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 363 | lim_log(pMac, LOGP, |
| 364 | FL("Posting WMA_UPDATE_EDCA_PROFILE_IND failed, reason=%X"), |
| 365 | retCode); |
| 366 | } |
| 367 | return retCode; |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * lim_set_active_edca_params() - Choose best EDCA parameters |
| 372 | * |
| 373 | * @mac_ctx: pointer to Global Mac structure. |
| 374 | * @edca_params: pointer to the local EDCA parameters |
| 375 | * @pe_session: point to the session entry |
| 376 | * |
| 377 | * This function is called to set the most up-to-date EDCA parameters |
| 378 | * given the default local EDCA parameters. The rules are as following: |
| 379 | * - If ACM bit is set for all ACs, then downgrade everything to Best Effort. |
| 380 | * - If ACM is not set for any AC, then PE will use the default EDCA |
| 381 | * parameters as advertised by AP. |
| 382 | * - If ACM is set in any of the ACs, PE will use the EDCA parameters |
| 383 | * from the next best AC for which ACM is not enabled. |
| 384 | * |
| 385 | * Return: none |
| 386 | */ |
| 387 | |
| 388 | void lim_set_active_edca_params(tpAniSirGlobal mac_ctx, |
| 389 | tSirMacEdcaParamRecord *edca_params, |
| 390 | tpPESession pe_session) |
| 391 | { |
| 392 | uint8_t ac, new_ac, i; |
| 393 | uint8_t ac_admitted; |
| 394 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 395 | host_log_qos_edca_pkt_type *log_ptr = NULL; |
| 396 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 397 | /* Initialize gLimEdcaParamsActive[] to be same as localEdcaParams */ |
| 398 | pe_session->gLimEdcaParamsActive[EDCA_AC_BE] = edca_params[EDCA_AC_BE]; |
| 399 | pe_session->gLimEdcaParamsActive[EDCA_AC_BK] = edca_params[EDCA_AC_BK]; |
| 400 | pe_session->gLimEdcaParamsActive[EDCA_AC_VI] = edca_params[EDCA_AC_VI]; |
| 401 | pe_session->gLimEdcaParamsActive[EDCA_AC_VO] = edca_params[EDCA_AC_VO]; |
| 402 | /* An AC requires downgrade if the ACM bit is set, and the AC has not |
| 403 | * yet been admitted in uplink or bi-directions. |
| 404 | * If an AC requires downgrade, it will downgrade to the next beset AC |
| 405 | * for which ACM is not enabled. |
| 406 | * |
| 407 | * - There's no need to downgrade AC_BE since it IS the lowest AC. Hence |
| 408 | * start the for loop with AC_BK. |
| 409 | * - If ACM bit is set for an AC, initially downgrade it to AC_BE. Then |
| 410 | * traverse thru the AC list. If we do find the next best AC which is |
| 411 | * better than AC_BE, then use that one. For example, if ACM bits are set |
| 412 | * such that: BE_ACM=1, BK_ACM=1, VI_ACM=1, VO_ACM=0 |
| 413 | * then all AC will be downgraded to AC_BE. |
| 414 | */ |
| 415 | lim_log(mac_ctx, LOG1, FL("adAdmitMask[UPLINK] = 0x%x "), |
| 416 | pe_session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK]); |
| 417 | lim_log(mac_ctx, LOG1, FL("adAdmitMask[DOWNLINK] = 0x%x "), |
| 418 | pe_session->gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK]); |
| 419 | for (ac = EDCA_AC_BK; ac <= EDCA_AC_VO; ac++) { |
| 420 | ac_admitted = |
| 421 | ((pe_session->gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] & |
| 422 | (1 << ac)) >> ac); |
| 423 | |
| 424 | lim_log(mac_ctx, LOG1, |
| 425 | FL("For AC[%d]: acm=%d, ac_admitted=%d "), |
| 426 | ac, edca_params[ac].aci.acm, ac_admitted); |
| 427 | if ((edca_params[ac].aci.acm == 1) && (ac_admitted == 0)) { |
| 428 | lim_log(mac_ctx, LOG1, |
| 429 | FL("We need to downgrade AC %d!! "), ac); |
| 430 | /* Loop backwards through AC values until it finds |
| 431 | * acm == 0 or reaches EDCA_AC_BE. |
| 432 | * Note that for block has no executable statements. |
| 433 | */ |
| 434 | for (i = ac - 1; |
| 435 | (i > EDCA_AC_BE && |
| 436 | (edca_params[i].aci.acm != 0)); |
| 437 | i--) |
| 438 | ; |
| 439 | new_ac = i; |
| 440 | lim_log(mac_ctx, LOGW, |
| 441 | FL("Downgrading AC %d ---> AC %d "), |
| 442 | ac, new_ac); |
| 443 | pe_session->gLimEdcaParamsActive[ac] = |
| 444 | edca_params[new_ac]; |
| 445 | } |
| 446 | } |
| 447 | /* log: LOG_WLAN_QOS_EDCA_C */ |
| 448 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 449 | WLAN_HOST_DIAG_LOG_ALLOC(log_ptr, host_log_qos_edca_pkt_type, |
| 450 | LOG_WLAN_QOS_EDCA_C); |
| 451 | if (log_ptr) { |
| 452 | tSirMacEdcaParamRecord *rec; |
| 453 | |
| 454 | rec = &pe_session->gLimEdcaParamsActive[EDCA_AC_BE]; |
| 455 | log_ptr->aci_be = rec->aci.aci; |
| 456 | log_ptr->cw_be = rec->cw.max << 4 | rec->cw.min; |
| 457 | log_ptr->txoplimit_be = rec->txoplimit; |
| 458 | |
| 459 | rec = &pe_session->gLimEdcaParamsActive[EDCA_AC_BK]; |
| 460 | log_ptr->aci_bk = rec->aci.aci; |
| 461 | log_ptr->cw_bk = rec->cw.max << 4 | rec->cw.min; |
| 462 | log_ptr->txoplimit_bk = rec->txoplimit; |
| 463 | |
| 464 | rec = &pe_session->gLimEdcaParamsActive[EDCA_AC_VI]; |
| 465 | log_ptr->aci_vi = rec->aci.aci; |
| 466 | log_ptr->cw_vi = rec->cw.max << 4 | rec->cw.min; |
| 467 | log_ptr->txoplimit_vi = rec->txoplimit; |
| 468 | |
| 469 | rec = &pe_session->gLimEdcaParamsActive[EDCA_AC_VO]; |
| 470 | log_ptr->aci_vo = rec->aci.aci; |
| 471 | log_ptr->cw_vo = rec->cw.max << 4 | rec->cw.min; |
| 472 | log_ptr->txoplimit_vo = rec->txoplimit; |
| 473 | } |
| 474 | WLAN_HOST_DIAG_LOG_REPORT(log_ptr); |
| 475 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 476 | |
| 477 | return; |
| 478 | } |
| 479 | |
| 480 | /** --------------------------------------------------------- |
| 481 | \fn lim_set_link_state |
| 482 | \brief LIM sends a message to WMA to set the link state |
| 483 | \param tpAniSirGlobal pMac |
| 484 | \param tSirLinkState state |
| 485 | \return None |
| 486 | -----------------------------------------------------------*/ |
| 487 | tSirRetStatus lim_set_link_state(tpAniSirGlobal pMac, tSirLinkState state, |
| 488 | tSirMacAddr bssId, tSirMacAddr selfMacAddr, |
| 489 | tpSetLinkStateCallback callback, |
| 490 | void *callbackArg) |
| 491 | { |
| 492 | tSirMsgQ msgQ; |
| 493 | tSirRetStatus retCode; |
| 494 | tpLinkStateParams pLinkStateParams = NULL; |
| 495 | /* Allocate memory. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 496 | pLinkStateParams = qdf_mem_malloc(sizeof(tLinkStateParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 497 | if (NULL == pLinkStateParams) { |
| 498 | lim_log(pMac, LOGP, |
| 499 | FL |
| 500 | ("Unable to allocate memory while sending Set Link State")); |
| 501 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 502 | return retCode; |
| 503 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 504 | qdf_mem_set((uint8_t *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 505 | pLinkStateParams->state = state; |
| 506 | pLinkStateParams->callback = callback; |
| 507 | pLinkStateParams->callbackArg = callbackArg; |
| 508 | |
| 509 | /* Copy Mac address */ |
| 510 | sir_copy_mac_addr(pLinkStateParams->bssid, bssId); |
| 511 | sir_copy_mac_addr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 512 | |
| 513 | msgQ.type = WMA_SET_LINK_STATE; |
| 514 | msgQ.reserved = 0; |
| 515 | msgQ.bodyptr = pLinkStateParams; |
| 516 | msgQ.bodyval = 0; |
| 517 | |
| 518 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 519 | |
| 520 | retCode = (uint32_t) wma_post_ctrl_msg(pMac, &msgQ); |
| 521 | if (retCode != eSIR_SUCCESS) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 522 | qdf_mem_free(pLinkStateParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 523 | lim_log(pMac, LOGP, |
| 524 | FL("Posting link state %d failed, reason = %x "), state, |
| 525 | retCode); |
| 526 | } |
| 527 | return retCode; |
| 528 | } |
| 529 | |
| 530 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 531 | extern tSirRetStatus lim_set_link_state_ft(tpAniSirGlobal pMac, tSirLinkState |
| 532 | state, tSirMacAddr bssId, |
| 533 | tSirMacAddr selfMacAddr, int ft, |
| 534 | tpPESession psessionEntry) |
| 535 | { |
| 536 | tSirMsgQ msgQ; |
| 537 | tSirRetStatus retCode; |
| 538 | tpLinkStateParams pLinkStateParams = NULL; |
| 539 | /* Allocate memory. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 540 | pLinkStateParams = qdf_mem_malloc(sizeof(tLinkStateParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | if (NULL == pLinkStateParams) { |
| 542 | lim_log(pMac, LOGP, |
| 543 | FL |
| 544 | ("Unable to allocate memory while sending Set Link State")); |
| 545 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 546 | return retCode; |
| 547 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 548 | qdf_mem_set((uint8_t *) pLinkStateParams, sizeof(tLinkStateParams), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 549 | pLinkStateParams->state = state; |
| 550 | /* Copy Mac address */ |
| 551 | sir_copy_mac_addr(pLinkStateParams->bssid, bssId); |
| 552 | sir_copy_mac_addr(pLinkStateParams->selfMacAddr, selfMacAddr); |
| 553 | pLinkStateParams->ft = 1; |
| 554 | pLinkStateParams->session = psessionEntry; |
| 555 | |
| 556 | msgQ.type = WMA_SET_LINK_STATE; |
| 557 | msgQ.reserved = 0; |
| 558 | msgQ.bodyptr = pLinkStateParams; |
| 559 | msgQ.bodyval = 0; |
| 560 | if (NULL == psessionEntry) { |
| 561 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 562 | } else { |
| 563 | MTRACE(mac_trace_msg_tx |
| 564 | (pMac, psessionEntry->peSessionId, msgQ.type)); |
| 565 | } |
| 566 | |
| 567 | retCode = (uint32_t) wma_post_ctrl_msg(pMac, &msgQ); |
| 568 | if (retCode != eSIR_SUCCESS) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 569 | qdf_mem_free(pLinkStateParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 570 | lim_log(pMac, LOGP, |
| 571 | FL("Posting link state %d failed, reason = %x "), state, |
| 572 | retCode); |
| 573 | } |
| 574 | return retCode; |
| 575 | } |
| 576 | #endif |
| 577 | |
| 578 | /** --------------------------------------------------------- |
| 579 | \fn lim_send_beacon_filter_info |
| 580 | \brief LIM sends beacon filtering info to WMA |
| 581 | \param tpAniSirGlobal pMac |
| 582 | \return None |
| 583 | -----------------------------------------------------------*/ |
| 584 | tSirRetStatus lim_send_beacon_filter_info(tpAniSirGlobal pMac, |
| 585 | tpPESession psessionEntry) |
| 586 | { |
| 587 | tpBeaconFilterMsg pBeaconFilterMsg = NULL; |
| 588 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 589 | tSirMsgQ msgQ; |
| 590 | uint8_t *ptr; |
| 591 | uint32_t i; |
| 592 | uint32_t msgSize; |
| 593 | tpBeaconFilterIe pIe; |
| 594 | |
| 595 | if (psessionEntry == NULL) { |
| 596 | lim_log(pMac, LOGE, FL("Fail to find the right session ")); |
| 597 | retCode = eSIR_FAILURE; |
| 598 | return retCode; |
| 599 | } |
| 600 | msgSize = sizeof(tBeaconFilterMsg) + sizeof(beacon_filter_table); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 601 | pBeaconFilterMsg = qdf_mem_malloc(msgSize); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 602 | if (NULL == pBeaconFilterMsg) { |
| 603 | lim_log(pMac, LOGP, |
| 604 | FL("Fail to allocate memory for beaconFiilterMsg ")); |
| 605 | retCode = eSIR_MEM_ALLOC_FAILED; |
| 606 | return retCode; |
| 607 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 608 | qdf_mem_set((uint8_t *) pBeaconFilterMsg, msgSize, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 609 | /* Fill in capability Info and mask */ |
| 610 | /* Don't send this message if no active Infra session is found. */ |
| 611 | pBeaconFilterMsg->capabilityInfo = psessionEntry->limCurrentBssCaps; |
| 612 | pBeaconFilterMsg->capabilityMask = CAPABILITY_FILTER_MASK; |
| 613 | pBeaconFilterMsg->beaconInterval = |
| 614 | (uint16_t) psessionEntry->beaconParams.beaconInterval; |
| 615 | /* Fill in number of IEs in beacon_filter_table */ |
| 616 | pBeaconFilterMsg->ieNum = |
| 617 | (uint16_t) (sizeof(beacon_filter_table) / sizeof(tBeaconFilterIe)); |
| 618 | /* Fill the BSSIDX */ |
| 619 | pBeaconFilterMsg->bssIdx = psessionEntry->bssIdx; |
| 620 | |
| 621 | /* Fill message with info contained in the beacon_filter_table */ |
| 622 | ptr = (uint8_t *) pBeaconFilterMsg + sizeof(tBeaconFilterMsg); |
| 623 | for (i = 0; i < (pBeaconFilterMsg->ieNum); i++) { |
| 624 | pIe = (tpBeaconFilterIe) ptr; |
| 625 | pIe->elementId = beacon_filter_table[i].elementId; |
| 626 | pIe->checkIePresence = beacon_filter_table[i].checkIePresence; |
| 627 | pIe->byte.offset = beacon_filter_table[i].byte.offset; |
| 628 | pIe->byte.value = beacon_filter_table[i].byte.value; |
| 629 | pIe->byte.bitMask = beacon_filter_table[i].byte.bitMask; |
| 630 | pIe->byte.ref = beacon_filter_table[i].byte.ref; |
| 631 | ptr += sizeof(tBeaconFilterIe); |
| 632 | } |
| 633 | msgQ.type = WMA_BEACON_FILTER_IND; |
| 634 | msgQ.reserved = 0; |
| 635 | msgQ.bodyptr = pBeaconFilterMsg; |
| 636 | msgQ.bodyval = 0; |
| 637 | lim_log(pMac, LOG3, FL("Sending WMA_BEACON_FILTER_IND...")); |
| 638 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 639 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 640 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 641 | qdf_mem_free(pBeaconFilterMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 642 | lim_log(pMac, LOGP, |
| 643 | FL("Posting WMA_BEACON_FILTER_IND failed, reason=%X"), |
| 644 | retCode); |
| 645 | return retCode; |
| 646 | } |
| 647 | return retCode; |
| 648 | } |
| 649 | |
| 650 | #ifdef WLAN_FEATURE_11AC |
| 651 | tSirRetStatus lim_send_mode_update(tpAniSirGlobal pMac, |
| 652 | tUpdateVHTOpMode *pTempParam, |
| 653 | tpPESession psessionEntry) |
| 654 | { |
| 655 | tUpdateVHTOpMode *pVhtOpMode = NULL; |
| 656 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 657 | tSirMsgQ msgQ; |
| 658 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 659 | pVhtOpMode = qdf_mem_malloc(sizeof(tUpdateVHTOpMode)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 660 | if (NULL == pVhtOpMode) { |
| 661 | lim_log(pMac, LOGP, |
| 662 | FL("Unable to allocate memory during Update Op Mode")); |
| 663 | return eSIR_MEM_ALLOC_FAILED; |
| 664 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 665 | qdf_mem_copy((uint8_t *) pVhtOpMode, pTempParam, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 666 | sizeof(tUpdateVHTOpMode)); |
| 667 | msgQ.type = WMA_UPDATE_OP_MODE; |
| 668 | msgQ.reserved = 0; |
| 669 | msgQ.bodyptr = pVhtOpMode; |
| 670 | msgQ.bodyval = 0; |
| 671 | lim_log(pMac, LOG3, FL( |
| 672 | "Sending WMA_UPDATE_OP_MODE, op_mode %d, sta_id %d"), |
| 673 | pVhtOpMode->opMode, pVhtOpMode->staId); |
| 674 | if (NULL == psessionEntry) |
| 675 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 676 | else |
| 677 | MTRACE(mac_trace_msg_tx(pMac, |
| 678 | psessionEntry->peSessionId, |
| 679 | msgQ.type)); |
| 680 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 681 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 682 | qdf_mem_free(pVhtOpMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 683 | lim_log(pMac, LOGP, |
| 684 | FL("Posting WMA_UPDATE_OP_MODE failed, reason=%X"), |
| 685 | retCode); |
| 686 | } |
| 687 | |
| 688 | return retCode; |
| 689 | } |
| 690 | |
| 691 | tSirRetStatus lim_send_rx_nss_update(tpAniSirGlobal pMac, |
| 692 | tUpdateRxNss *pTempParam, |
| 693 | tpPESession psessionEntry) |
| 694 | { |
| 695 | tUpdateRxNss *pRxNss = NULL; |
| 696 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 697 | tSirMsgQ msgQ; |
| 698 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 699 | pRxNss = qdf_mem_malloc(sizeof(tUpdateRxNss)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 700 | if (NULL == pRxNss) { |
| 701 | lim_log(pMac, LOGP, |
| 702 | FL("Unable to allocate memory during Update Rx Nss")); |
| 703 | return eSIR_MEM_ALLOC_FAILED; |
| 704 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 705 | qdf_mem_copy((uint8_t *) pRxNss, pTempParam, sizeof(tUpdateRxNss)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 706 | msgQ.type = WMA_UPDATE_RX_NSS; |
| 707 | msgQ.reserved = 0; |
| 708 | msgQ.bodyptr = pRxNss; |
| 709 | msgQ.bodyval = 0; |
| 710 | PELOG3(lim_log(pMac, LOG3, FL("Sending WMA_UPDATE_RX_NSS"));) |
| 711 | if (NULL == psessionEntry) |
| 712 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 713 | else |
| 714 | MTRACE(mac_trace_msg_tx(pMac, |
| 715 | psessionEntry->peSessionId, |
| 716 | msgQ.type)); |
| 717 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 718 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 719 | qdf_mem_free(pRxNss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 720 | lim_log(pMac, LOGP, |
| 721 | FL("Posting WMA_UPDATE_RX_NSS failed, reason=%X"), |
| 722 | retCode); |
| 723 | } |
| 724 | |
| 725 | return retCode; |
| 726 | } |
| 727 | |
| 728 | tSirRetStatus lim_set_membership(tpAniSirGlobal pMac, |
| 729 | tUpdateMembership *pTempParam, |
| 730 | tpPESession psessionEntry) |
| 731 | { |
| 732 | tUpdateMembership *pMembership = NULL; |
| 733 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 734 | tSirMsgQ msgQ; |
| 735 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 736 | pMembership = qdf_mem_malloc(sizeof(tUpdateMembership)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 737 | if (NULL == pMembership) { |
| 738 | lim_log(pMac, LOGP, |
| 739 | FL("Unable to allocate memory during Update Membership Mode")); |
| 740 | return eSIR_MEM_ALLOC_FAILED; |
| 741 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 742 | qdf_mem_copy((uint8_t *) pMembership, pTempParam, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 743 | sizeof(tUpdateMembership)); |
| 744 | |
| 745 | msgQ.type = WMA_UPDATE_MEMBERSHIP; |
| 746 | msgQ.reserved = 0; |
| 747 | msgQ.bodyptr = pMembership; |
| 748 | msgQ.bodyval = 0; |
| 749 | PELOG3(lim_log(pMac, LOG3, FL("Sending WMA_UPDATE_MEMBERSHIP"));) |
| 750 | if (NULL == psessionEntry) |
| 751 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 752 | else |
| 753 | MTRACE(mac_trace_msg_tx(pMac, |
| 754 | psessionEntry->peSessionId, |
| 755 | msgQ.type)); |
| 756 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 757 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 758 | qdf_mem_free(pMembership); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 759 | lim_log(pMac, LOGP, |
| 760 | FL("Posting WMA_UPDATE_MEMBERSHIP failed, reason=%X"), |
| 761 | retCode); |
| 762 | } |
| 763 | |
| 764 | return retCode; |
| 765 | } |
| 766 | |
| 767 | tSirRetStatus lim_set_user_pos(tpAniSirGlobal pMac, |
| 768 | tUpdateUserPos *pTempParam, |
| 769 | tpPESession psessionEntry) |
| 770 | { |
| 771 | tUpdateUserPos *pUserPos = NULL; |
| 772 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 773 | tSirMsgQ msgQ; |
| 774 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 775 | pUserPos = qdf_mem_malloc(sizeof(tUpdateUserPos)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 776 | if (NULL == pUserPos) { |
| 777 | lim_log(pMac, LOGP, |
| 778 | FL("Unable to allocate memory during Update User Position")); |
| 779 | return eSIR_MEM_ALLOC_FAILED; |
| 780 | } |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 781 | qdf_mem_copy((uint8_t *) pUserPos, pTempParam, sizeof(tUpdateUserPos)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 782 | |
| 783 | msgQ.type = WMA_UPDATE_USERPOS; |
| 784 | msgQ.reserved = 0; |
| 785 | msgQ.bodyptr = pUserPos; |
| 786 | msgQ.bodyval = 0; |
| 787 | PELOG3(lim_log(pMac, LOG3, FL("Sending WMA_UPDATE_USERPOS"));) |
| 788 | if (NULL == psessionEntry) |
| 789 | MTRACE(mac_trace_msg_tx(pMac, NO_SESSION, msgQ.type)); |
| 790 | else |
| 791 | MTRACE(mac_trace_msg_tx(pMac, |
| 792 | psessionEntry->peSessionId, |
| 793 | msgQ.type)); |
| 794 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 795 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 796 | qdf_mem_free(pUserPos); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 797 | lim_log(pMac, LOGP, |
| 798 | FL("Posting WMA_UPDATE_USERPOS failed, reason=%X"), |
| 799 | retCode); |
| 800 | } |
| 801 | |
| 802 | return retCode; |
| 803 | } |
| 804 | |
| 805 | #endif |
| 806 | |
| 807 | #ifdef WLAN_FEATURE_11W |
| 808 | /** |
| 809 | * lim_send_exclude_unencrypt_ind() - sends WMA_EXCLUDE_UNENCRYPTED_IND to HAL |
| 810 | * @pMac: mac global context |
| 811 | * @excludeUnenc: true: ignore, false: indicate |
| 812 | * @psessionEntry: session context |
| 813 | * |
| 814 | * LIM sends a message to HAL to indicate whether to ignore or indicate the |
| 815 | * unprotected packet error. |
| 816 | * |
| 817 | * Return: status of operation |
| 818 | */ |
| 819 | tSirRetStatus lim_send_exclude_unencrypt_ind(tpAniSirGlobal pMac, |
| 820 | bool excludeUnenc, |
| 821 | tpPESession psessionEntry) |
| 822 | { |
| 823 | tSirRetStatus retCode = eSIR_SUCCESS; |
| 824 | tSirMsgQ msgQ; |
| 825 | tSirWlanExcludeUnencryptParam *pExcludeUnencryptParam; |
| 826 | |
| 827 | pExcludeUnencryptParam = |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 828 | qdf_mem_malloc(sizeof(tSirWlanExcludeUnencryptParam)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 829 | if (NULL == pExcludeUnencryptParam) { |
| 830 | lim_log(pMac, LOGP, |
| 831 | FL("Unable to allocate memory during lim_send_exclude_unencrypt_ind")); |
| 832 | return eSIR_MEM_ALLOC_FAILED; |
| 833 | } |
| 834 | |
| 835 | pExcludeUnencryptParam->excludeUnencrypt = excludeUnenc; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 836 | qdf_mem_copy(pExcludeUnencryptParam->bssid.bytes, psessionEntry->bssId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 837 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 838 | |
| 839 | msgQ.type = WMA_EXCLUDE_UNENCRYPTED_IND; |
| 840 | msgQ.reserved = 0; |
| 841 | msgQ.bodyptr = pExcludeUnencryptParam; |
| 842 | msgQ.bodyval = 0; |
| 843 | PELOG3(lim_log(pMac, LOG3, FL("Sending WMA_EXCLUDE_UNENCRYPTED_IND"));) |
| 844 | MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); |
| 845 | retCode = wma_post_ctrl_msg(pMac, &msgQ); |
| 846 | if (eSIR_SUCCESS != retCode) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame^] | 847 | qdf_mem_free(pExcludeUnencryptParam); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 848 | lim_log(pMac, LOGP, |
| 849 | FL("Posting WMA_EXCLUDE_UNENCRYPTED_IND failed, reason=%X"), |
| 850 | retCode); |
| 851 | } |
| 852 | |
| 853 | return retCode; |
| 854 | } |
| 855 | #endif |