Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Amruta Kulkarni | 4edc97d | 2019-12-18 16:13:07 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 20 | * This file lim_assoc_utils.cc contains the utility functions |
| 21 | * LIM uses while processing (Re) Association messages. |
| 22 | * Author: Chandra Modumudi |
| 23 | * Date: 02/13/02 |
| 24 | * History:- |
| 25 | * Date Modified by Modification Information |
| 26 | * -------------------------------------------------------------------- |
| 27 | * 05/26/10 js WPA handling in (Re)Assoc frames |
| 28 | * |
| 29 | */ |
| 30 | |
| 31 | #include "cds_api.h" |
| 32 | #include "ani_global.h" |
| 33 | #include "wni_api.h" |
| 34 | #include "sir_common.h" |
| 35 | |
| 36 | #include "wni_cfg.h" |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 37 | #include "cfg_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | |
| 39 | #include "sch_api.h" |
| 40 | #include "utils_api.h" |
| 41 | #include "lim_utils.h" |
| 42 | #include "lim_assoc_utils.h" |
| 43 | #include "lim_security_utils.h" |
| 44 | #include "lim_ser_des_utils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "lim_admit_control.h" |
| 46 | #include "lim_send_messages.h" |
| 47 | #include "lim_ibss_peer_mgmt.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 49 | #include "lim_session.h" |
bings | 1117283 | 2019-05-23 16:41:25 +0800 | [diff] [blame] | 50 | #include "lim_process_fils.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 51 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 52 | #include "qdf_types.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | #include "wma_types.h" |
| 54 | #include "lim_types.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 55 | #include "wlan_utility.h" |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 56 | #include "wlan_mlme_api.h" |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 57 | #include "wma.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 58 | |
Yingying Tang | a1863be | 2017-03-22 18:10:43 +0800 | [diff] [blame] | 59 | #ifdef FEATURE_WLAN_TDLS |
| 60 | #define IS_TDLS_PEER(type) ((type) == STA_ENTRY_TDLS_PEER) |
| 61 | #else |
| 62 | #define IS_TDLS_PEER(type) 0 |
| 63 | #endif |
| 64 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 65 | /** |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 66 | * lim_cmp_ssid() - utility function to compare SSIDs |
| 67 | * @rx_ssid: Received SSID |
| 68 | * @session_entry: Session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 69 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | * This function is called in various places within LIM code |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 71 | * to determine whether received SSID is same as SSID in use. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 72 | * |
Ankit Gupta | d66a881 | 2016-09-15 11:00:16 -0700 | [diff] [blame] | 73 | * Return: zero if SSID matched, non-zero otherwise. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 74 | */ |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 75 | uint32_t lim_cmp_ssid(tSirMacSSid *rx_ssid, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 76 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 77 | return qdf_mem_cmp(rx_ssid, &session_entry->ssId, |
Srinivas Girigowda | cba7473 | 2016-01-14 17:35:25 -0800 | [diff] [blame] | 78 | session_entry->ssId.length); |
| 79 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 80 | |
| 81 | /** |
| 82 | * lim_compare_capabilities() |
| 83 | * |
| 84 | ***FUNCTION: |
| 85 | * This function is called during Association/Reassociation |
| 86 | * frame handling to determine whether received capabilities |
| 87 | * match with local capabilities or not. |
| 88 | * |
| 89 | ***LOGIC: |
| 90 | * |
| 91 | ***ASSUMPTIONS: |
| 92 | * NA |
| 93 | * |
| 94 | ***NOTE: |
| 95 | * NA |
| 96 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 97 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 98 | * @param pAssocReq - Pointer to received Assoc Req frame |
| 99 | * @param pLocalCapabs - Pointer to local capabilities |
| 100 | * |
| 101 | * @return status - true for Capabilitity match else false. |
| 102 | */ |
| 103 | |
| 104 | uint8_t |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 105 | lim_compare_capabilities(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 106 | tSirAssocReq *pAssocReq, |
| 107 | tSirMacCapabilityInfo *pLocalCapabs, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 108 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 109 | { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 110 | if (LIM_IS_AP_ROLE(pe_session) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 111 | (pAssocReq->capabilityInfo.ibss)) { |
| 112 | /* Requesting STA asserting IBSS capability. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 113 | pe_debug("Requesting STA asserting IBSS capability"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 114 | return false; |
| 115 | } |
| 116 | /* Compare CF capabilities */ |
| 117 | if (pAssocReq->capabilityInfo.cfPollable || |
| 118 | pAssocReq->capabilityInfo.cfPollReq) { |
| 119 | /* AP does not support PCF functionality */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 120 | pe_debug(" AP does not support PCF functionality"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | return false; |
| 122 | } |
| 123 | /* Compare short preamble capability */ |
| 124 | if (pAssocReq->capabilityInfo.shortPreamble && |
| 125 | (pAssocReq->capabilityInfo.shortPreamble != |
| 126 | pLocalCapabs->shortPreamble)) { |
| 127 | /* Allowing a STA requesting short preamble while */ |
| 128 | /* AP does not support it */ |
| 129 | } |
| 130 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 131 | pe_debug("QoS in AssocReq: %d, local capabs qos: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 132 | pAssocReq->capabilityInfo.qos, pLocalCapabs->qos); |
| 133 | |
| 134 | /* Compare QoS capability */ |
| 135 | if (pAssocReq->capabilityInfo.qos && |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 136 | (pAssocReq->capabilityInfo.qos != pLocalCapabs->qos)) |
| 137 | pe_debug("Received unmatched QOS but cfg to suppress - continuing"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | |
| 139 | /* |
| 140 | * If AP supports shortSlot and if apple user has |
| 141 | * enforced association only from shortSlot station, |
| 142 | * then AP must reject any station that does not support |
| 143 | * shortSlot |
| 144 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 145 | if (LIM_IS_AP_ROLE(pe_session) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 146 | (pLocalCapabs->shortSlotTime == 1)) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 147 | if (mac->mlme_cfg->feature_flags.accept_short_slot_assoc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | if (pAssocReq->capabilityInfo.shortSlotTime != |
| 149 | pLocalCapabs->shortSlotTime) { |
Jeff Johnson | 33142e6 | 2018-05-06 17:58:36 -0700 | [diff] [blame] | 150 | pe_err("AP rejects association as station doesn't support shortslot time"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 151 | return false; |
| 152 | } |
| 153 | return false; |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | return true; |
| 158 | } /****** end lim_compare_capabilities() ******/ |
| 159 | |
| 160 | /** |
| 161 | * lim_check_rx_basic_rates() |
| 162 | * |
| 163 | ***FUNCTION: |
| 164 | * This function is called during Association/Reassociation |
| 165 | * frame handling to determine whether received rates in |
| 166 | * Assoc/Reassoc request frames include all BSS basic rates |
| 167 | * or not. |
| 168 | * |
| 169 | ***LOGIC: |
| 170 | * |
| 171 | ***ASSUMPTIONS: |
| 172 | * NA |
| 173 | * |
| 174 | ***NOTE: |
| 175 | * NA |
| 176 | * |
| 177 | * @param rxRateSet - pointer to SSID structure |
| 178 | * |
| 179 | * @return status - true if ALL BSS basic rates are present in the |
| 180 | * received rateset else false. |
| 181 | */ |
| 182 | |
| 183 | uint8_t |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 184 | lim_check_rx_basic_rates(struct mac_context *mac, tSirMacRateSet rxRateSet, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 185 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | { |
| 187 | tSirMacRateSet *pRateSet, basicRate; |
| 188 | uint8_t i, j, k, match; |
| 189 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 190 | pRateSet = qdf_mem_malloc(sizeof(tSirMacRateSet)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 191 | if (!pRateSet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 192 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 193 | |
| 194 | /* Copy operational rate set from session Entry */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 195 | qdf_mem_copy(pRateSet->rate, (pe_session->rateSet.rate), |
| 196 | pe_session->rateSet.numRates); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 197 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 198 | pRateSet->numRates = pe_session->rateSet.numRates; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | |
| 200 | /* Extract BSS basic rateset from operational rateset */ |
| 201 | for (i = 0, j = 0; |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 202 | ((i < pRateSet->numRates) && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 203 | if ((pRateSet->rate[i] & 0x80) == 0x80) { |
| 204 | /* msb is set, so this is a basic rate */ |
| 205 | basicRate.rate[j++] = pRateSet->rate[i]; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /* |
| 210 | * For each BSS basic rate, find if it is present in the |
| 211 | * received rateset. |
| 212 | */ |
| 213 | for (k = 0; k < j; k++) { |
| 214 | match = 0; |
| 215 | for (i = 0; |
| 216 | ((i < rxRateSet.numRates) |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 217 | && (i < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 218 | if ((rxRateSet.rate[i] | 0x80) == basicRate.rate[k]) |
| 219 | match = 1; |
| 220 | } |
| 221 | |
| 222 | if (!match) { |
| 223 | /* Free up memory allocated for rateset */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 224 | qdf_mem_free((uint8_t *) pRateSet); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 225 | |
| 226 | return false; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | /* Free up memory allocated for rateset */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 231 | qdf_mem_free((uint8_t *) pRateSet); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | |
| 233 | return true; |
| 234 | } /****** end lim_check_rx_basic_rates() ******/ |
| 235 | |
| 236 | /** |
| 237 | * lim_check_mcs_set() |
| 238 | * |
| 239 | ***FUNCTION: |
| 240 | * This function is called during Association/Reassociation |
| 241 | * frame handling to determine whether received MCS rates in |
| 242 | * Assoc/Reassoc request frames includes all Basic MCS Rate Set or not. |
| 243 | * |
| 244 | ***LOGIC: |
| 245 | * |
| 246 | ***ASSUMPTIONS: |
| 247 | * NA |
| 248 | * |
| 249 | ***NOTE: |
| 250 | * NA |
| 251 | * |
| 252 | * @param supportedMCSSet - pointer to Supported MCS Rate Set |
| 253 | * |
| 254 | * @return status - true if ALL MCS Basic Rate Set rates are present in the |
| 255 | * received rateset else false. |
| 256 | */ |
| 257 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 258 | uint8_t lim_check_mcs_set(struct mac_context *mac, uint8_t *supportedMCSSet) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 259 | { |
| 260 | uint8_t basicMCSSet[SIZE_OF_BASIC_MCS_SET] = { 0 }; |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 261 | qdf_size_t cfg_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 262 | uint8_t i; |
| 263 | uint8_t validBytes; |
| 264 | uint8_t lastByteMCSMask = 0x1f; |
| 265 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 266 | cfg_len = mac->mlme_cfg->rates.basic_mcs_set.len; |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 267 | if (wlan_mlme_get_cfg_str((uint8_t *)basicMCSSet, |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 268 | &mac->mlme_cfg->rates.basic_mcs_set, |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 269 | &cfg_len) != QDF_STATUS_SUCCESS) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 270 | /* / Could not get Basic MCS rateset from CFG. Log error. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 271 | pe_err("could not retrieve Basic MCS rateset"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 272 | return false; |
| 273 | } |
| 274 | |
| 275 | validBytes = VALID_MCS_SIZE / 8; |
| 276 | |
| 277 | /* check if all the Basic MCS Bits are set in supported MCS bitmap */ |
| 278 | for (i = 0; i < validBytes; i++) { |
| 279 | if ((basicMCSSet[i] & supportedMCSSet[i]) != basicMCSSet[i]) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 280 | pe_warn("One of Basic MCS Set Rates is not supported by the Station"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 281 | return false; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | /* check the last 5 bits of the valid MCS bitmap */ |
| 286 | if (((basicMCSSet[i] & lastByteMCSMask) & |
| 287 | (supportedMCSSet[i] & lastByteMCSMask)) != |
| 288 | (basicMCSSet[i] & lastByteMCSMask)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 289 | pe_warn("One of Basic MCS Set Rates is not supported by the Station"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 290 | return false; |
| 291 | } |
| 292 | |
| 293 | return true; |
| 294 | } |
| 295 | |
| 296 | #define SECURITY_SUITE_TYPE_MASK 0xFF |
| 297 | #define SECURITY_SUITE_TYPE_WEP40 0x1 |
| 298 | #define SECURITY_SUITE_TYPE_TKIP 0x2 |
| 299 | #define SECURITY_SUITE_TYPE_CCMP 0x4 |
| 300 | #define SECURITY_SUITE_TYPE_WEP104 0x4 |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 301 | #define SECURITY_SUITE_TYPE_GCMP 0x8 |
| 302 | #define SECURITY_SUITE_TYPE_GCMP_256 0x9 |
| 303 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 304 | /** |
| 305 | * lim_cleanup_rx_path() |
| 306 | * |
| 307 | ***FUNCTION: |
| 308 | * This function is called to cleanup STA state at SP & RFP. |
| 309 | * |
| 310 | ***LOGIC: |
| 311 | * To circumvent RFP's handling of dummy packet when it does not |
| 312 | * have an incomplete packet for the STA to be deleted, a packet |
| 313 | * with 'more framgents' bit set will be queued to RFP's WQ before |
| 314 | * queuing 'dummy packet'. |
| 315 | * A 'dummy' BD is pushed into RFP's WQ with type=00, subtype=1010 |
| 316 | * (Disassociation frame) and routing flags in BD set to eCPU's |
| 317 | * Low Priority WQ. |
| 318 | * RFP cleans up its local context for the STA id mentioned in the |
| 319 | * BD and then pushes BD to eCPU's low priority WQ. |
| 320 | * |
| 321 | ***ASSUMPTIONS: |
| 322 | * NA |
| 323 | * |
| 324 | ***NOTE: |
| 325 | * NA |
| 326 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 327 | * @param mac Pointer to Global MAC structure |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 328 | * @param sta Pointer to the per STA data structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 329 | * initialized by LIM and maintained at DPH |
| 330 | * |
| 331 | * @return None |
| 332 | */ |
| 333 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 334 | QDF_STATUS |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 335 | lim_cleanup_rx_path(struct mac_context *mac, tpDphHashNode sta, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 336 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 337 | { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 338 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 339 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 340 | pe_debug("Cleanup Rx Path for AID: %d" |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 341 | "pe_session->limSmeState: %d, mlmState: %d", |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 342 | sta->assocId, pe_session->limSmeState, |
| 343 | sta->mlmStaContext.mlmState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 345 | pe_session->isCiscoVendorAP = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 346 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 347 | if (mac->lim.gLimAddtsSent) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | MTRACE(mac_trace |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 349 | (mac, TRACE_CODE_TIMER_DEACTIVATE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 350 | pe_session->peSessionId, eLIM_ADDTS_RSP_TIMER)); |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 351 | tx_timer_deactivate(&mac->lim.lim_timers.gLimAddtsRspTimer); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 352 | pe_debug("Reset gLimAddtsSent flag and send addts timeout to SME"); |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 353 | lim_process_sme_addts_rsp_timeout(mac, |
| 354 | mac->lim.gLimAddtsRspTimerCount); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 355 | } |
| 356 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 357 | if (sta->mlmStaContext.mlmState == eLIM_MLM_WT_ASSOC_CNF_STATE) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 358 | lim_deactivate_and_change_per_sta_id_timer(mac, eLIM_CNF_WAIT_TIMER, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 359 | sta->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 360 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 361 | if (!sta->mlmStaContext.updateContext) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | /** |
| 363 | * There is no context at Polaris to delete. |
| 364 | * Release our assigned AID back to the free pool |
| 365 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 366 | if (LIM_IS_AP_ROLE(pe_session)) { |
Sandeep Puligilla | 3277329 | 2020-12-08 21:50:04 -0800 | [diff] [blame] | 367 | lim_del_sta(mac, sta, true, pe_session); |
| 368 | return retCode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | } |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 370 | lim_delete_dph_hash_entry(mac, sta->staAddr, |
| 371 | sta->assocId, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | |
| 373 | return retCode; |
| 374 | } |
| 375 | } |
| 376 | /* delete all tspecs associated with this sta. */ |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 377 | lim_admit_control_delete_sta(mac, sta->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 378 | |
| 379 | /** |
| 380 | * Make STA hash entry invalid at eCPU so that DPH |
| 381 | * does not process any more data packets and |
| 382 | * releases those BDs |
| 383 | */ |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 384 | sta->valid = 0; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 385 | lim_send_sme_tsm_ie_ind(mac, pe_session, 0, 0, 0); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 386 | /* Any roaming related changes should be above this line */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 387 | if (lim_is_roam_synch_in_progress(pe_session)) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 388 | return QDF_STATUS_SUCCESS; |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 389 | sta->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 390 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 391 | if (LIM_IS_STA_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 392 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 393 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 394 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 395 | pe_session->limMlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 396 | /* Deactivating probe after heart beat timer */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 397 | lim_deactivate_and_change_timer(mac, eLIM_PROBE_AFTER_HB_TIMER); |
| 398 | lim_deactivate_and_change_timer(mac, eLIM_JOIN_FAIL_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 399 | } |
| 400 | #ifdef WLAN_DEBUG |
| 401 | /* increment a debug count */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 402 | mac->lim.gLimNumRxCleanup++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 403 | #endif |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 404 | /* Do DEL BSS or DEL STA only if ADD BSS was success */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 405 | if (!pe_session->add_bss_failed) { |
| 406 | if (pe_session->limSmeState == eLIM_SME_JOIN_FAILURE_STATE) { |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 407 | retCode = |
Abhishek Singh | c70afa3 | 2019-09-19 15:17:21 +0530 | [diff] [blame] | 408 | lim_del_bss(mac, sta, pe_session->vdev_id, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 409 | pe_session); |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 410 | } else |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 411 | retCode = lim_del_sta(mac, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 412 | sta, true, pe_session); |
Abhishek Singh | 96bda8e | 2015-12-03 16:45:35 +0530 | [diff] [blame] | 413 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 414 | |
| 415 | return retCode; |
| 416 | |
| 417 | } /*** end lim_cleanup_rx_path() ***/ |
| 418 | |
| 419 | /** |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 420 | * lim_send_del_sta_cnf() - Send Del sta confirmation |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 421 | * @mac: Pointer to Global MAC structure |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 422 | * @sta_dsaddr: sta ds address |
| 423 | * @staDsAssocId: sta ds association id |
| 424 | * @mlmStaContext: MLM station context |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 425 | * @status_code: Status code |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 426 | * @pe_session: Session entry |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | * |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 428 | * This function is called to send appropriate CNF message to SME. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 429 | * |
Srinivas Girigowda | 9efa10e | 2016-01-04 18:49:40 -0800 | [diff] [blame] | 430 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 431 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 432 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 433 | lim_send_del_sta_cnf(struct mac_context *mac, struct qdf_mac_addr sta_dsaddr, |
Pragaspathi Thilagaraj | b3d5253 | 2019-06-22 22:37:55 +0530 | [diff] [blame] | 434 | uint16_t staDsAssocId, |
| 435 | struct lim_sta_context mlmStaContext, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 436 | tSirResultCodes status_code, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 437 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 438 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 439 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 440 | tLimMlmPurgeStaInd mlmPurgeStaInd; |
| 441 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 442 | pe_debug("Sessionid: %d staDsAssocId: %d Trigger: %d status_code: %d sta_dsaddr: "QDF_MAC_ADDR_FMT, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 443 | pe_session->peSessionId, staDsAssocId, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 444 | mlmStaContext.cleanupTrigger, status_code, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 445 | QDF_MAC_ADDR_REF(sta_dsaddr.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 446 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 447 | if (LIM_IS_STA_ROLE(pe_session)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | /* Set BSSID at CFG to null */ |
| 449 | tSirMacAddr nullAddr = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 450 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 451 | sir_copy_mac_addr(nullAddr, pe_session->bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 452 | |
| 453 | /* Free up buffer allocated for JoinReq held by */ |
| 454 | /* MLM state machine */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 455 | if (pe_session->pLimMlmJoinReq) { |
| 456 | qdf_mem_free(pe_session->pLimMlmJoinReq); |
| 457 | pe_session->pLimMlmJoinReq = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 458 | } |
| 459 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 460 | pe_session->limAID = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | if ((mlmStaContext.cleanupTrigger == |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 464 | eLIM_HOST_DISASSOC) || |
| 465 | (mlmStaContext.cleanupTrigger == |
| 466 | eLIM_LINK_MONITORING_DISASSOC) || |
| 467 | (mlmStaContext.cleanupTrigger == |
| 468 | eLIM_PROMISCUOUS_MODE_DISASSOC)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 469 | qdf_mem_copy((uint8_t *) &mlmDisassocCnf.peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 470 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 471 | mlmDisassocCnf.resultCode = status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 472 | mlmDisassocCnf.disassocTrigger = mlmStaContext.cleanupTrigger; |
| 473 | /* Update PE session Id */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 474 | mlmDisassocCnf.sessionId = pe_session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 475 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 476 | lim_post_sme_message(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 477 | LIM_MLM_DISASSOC_CNF, |
| 478 | (uint32_t *) &mlmDisassocCnf); |
| 479 | } else if ((mlmStaContext.cleanupTrigger == |
Edhar, Mahesh Kumar | e3c8d35 | 2015-11-16 12:03:45 +0530 | [diff] [blame] | 480 | eLIM_HOST_DEAUTH) || |
| 481 | (mlmStaContext.cleanupTrigger == |
| 482 | eLIM_LINK_MONITORING_DEAUTH)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 483 | qdf_copy_macaddr(&mlmDeauthCnf.peer_macaddr, &sta_dsaddr); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 484 | mlmDeauthCnf.resultCode = status_code; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 485 | mlmDeauthCnf.deauthTrigger = mlmStaContext.cleanupTrigger; |
| 486 | /* PE session Id */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 487 | mlmDeauthCnf.sessionId = pe_session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 488 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 489 | lim_post_sme_message(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 490 | LIM_MLM_DEAUTH_CNF, |
| 491 | (uint32_t *) &mlmDeauthCnf); |
| 492 | } else if ((mlmStaContext.cleanupTrigger == |
| 493 | eLIM_PEER_ENTITY_DISASSOC) || |
| 494 | (mlmStaContext.cleanupTrigger == eLIM_PEER_ENTITY_DEAUTH)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 495 | qdf_mem_copy((uint8_t *) &mlmPurgeStaInd.peerMacAddr, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 496 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 497 | mlmPurgeStaInd.reasonCode = |
| 498 | (uint8_t) mlmStaContext.disassocReason; |
| 499 | mlmPurgeStaInd.aid = staDsAssocId; |
| 500 | mlmPurgeStaInd.purgeTrigger = mlmStaContext.cleanupTrigger; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 501 | mlmPurgeStaInd.sessionId = pe_session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 502 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 503 | lim_post_sme_message(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 504 | LIM_MLM_PURGE_STA_IND, |
| 505 | (uint32_t *) &mlmPurgeStaInd); |
| 506 | } else if (mlmStaContext.cleanupTrigger == eLIM_JOIN_FAILURE) { |
| 507 | /* PE setup the peer entry in HW upfront, right after join is completed. */ |
| 508 | /* If there is a failure during rest of the assoc sequence, this context needs to be cleaned up. */ |
| 509 | uint8_t smesessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 510 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 511 | smesessionId = pe_session->smeSessionId; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 512 | pe_session->limSmeState = eLIM_SME_JOIN_FAILURE_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 513 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 514 | (mac, TRACE_CODE_SME_STATE, pe_session->peSessionId, |
| 515 | pe_session->limSmeState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 516 | |
| 517 | /* if it is a reassoc failure to join new AP */ |
| 518 | if ((mlmStaContext.resultCode == |
| 519 | eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE) |
| 520 | || (mlmStaContext.resultCode == eSIR_SME_FT_REASSOC_FAILURE) |
| 521 | || (mlmStaContext.resultCode == |
| 522 | eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 523 | pe_debug("Lim Posting eWNI_SME_REASSOC_RSP to SME" |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 524 | "resultCode: %d, status_code: %d," |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 525 | "sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 526 | mlmStaContext.resultCode, |
| 527 | mlmStaContext.protStatusCode, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 528 | pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 529 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 530 | lim_send_sme_join_reassoc_rsp(mac, eWNI_SME_REASSOC_RSP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 531 | mlmStaContext.resultCode, |
| 532 | mlmStaContext.protStatusCode, |
Jeff Johnson | 27b9896 | 2019-02-20 20:53:08 -0800 | [diff] [blame] | 533 | pe_session, smesessionId); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 534 | if (mlmStaContext.resultCode != eSIR_SME_SUCCESS) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 535 | pe_delete_session(mac, pe_session); |
| 536 | pe_session = NULL; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 537 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 538 | } else { |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 539 | qdf_mem_free(pe_session->lim_join_req); |
| 540 | pe_session->lim_join_req = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 541 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 542 | pe_debug("Lim Posting eWNI_SME_JOIN_RSP to SME." |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 543 | "resultCode: %d,status_code: %d," |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 544 | "sessionId: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 545 | mlmStaContext.resultCode, |
| 546 | mlmStaContext.protStatusCode, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 547 | pe_session->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 548 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 549 | lim_send_sme_join_reassoc_rsp(mac, eWNI_SME_JOIN_RSP, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 550 | mlmStaContext.resultCode, |
| 551 | mlmStaContext.protStatusCode, |
Jeff Johnson | 27b9896 | 2019-02-20 20:53:08 -0800 | [diff] [blame] | 552 | pe_session, smesessionId); |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 553 | |
| 554 | if (mlmStaContext.resultCode != eSIR_SME_SUCCESS) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 555 | pe_delete_session(mac, pe_session); |
| 556 | pe_session = NULL; |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 557 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 558 | } |
| 559 | |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 560 | } else if (mlmStaContext.cleanupTrigger == eLIM_DUPLICATE_ENTRY) { |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 561 | |
| 562 | qdf_mem_copy((uint8_t *) &mlmDisassocCnf.peerMacAddr, |
| 563 | (uint8_t *) sta_dsaddr.bytes, QDF_MAC_ADDR_SIZE); |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 564 | mlmDisassocCnf.resultCode = status_code; |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 565 | mlmDisassocCnf.disassocTrigger = eLIM_DUPLICATE_ENTRY; |
| 566 | /* Update PE session Id */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 567 | mlmDisassocCnf.sessionId = pe_session->peSessionId; |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 568 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 569 | lim_post_sme_message(mac, |
Sandeep Puligilla | 7e3e3c5 | 2016-09-02 17:54:21 -0700 | [diff] [blame] | 570 | LIM_MLM_DISASSOC_CNF, |
| 571 | (uint32_t *) &mlmDisassocCnf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 572 | } |
| 573 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 574 | if (pe_session && !LIM_IS_AP_ROLE(pe_session)) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 575 | pe_delete_session(mac, pe_session); |
| 576 | pe_session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 577 | } |
| 578 | } |
| 579 | |
| 580 | /** |
| 581 | * lim_reject_association() - function to reject Re/Association Request |
| 582 | * |
| 583 | * @mac_ctx: pointer to global mac structure |
| 584 | * @peer_addr: mac address of the peer |
| 585 | * @sub_type: Indicates whether it is Association Request (=0) or |
| 586 | * Reassociation Request (=1) frame |
| 587 | * @add_pre_auth_context:Indicates whether pre-auth context |
| 588 | * to be added for this STA |
| 589 | * @auth_type: Indicates auth type to be added |
| 590 | * @sta_id: Indicates staId of the STA being rejected |
| 591 | * association |
| 592 | * @delete_sta: Indicates whether to delete STA context |
| 593 | * at Polaris |
| 594 | * @result_code: Indicates what reasonCode to be sent in |
| 595 | * Re/Assoc response to STA |
| 596 | * @session_entry: pointer to PE session |
| 597 | * |
| 598 | * This function is called whenever Re/Association Request need |
| 599 | * to be rejected due to failure in assigning an AID or failure |
| 600 | * in adding STA context at Polaris or reject by applications. |
| 601 | * Resources allocated if any are freedup and (Re) Association |
| 602 | * Response frame is sent to requesting STA. Pre-Auth context |
| 603 | * will be added for this STA if it does not exist already |
| 604 | * |
| 605 | * Return: none |
| 606 | */ |
| 607 | |
| 608 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 609 | lim_reject_association(struct mac_context *mac_ctx, tSirMacAddr peer_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 610 | uint8_t sub_type, uint8_t add_pre_auth_context, |
| 611 | tAniAuthType auth_type, uint16_t sta_id, |
Pragaspathi Thilagaraj | cb58bbc | 2019-05-23 15:34:51 +0530 | [diff] [blame] | 612 | uint8_t delete_sta, enum mac_status_code result_code, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 613 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 614 | { |
| 615 | tpDphHashNode sta_ds; |
| 616 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 617 | pe_debug("Sessionid: %d auth_type: %d sub_type: %d add_pre_auth_context: %d sta_id: %d delete_sta: %d result_code : %d peer_addr: " QDF_MAC_ADDR_FMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 618 | session_entry->peSessionId, auth_type, sub_type, |
| 619 | add_pre_auth_context, sta_id, delete_sta, result_code, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 620 | QDF_MAC_ADDR_REF(peer_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 621 | |
| 622 | if (add_pre_auth_context) { |
| 623 | /* Create entry for this STA in pre-auth list */ |
| 624 | struct tLimPreAuthNode *auth_node; |
| 625 | |
| 626 | auth_node = lim_acquire_free_pre_auth_node(mac_ctx, |
| 627 | &mac_ctx->lim.gLimPreAuthTimerTable); |
| 628 | |
| 629 | if (auth_node) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 630 | qdf_mem_copy((uint8_t *) auth_node->peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 631 | peer_addr, sizeof(tSirMacAddr)); |
| 632 | auth_node->fTimerStarted = 0; |
| 633 | auth_node->mlmState = eLIM_MLM_AUTHENTICATED_STATE; |
| 634 | auth_node->authType = (tAniAuthType) auth_type; |
Anurag Chouhan | 210db07 | 2016-02-22 18:42:15 +0530 | [diff] [blame] | 635 | auth_node->timestamp = qdf_mc_timer_get_system_ticks(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 636 | lim_add_pre_auth_node(mac_ctx, auth_node); |
| 637 | } |
| 638 | } |
| 639 | |
| 640 | if (delete_sta == false) { |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 641 | lim_send_assoc_rsp_mgmt_frame( |
| 642 | mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 643 | eSIR_MAC_MAX_ASSOC_STA_REACHED_STATUS, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 644 | 1, peer_addr, sub_type, 0, session_entry, |
| 645 | false); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 646 | pe_warn("received Re/Assoc req when max associated STAs reached from"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | lim_print_mac_addr(mac_ctx, peer_addr, LOGW); |
| 648 | lim_send_sme_max_assoc_exceeded_ntf(mac_ctx, peer_addr, |
| 649 | session_entry->smeSessionId); |
| 650 | return; |
| 651 | } |
| 652 | |
| 653 | sta_ds = dph_get_hash_entry(mac_ctx, sta_id, |
| 654 | &session_entry->dph.dphHashTable); |
| 655 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 656 | if (!sta_ds) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 657 | pe_err("No STA context, yet rejecting Association"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 658 | return; |
| 659 | } |
| 660 | |
| 661 | /* |
| 662 | * Polaris has state for this STA. |
| 663 | * Trigger cleanup. |
| 664 | */ |
| 665 | sta_ds->mlmStaContext.cleanupTrigger = eLIM_REASSOC_REJECT; |
| 666 | |
| 667 | /* Receive path cleanup */ |
| 668 | lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry); |
| 669 | |
| 670 | /* |
| 671 | * Send Re/Association Response with |
| 672 | * status code to requesting STA. |
| 673 | */ |
| 674 | lim_send_assoc_rsp_mgmt_frame(mac_ctx, result_code, 0, peer_addr, |
bings | 8551233 | 2019-09-04 17:46:37 +0800 | [diff] [blame] | 675 | sub_type, 0, session_entry, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 676 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 677 | if (session_entry->parsedAssocReq[sta_ds->assocId]) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 678 | uint8_t *assoc_req_frame; |
| 679 | |
| 680 | assoc_req_frame = (uint8_t *)((tpSirAssocReq) (session_entry-> |
| 681 | parsedAssocReq[sta_ds->assocId]))->assocReqFrame; |
| 682 | /* |
| 683 | *Assoction confirmation is complete, |
| 684 | *free the copy of association request frame. |
| 685 | */ |
| 686 | if (assoc_req_frame) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 687 | qdf_mem_free(assoc_req_frame); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 688 | assoc_req_frame = NULL; |
| 689 | } |
| 690 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 691 | qdf_mem_free(session_entry->parsedAssocReq[sta_ds->assocId]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 692 | session_entry->parsedAssocReq[sta_ds->assocId] = NULL; |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | /** |
| 697 | * lim_decide_ap_protection_on_ht20_delete() - function to update protection |
| 698 | * parameters. |
| 699 | * @mac_ctx: pointer to global mac structure |
| 700 | * @sta_ds: station node |
| 701 | * @beacon_params: ap beacon parameters |
| 702 | * @session_entry: pe session entry |
| 703 | * |
| 704 | * protection related function while HT20 station is getting deleted. |
| 705 | * |
| 706 | * Return: none |
| 707 | */ |
| 708 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 709 | lim_decide_ap_protection_on_ht20_delete(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 710 | tpDphHashNode sta_ds, |
| 711 | tpUpdateBeaconParams beacon_params, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 712 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 713 | { |
| 714 | uint32_t i = 0; |
| 715 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 716 | pe_debug("(%d) A HT 20 STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 717 | session_entry->gLimHt20Params.numSta, |
| 718 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 719 | |
| 720 | if (session_entry->gLimHt20Params.numSta > 0) { |
| 721 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 722 | if (!session_entry->protStaCache[i].active) |
| 723 | continue; |
| 724 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 725 | if (!qdf_mem_cmp(session_entry->protStaCache[i].addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 726 | sta_ds->staAddr, sizeof(tSirMacAddr))) { |
| 727 | session_entry->gLimHt20Params.numSta--; |
| 728 | session_entry->protStaCache[i].active = |
| 729 | false; |
| 730 | break; |
| 731 | } |
| 732 | } |
| 733 | } |
| 734 | |
| 735 | if (session_entry->gLimHt20Params.numSta == 0) { |
| 736 | /* disable protection */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 737 | pe_debug("No 11B STA exists, PESessionID %d", |
| 738 | session_entry->peSessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 739 | lim_enable_ht20_protection(mac_ctx, false, false, beacon_params, |
| 740 | session_entry); |
| 741 | } |
| 742 | } |
| 743 | |
| 744 | /** |
| 745 | * lim_decide_ap_protection_on_delete() - update SAP protection on station |
| 746 | * deletion. |
| 747 | * @mac_ctx: pointer to global mac structure |
| 748 | * @sta_ds: station node |
| 749 | * @beacon_params: ap beacon parameters |
| 750 | * @session_entry: pe session entry |
| 751 | * |
| 752 | * Decides about protection related settings when a station is getting deleted. |
| 753 | * |
| 754 | * Return: none |
| 755 | */ |
| 756 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 757 | lim_decide_ap_protection_on_delete(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 758 | tpDphHashNode sta_ds, |
| 759 | tpUpdateBeaconParams beacon_params, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 760 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 761 | { |
| 762 | uint32_t phy_mode; |
| 763 | tHalBitVal erp_enabled = eHAL_CLEAR; |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 764 | enum reg_wifi_band rf_band = REG_BAND_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 765 | uint32_t i; |
| 766 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 767 | if (!sta_ds) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 768 | return; |
| 769 | |
| 770 | lim_get_rf_band_new(mac_ctx, &rf_band, session_entry); |
| 771 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 772 | erp_enabled = sta_ds->erpEnabled; |
| 773 | |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 774 | if ((REG_BAND_5G == rf_band) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 775 | (true == session_entry->htCapability) && |
| 776 | (session_entry->beaconParams.llaCoexist) && |
| 777 | (false == sta_ds->mlmStaContext.htCapability)) { |
| 778 | /* |
| 779 | * we are HT. if we are 11A, then protection is not required or |
| 780 | * we are HT and 11A station is leaving. |
| 781 | * protection consideration required. |
| 782 | * HT station leaving ==> this case is commonly handled |
| 783 | * between both the bands below. |
| 784 | */ |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 785 | pe_debug("(%d) A 11A STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 786 | session_entry->gLim11aParams.numSta, |
| 787 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 788 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 789 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 790 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 791 | session_entry->protStaCache[i].addr, |
| 792 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 793 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 794 | session_entry->protStaCache[i].active = false; |
| 795 | break; |
| 796 | } |
| 797 | } |
| 798 | |
| 799 | if (session_entry->gLim11aParams.numSta == 0) { |
| 800 | /* disable protection */ |
| 801 | lim_update_11a_protection(mac_ctx, false, false, |
| 802 | beacon_params, session_entry); |
| 803 | } |
| 804 | } |
| 805 | |
| 806 | /* we are HT or 11G and 11B station is getting deleted */ |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 807 | if ((REG_BAND_2G == rf_band) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 808 | (phy_mode == WNI_CFG_PHY_MODE_11G || |
| 809 | session_entry->htCapability) && |
| 810 | (erp_enabled == eHAL_CLEAR)) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 811 | pe_debug("(%d) A legacy STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 812 | session_entry->gLim11bParams.numSta, |
| 813 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 814 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 815 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 816 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 817 | session_entry->protStaCache[i].addr, |
| 818 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 819 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 820 | session_entry->gLim11bParams.numSta--; |
| 821 | session_entry->protStaCache[i].active = |
| 822 | false; |
| 823 | break; |
| 824 | } |
| 825 | } |
| 826 | |
| 827 | if (session_entry->gLim11bParams.numSta == 0) { |
| 828 | /* disable protection */ |
| 829 | lim_enable11g_protection(mac_ctx, false, false, |
| 830 | beacon_params, session_entry); |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | /* |
| 835 | * we are HT AP and non-11B station is leaving. |
| 836 | * 11g station is leaving |
| 837 | */ |
Amruta Kulkarni | 453c4e2 | 2019-11-20 10:59:21 -0800 | [diff] [blame] | 838 | if ((REG_BAND_2G == rf_band) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 839 | session_entry->htCapability && |
| 840 | !sta_ds->mlmStaContext.htCapability) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 841 | pe_debug("(%d) A 11g STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 842 | session_entry->gLim11bParams.numSta, |
| 843 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 844 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 845 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 846 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | session_entry->protStaCache[i].addr, |
| 848 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 849 | sizeof(tSirMacAddr)))) { |
Srinivas Girigowda | eff16d9 | 2018-09-12 14:56:29 -0700 | [diff] [blame] | 850 | session_entry->gLim11gParams.numSta--; |
| 851 | session_entry->protStaCache[i].active = false; |
| 852 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | } |
| 854 | } |
| 855 | |
| 856 | if (session_entry->gLim11gParams.numSta == 0) { |
| 857 | /* disable protection */ |
| 858 | lim_enable_ht_protection_from11g(mac_ctx, false, false, |
| 859 | beacon_params, |
| 860 | session_entry); |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | if (!((true == session_entry->htCapability) && |
| 865 | (true == sta_ds->mlmStaContext.htCapability))) |
| 866 | return; |
| 867 | |
| 868 | /* |
| 869 | * Applies to 2.4 as well as 5 GHZ. |
| 870 | * HT non-GF leaving |
| 871 | */ |
| 872 | if (!sta_ds->htGreenfield) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 873 | pe_debug("(%d) A non-GF STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 874 | session_entry->gLimNonGfParams.numSta, |
| 875 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 876 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 877 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 878 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 879 | session_entry->protStaCache[i].addr, |
| 880 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 881 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | session_entry->protStaCache[i].active = false; |
| 883 | break; |
| 884 | } |
| 885 | } |
| 886 | |
| 887 | if (session_entry->gLimNonGfParams.numSta == 0) { |
| 888 | /* disable protection */ |
| 889 | lim_enable_ht_non_gf_protection(mac_ctx, false, false, |
| 890 | beacon_params, session_entry); |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | /* |
| 895 | * Applies to 2.4 as well as 5 GHZ. |
| 896 | * HT 20Mhz station leaving |
| 897 | */ |
| 898 | if (session_entry->beaconParams.ht20Coexist && |
| 899 | (eHT_CHANNEL_WIDTH_20MHZ == |
| 900 | sta_ds->htSupportedChannelWidthSet)) { |
| 901 | lim_decide_ap_protection_on_ht20_delete(mac_ctx, sta_ds, |
| 902 | beacon_params, session_entry); |
| 903 | } |
| 904 | |
| 905 | /* |
| 906 | * Applies to 2.4 as well as 5 GHZ. |
| 907 | * LSIG TXOP not supporting staiton leaving |
| 908 | */ |
| 909 | if ((false == session_entry->beaconParams. |
| 910 | fLsigTXOPProtectionFullSupport) && |
| 911 | (false == sta_ds->htLsigTXOPProtection)) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 912 | pe_debug("(%d) A HT LSIG not supporting STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | session_entry->gLimLsigTxopParams.numSta, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 914 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 915 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 916 | if (session_entry->protStaCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 917 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 918 | session_entry->protStaCache[i].addr, |
| 919 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 920 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | session_entry->protStaCache[i].active = false; |
| 922 | break; |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | if (session_entry->gLimLsigTxopParams.numSta == 0) { |
| 927 | /* disable protection */ |
| 928 | lim_enable_ht_lsig_txop_protection(mac_ctx, true, |
| 929 | false, beacon_params, session_entry); |
| 930 | } |
| 931 | } |
| 932 | } |
| 933 | |
| 934 | /** |
| 935 | * lim_decide_short_preamble() - update short preamble parameters |
| 936 | * @mac_ctx: pointer to global mac structure |
| 937 | * @sta_ds: station node |
| 938 | * @beacon_params: ap beacon parameters |
| 939 | * @session_entry: pe session entry |
| 940 | * |
| 941 | * Decides about any short preamble related change because of new station |
| 942 | * joining. |
| 943 | * |
| 944 | * Return: None |
| 945 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 946 | static void lim_decide_short_preamble(struct mac_context *mac_ctx, |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 947 | tpDphHashNode sta_ds, |
| 948 | tpUpdateBeaconParams beacon_params, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 949 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 950 | { |
| 951 | uint32_t i; |
| 952 | |
| 953 | if (sta_ds->shortPreambleEnabled == eHAL_CLEAR) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 954 | pe_debug("(%d) A non-short preamble STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
| 955 | session_entry->gLimNoShortParams.numNonShortPreambleSta, |
| 956 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 957 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 958 | if (session_entry->gLimNoShortParams. |
| 959 | staNoShortCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 960 | (!qdf_mem_cmp(session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | gLimNoShortParams. |
| 962 | staNoShortCache[i].addr, |
| 963 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 964 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | session_entry->gLimNoShortParams. |
| 966 | numNonShortPreambleSta--; |
| 967 | session_entry->gLimNoShortParams. |
| 968 | staNoShortCache[i].active = false; |
| 969 | break; |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | if (session_entry->gLimNoShortParams.numNonShortPreambleSta) |
| 974 | return; |
| 975 | |
| 976 | /* |
| 977 | * enable short preamble |
| 978 | * reset the cache |
| 979 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 980 | qdf_mem_zero((uint8_t *) &session_entry->gLimNoShortParams, |
| 981 | sizeof(tLimNoShortParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | if (lim_enable_short_preamble(mac_ctx, true, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 983 | beacon_params, session_entry) != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 984 | pe_err("Cannot enable short preamble"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 985 | } |
| 986 | } |
| 987 | |
| 988 | /** |
| 989 | * lim_decide_short_slot() - update short slot time related parameters |
| 990 | * @mac_ctx: pointer to global mac structure |
| 991 | * @sta_ds: station node |
| 992 | * @beacon_params: ap beacon parameters |
| 993 | * @session_entry: pe session entry |
| 994 | * |
| 995 | * Decides about any short slot time related change because of station leaving |
| 996 | * the BSS. |
| 997 | * Return: None |
| 998 | */ |
Jeff Johnson | 72c8e7c | 2016-10-06 18:43:52 -0700 | [diff] [blame] | 999 | static void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1000 | lim_decide_short_slot(struct mac_context *mac_ctx, tpDphHashNode sta_ds, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1001 | tpUpdateBeaconParams beacon_params, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 1002 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | { |
| 1004 | uint32_t i, val, non_short_slot_sta_count; |
| 1005 | |
| 1006 | if (sta_ds->shortSlotTimeEnabled != eHAL_CLEAR) |
| 1007 | return; |
| 1008 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1009 | pe_debug("(%d) A non-short slottime STA is disassociated. Addr is "QDF_MAC_ADDR_FMT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1010 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 1011 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1012 | |
gaurank kathpalia | e5a17e4 | 2018-09-10 10:05:25 +0530 | [diff] [blame] | 1013 | val = mac_ctx->mlme_cfg->feature_flags.enable_short_slot_time_11g; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | |
| 1015 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 1016 | non_short_slot_sta_count = |
| 1017 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta; |
| 1018 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1019 | if (session_entry->gLimNoShortSlotParams. |
| 1020 | staNoShortSlotCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1021 | (!qdf_mem_cmp(session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1022 | gLimNoShortSlotParams. |
| 1023 | staNoShortSlotCache[i].addr, |
| 1024 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1025 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | non_short_slot_sta_count--; |
| 1027 | session_entry->gLimNoShortSlotParams. |
| 1028 | staNoShortSlotCache[i].active = false; |
| 1029 | break; |
| 1030 | } |
| 1031 | } |
| 1032 | |
| 1033 | if (non_short_slot_sta_count == 0 && val) { |
| 1034 | /* |
| 1035 | * enable short slot time |
| 1036 | * reset the cache |
| 1037 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1038 | qdf_mem_zero((uint8_t *) &session_entry-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | gLimNoShortSlotParams, |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1040 | sizeof(tLimNoShortSlotParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | beacon_params->fShortSlotTime = true; |
| 1042 | beacon_params->paramChangeBitmap |= |
| 1043 | PARAM_SHORT_SLOT_TIME_CHANGED; |
| 1044 | session_entry->shortSlotTimeSupported = true; |
| 1045 | } |
| 1046 | session_entry->gLimNoShortSlotParams.numNonShortSlotSta = |
| 1047 | non_short_slot_sta_count; |
| 1048 | } else { |
| 1049 | non_short_slot_sta_count = |
| 1050 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta; |
| 1051 | for (i = 0; i < LIM_PROT_STA_CACHE_SIZE; i++) { |
| 1052 | if (mac_ctx->lim.gLimNoShortSlotParams. |
| 1053 | staNoShortSlotCache[i].active && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1054 | (!qdf_mem_cmp( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1056 | staNoShortSlotCache[i].addr, |
| 1057 | sta_ds->staAddr, |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1058 | sizeof(tSirMacAddr)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | non_short_slot_sta_count--; |
| 1060 | mac_ctx->lim.gLimNoShortSlotParams. |
| 1061 | staNoShortSlotCache[i].active = false; |
| 1062 | break; |
| 1063 | } |
| 1064 | } |
| 1065 | |
| 1066 | if (val && !non_short_slot_sta_count) { |
| 1067 | /* |
| 1068 | * enable short slot time |
| 1069 | * reset the cache |
| 1070 | */ |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1071 | qdf_mem_zero( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | (uint8_t *) &mac_ctx->lim.gLimNoShortSlotParams, |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 1073 | sizeof(tLimNoShortSlotParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | /*in case of AP set SHORT_SLOT_TIME to enable*/ |
| 1075 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 1076 | beacon_params->fShortSlotTime = true; |
| 1077 | beacon_params->paramChangeBitmap |= |
| 1078 | PARAM_SHORT_SLOT_TIME_CHANGED; |
| 1079 | session_entry->shortSlotTimeSupported = true; |
| 1080 | } |
| 1081 | } |
| 1082 | mac_ctx->lim.gLimNoShortSlotParams.numNonShortSlotSta = |
| 1083 | non_short_slot_sta_count; |
| 1084 | } |
| 1085 | } |
| 1086 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1087 | static uint8_t lim_get_nss_from_vht_mcs_map(uint16_t mcs_map) |
| 1088 | { |
| 1089 | uint8_t nss = 0; |
| 1090 | uint16_t mcs_mask = 0x3; |
| 1091 | |
| 1092 | for (nss = 0; nss < VHT_MAX_NSS; nss++) { |
| 1093 | if ((mcs_map & mcs_mask) == mcs_mask) |
| 1094 | return nss; |
| 1095 | |
| 1096 | mcs_mask = (mcs_mask << 2); |
| 1097 | } |
| 1098 | |
| 1099 | return nss; |
| 1100 | } |
| 1101 | |
| 1102 | static void lim_get_vht_gt80_nss(struct mac_context *mac_ctx, |
| 1103 | struct sDphHashNode *sta_ds, |
| 1104 | tDot11fIEVHTCaps *vht_caps, |
| 1105 | struct pe_session *session) |
| 1106 | { |
| 1107 | uint8_t nss; |
| 1108 | |
| 1109 | if (!vht_caps->vht_extended_nss_bw_cap) { |
| 1110 | sta_ds->vht_160mhz_nss = 0; |
| 1111 | sta_ds->vht_80p80mhz_nss = 0; |
| 1112 | pe_debug("peer does not support vht extnd nss bw"); |
| 1113 | |
| 1114 | return; |
| 1115 | } |
| 1116 | |
| 1117 | nss = lim_get_nss_from_vht_mcs_map(vht_caps->rxMCSMap); |
| 1118 | |
| 1119 | if (!nss) { |
| 1120 | pe_debug("Invalid peer VHT MCS map %0X", vht_caps->rxMCSMap); |
| 1121 | nss = 1; |
| 1122 | } |
| 1123 | |
| 1124 | switch (vht_caps->supportedChannelWidthSet) { |
| 1125 | case VHT_CAP_NO_160M_SUPP: |
| 1126 | if (vht_caps->extended_nss_bw_supp == |
| 1127 | VHT_EXTD_NSS_80_HALF_NSS_160) { |
| 1128 | sta_ds->vht_160mhz_nss = nss / 2; |
| 1129 | sta_ds->vht_80p80mhz_nss = 0; |
| 1130 | } else if (vht_caps->extended_nss_bw_supp == |
| 1131 | VHT_EXTD_NSS_80_HALF_NSS_80P80) { |
| 1132 | sta_ds->vht_160mhz_nss = nss / 2; |
| 1133 | sta_ds->vht_80p80mhz_nss = nss / 2; |
| 1134 | } else if (vht_caps->extended_nss_bw_supp == |
| 1135 | VHT_EXTD_NSS_80_3QUART_NSS_80P80) { |
| 1136 | sta_ds->vht_160mhz_nss = (nss * 3) / 4; |
| 1137 | sta_ds->vht_80p80mhz_nss = (nss * 3) / 4; |
| 1138 | } else { |
| 1139 | sta_ds->vht_160mhz_nss = 0; |
| 1140 | sta_ds->vht_80p80mhz_nss = 0; |
| 1141 | } |
| 1142 | break; |
| 1143 | case VHT_CAP_160_SUPP: |
| 1144 | sta_ds->vht_160mhz_nss = nss; |
| 1145 | if (vht_caps->extended_nss_bw_supp == |
| 1146 | VHT_EXTD_NSS_160_HALF_NSS_80P80) { |
| 1147 | sta_ds->vht_80p80mhz_nss = nss / 2; |
| 1148 | } else if (vht_caps->extended_nss_bw_supp == |
| 1149 | VHT_EXTD_NSS_160_3QUART_NSS_80P80) { |
| 1150 | sta_ds->vht_80p80mhz_nss = (nss * 3) / 4; |
| 1151 | } else if (vht_caps->extended_nss_bw_supp == |
| 1152 | VHT_EXTD_NSS_2X_NSS_160_1X_NSS_80P80) { |
| 1153 | if (nss > (VHT_MAX_NSS / 2)) { |
| 1154 | pe_debug("Invalid extnd nss bw support val"); |
| 1155 | sta_ds->vht_80p80mhz_nss = nss / 2; |
| 1156 | break; |
| 1157 | } |
| 1158 | sta_ds->vht_160mhz_nss = nss * 2; |
| 1159 | if (session->nss == MAX_VDEV_NSS) |
| 1160 | break; |
| 1161 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable2x2) |
| 1162 | break; |
| 1163 | session->nss *= 2; |
| 1164 | } else { |
| 1165 | sta_ds->vht_80p80mhz_nss = 0; |
| 1166 | } |
| 1167 | break; |
| 1168 | case VHT_CAP_160_AND_80P80_SUPP: |
| 1169 | if (vht_caps->extended_nss_bw_supp == |
| 1170 | VHT_EXTD_NSS_2X_NSS_80_1X_NSS_80P80) { |
| 1171 | if (nss > (VHT_MAX_NSS / 2)) { |
| 1172 | pe_debug("Invalid extnd nss bw support val"); |
| 1173 | break; |
| 1174 | } |
| 1175 | if (session->nss == MAX_VDEV_NSS) |
| 1176 | break; |
| 1177 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable2x2) |
| 1178 | break; |
| 1179 | session->nss *= 2; |
| 1180 | } else { |
| 1181 | sta_ds->vht_160mhz_nss = nss; |
| 1182 | sta_ds->vht_80p80mhz_nss = nss; |
| 1183 | } |
| 1184 | break; |
| 1185 | default: |
| 1186 | sta_ds->vht_160mhz_nss = 0; |
| 1187 | sta_ds->vht_80p80mhz_nss = 0; |
| 1188 | } |
| 1189 | pe_debug("AP Nss config: 160MHz: %d, 80P80MHz %d", |
| 1190 | sta_ds->vht_160mhz_nss, sta_ds->vht_80p80mhz_nss); |
| 1191 | sta_ds->vht_160mhz_nss = QDF_MIN(sta_ds->vht_160mhz_nss, session->nss); |
| 1192 | sta_ds->vht_80p80mhz_nss = QDF_MIN(sta_ds->vht_80p80mhz_nss, |
| 1193 | session->nss); |
| 1194 | pe_debug("Session Nss config: 160MHz: %d, 80P80MHz %d, session Nss %d", |
| 1195 | sta_ds->vht_160mhz_nss, sta_ds->vht_80p80mhz_nss, |
| 1196 | session->nss); |
| 1197 | } |
| 1198 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1199 | QDF_STATUS lim_populate_vht_mcs_set(struct mac_context *mac_ctx, |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1200 | struct supported_rates *rates, |
| 1201 | tDot11fIEVHTCaps *peer_vht_caps, |
| 1202 | struct pe_session *session_entry, |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1203 | uint8_t nss, |
| 1204 | struct sDphHashNode *sta_ds) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1205 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1206 | uint32_t self_sta_dot11mode = 0; |
| 1207 | uint16_t mcs_map_mask = MCSMAPMASK1x1; |
| 1208 | uint16_t mcs_map_mask2x2 = 0; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1209 | struct mlme_vht_capabilities_info *vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1210 | |
gaurank kathpalia | 1be77fa | 2019-01-04 13:32:09 +0530 | [diff] [blame] | 1211 | self_sta_dot11mode = mac_ctx->mlme_cfg->dot11_mode.dot11_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1212 | |
| 1213 | if (!IS_DOT11_MODE_VHT(self_sta_dot11mode)) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1214 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1215 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1216 | if (!peer_vht_caps || !peer_vht_caps->present) |
| 1217 | return QDF_STATUS_SUCCESS; |
| 1218 | |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1219 | vht_cap_info = &mac_ctx->mlme_cfg->vht_caps.vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1221 | rates->vhtRxMCSMap = (uint16_t)vht_cap_info->rx_mcs_map; |
| 1222 | rates->vhtTxMCSMap = (uint16_t)vht_cap_info->tx_mcs_map; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 1223 | rates->vhtRxHighestDataRate = |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1224 | (uint16_t)vht_cap_info->rx_supp_data_rate; |
| 1225 | rates->vhtTxHighestDataRate = |
| 1226 | (uint16_t)vht_cap_info->tx_supp_data_rate; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1228 | if (NSS_1x1_MODE == nss) { |
| 1229 | rates->vhtRxMCSMap |= VHT_MCS_1x1; |
| 1230 | rates->vhtTxMCSMap |= VHT_MCS_1x1; |
| 1231 | rates->vhtTxHighestDataRate = |
| 1232 | VHT_TX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
| 1233 | rates->vhtRxHighestDataRate = |
| 1234 | VHT_RX_HIGHEST_SUPPORTED_DATA_RATE_1_1; |
Krunal Soni | 3e4a3b6 | 2018-05-03 14:09:47 -0700 | [diff] [blame] | 1235 | if (session_entry && !session_entry->ch_width && |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1236 | !vht_cap_info->enable_vht20_mcs9 && |
Abhinav Kumar | e057b41 | 2018-10-09 17:28:16 +0530 | [diff] [blame] | 1237 | ((rates->vhtRxMCSMap & VHT_1x1_MCS_MASK) == |
Kiran Kumar Lokere | 0e25517 | 2018-03-30 18:54:25 -0700 | [diff] [blame] | 1238 | VHT_1x1_MCS9_MAP)) { |
| 1239 | DISABLE_VHT_MCS_9(rates->vhtRxMCSMap, |
| 1240 | NSS_1x1_MODE); |
| 1241 | DISABLE_VHT_MCS_9(rates->vhtTxMCSMap, |
| 1242 | NSS_1x1_MODE); |
| 1243 | } |
| 1244 | } else { |
Krunal Soni | 3e4a3b6 | 2018-05-03 14:09:47 -0700 | [diff] [blame] | 1245 | if (session_entry && !session_entry->ch_width && |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 1246 | !vht_cap_info->enable_vht20_mcs9 && |
| 1247 | ((rates->vhtRxMCSMap & VHT_2x2_MCS_MASK) == |
| 1248 | VHT_2x2_MCS9_MAP)) { |
Kiran Kumar Lokere | 0e25517 | 2018-03-30 18:54:25 -0700 | [diff] [blame] | 1249 | DISABLE_VHT_MCS_9(rates->vhtRxMCSMap, |
| 1250 | NSS_2x2_MODE); |
| 1251 | DISABLE_VHT_MCS_9(rates->vhtTxMCSMap, |
| 1252 | NSS_2x2_MODE); |
| 1253 | } |
Kiran Kumar Lokere | 6671abd | 2016-05-02 19:36:19 -0700 | [diff] [blame] | 1254 | } |
| 1255 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1256 | rates->vhtTxHighestDataRate = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1257 | QDF_MIN(rates->vhtTxHighestDataRate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1258 | peer_vht_caps->txSupDataRate); |
| 1259 | rates->vhtRxHighestDataRate = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1260 | QDF_MIN(rates->vhtRxHighestDataRate, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1261 | peer_vht_caps->rxHighSupDataRate); |
| 1262 | |
Abhishek Singh | b01ac95 | 2017-08-17 13:52:23 +0530 | [diff] [blame] | 1263 | if (session_entry && session_entry->nss == NSS_2x2_MODE) |
| 1264 | mcs_map_mask2x2 = MCSMAPMASK2x2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | |
| 1266 | if ((peer_vht_caps->txMCSMap & mcs_map_mask) < |
| 1267 | (rates->vhtRxMCSMap & mcs_map_mask)) { |
| 1268 | rates->vhtRxMCSMap &= ~(mcs_map_mask); |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1269 | rates->vhtRxMCSMap |= (peer_vht_caps->txMCSMap & mcs_map_mask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1270 | } |
| 1271 | if ((peer_vht_caps->rxMCSMap & mcs_map_mask) < |
| 1272 | (rates->vhtTxMCSMap & mcs_map_mask)) { |
| 1273 | rates->vhtTxMCSMap &= ~(mcs_map_mask); |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1274 | rates->vhtTxMCSMap |= (peer_vht_caps->rxMCSMap & mcs_map_mask); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1275 | } |
| 1276 | |
| 1277 | if (mcs_map_mask2x2) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1278 | uint16_t peer_mcs_map, self_mcs_map; |
| 1279 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1280 | peer_mcs_map = peer_vht_caps->txMCSMap & mcs_map_mask2x2; |
| 1281 | self_mcs_map = rates->vhtRxMCSMap & mcs_map_mask2x2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | |
| 1283 | if ((self_mcs_map != mcs_map_mask2x2) && |
| 1284 | ((peer_mcs_map == mcs_map_mask2x2) || |
| 1285 | (peer_mcs_map < self_mcs_map))) { |
| 1286 | rates->vhtRxMCSMap &= ~mcs_map_mask2x2; |
| 1287 | rates->vhtRxMCSMap |= peer_mcs_map; |
| 1288 | } |
| 1289 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1290 | peer_mcs_map = (peer_vht_caps->rxMCSMap & mcs_map_mask2x2); |
| 1291 | self_mcs_map = (rates->vhtTxMCSMap & mcs_map_mask2x2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1292 | |
| 1293 | if ((self_mcs_map != mcs_map_mask2x2) && |
| 1294 | ((peer_mcs_map == mcs_map_mask2x2) || |
| 1295 | (peer_mcs_map < self_mcs_map))) { |
| 1296 | rates->vhtTxMCSMap &= ~mcs_map_mask2x2; |
| 1297 | rates->vhtTxMCSMap |= peer_mcs_map; |
| 1298 | } |
| 1299 | } |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1300 | |
| 1301 | pe_debug("RxMCSMap %x TxMCSMap %x", rates->vhtRxMCSMap, |
| 1302 | rates->vhtTxMCSMap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1304 | if (!session_entry) |
| 1305 | return QDF_STATUS_SUCCESS; |
| 1306 | |
| 1307 | session_entry->supported_nss_1x1 = |
| 1308 | ((rates->vhtTxMCSMap & VHT_MCS_1x1) == VHT_MCS_1x1) ? |
| 1309 | true : false; |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1310 | |
| 1311 | if (!sta_ds || CH_WIDTH_80MHZ >= session_entry->ch_width) |
| 1312 | return QDF_STATUS_SUCCESS; |
| 1313 | |
| 1314 | sta_ds->vht_extended_nss_bw_cap = |
| 1315 | peer_vht_caps->vht_extended_nss_bw_cap; |
| 1316 | lim_get_vht_gt80_nss(mac_ctx, sta_ds, peer_vht_caps, session_entry); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1317 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1318 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1319 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1321 | static void lim_dump_ht_mcs_mask(uint8_t *self_mcs, uint8_t *peer_mcs) |
| 1322 | { |
| 1323 | uint32_t len = 0; |
| 1324 | uint8_t idx; |
| 1325 | uint8_t *buff; |
| 1326 | uint32_t buff_len; |
| 1327 | |
| 1328 | /* |
| 1329 | * Buffer of (SIR_MAC_MAX_SUPPORTED_MCS_SET * 5) + 1 to consider the 4 |
| 1330 | * char MCS eg 0xff and 1 space after it and 1 to end the string with |
| 1331 | * NULL. |
| 1332 | */ |
| 1333 | buff_len = (SIR_MAC_MAX_SUPPORTED_MCS_SET * 5) + 1; |
| 1334 | buff = qdf_mem_malloc(buff_len); |
| 1335 | if (!buff) |
| 1336 | return; |
| 1337 | |
| 1338 | if (self_mcs) { |
| 1339 | for (idx = 0; idx < SIR_MAC_MAX_SUPPORTED_MCS_SET; idx++) |
| 1340 | len += qdf_scnprintf(buff + len, buff_len - len, |
| 1341 | "0x%x ", self_mcs[idx]); |
| 1342 | |
| 1343 | pe_nofl_debug("SELF HT MCS: %s", buff); |
| 1344 | } |
| 1345 | |
| 1346 | if (peer_mcs) { |
| 1347 | len = 0; |
| 1348 | for (idx = 0; idx < SIR_MAC_MAX_SUPPORTED_MCS_SET; idx++) |
| 1349 | len += qdf_scnprintf(buff + len, buff_len - len, |
| 1350 | "0x%x ", peer_mcs[idx]); |
| 1351 | |
| 1352 | pe_nofl_debug("PEER HT MCS: %s", buff); |
| 1353 | } |
| 1354 | |
| 1355 | qdf_mem_free(buff); |
| 1356 | } |
| 1357 | |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1358 | QDF_STATUS lim_populate_own_rate_set(struct mac_context *mac_ctx, |
| 1359 | struct supported_rates *rates, |
| 1360 | uint8_t *supported_mcs_set, |
| 1361 | uint8_t basic_only, |
| 1362 | struct pe_session *session_entry, |
| 1363 | struct sDot11fIEVHTCaps *vht_caps, |
| 1364 | struct sDot11fIEhe_cap *he_caps) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | { |
| 1366 | tSirMacRateSet temp_rate_set; |
| 1367 | tSirMacRateSet temp_rate_set2; |
| 1368 | uint32_t i, j, val, min, is_arate; |
| 1369 | uint32_t phy_mode = 0; |
| 1370 | uint32_t self_sta_dot11mode = 0; |
| 1371 | uint8_t a_rate_index = 0; |
| 1372 | uint8_t b_rate_index = 0; |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1373 | qdf_size_t val_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1374 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | is_arate = 0; |
| 1376 | |
gaurank kathpalia | 1be77fa | 2019-01-04 13:32:09 +0530 | [diff] [blame] | 1377 | self_sta_dot11mode = mac_ctx->mlme_cfg->dot11_mode.dot11_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1379 | |
| 1380 | /* |
| 1381 | * Include 11b rates only when the device configured in |
| 1382 | * auto, 11a/b/g or 11b_only |
| 1383 | */ |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 1384 | if ((self_sta_dot11mode == MLME_DOT11_MODE_ALL) || |
| 1385 | (self_sta_dot11mode == MLME_DOT11_MODE_11A) || |
| 1386 | (self_sta_dot11mode == MLME_DOT11_MODE_11AC) || |
| 1387 | (self_sta_dot11mode == MLME_DOT11_MODE_11N) || |
| 1388 | (self_sta_dot11mode == MLME_DOT11_MODE_11G) || |
Abhishek Ambure | 5ec0d66 | 2019-11-12 17:31:26 +0530 | [diff] [blame] | 1389 | (self_sta_dot11mode == MLME_DOT11_MODE_11B) || |
| 1390 | (self_sta_dot11mode == MLME_DOT11_MODE_11AX)) { |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1391 | val_len = mac_ctx->mlme_cfg->rates.supported_11b.len; |
| 1392 | wlan_mlme_get_cfg_str((uint8_t *)&temp_rate_set.rate, |
| 1393 | &mac_ctx->mlme_cfg->rates.supported_11b, |
| 1394 | &val_len); |
| 1395 | temp_rate_set.numRates = (uint8_t)val_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1396 | } else { |
| 1397 | temp_rate_set.numRates = 0; |
| 1398 | } |
| 1399 | |
| 1400 | /* Include 11a rates when the device configured in non-11b mode */ |
| 1401 | if (!IS_DOT11_MODE_11B(self_sta_dot11mode)) { |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1402 | val_len = mac_ctx->mlme_cfg->rates.supported_11a.len; |
| 1403 | wlan_mlme_get_cfg_str((uint8_t *)&temp_rate_set2.rate, |
| 1404 | &mac_ctx->mlme_cfg->rates.supported_11a, |
| 1405 | &val_len); |
| 1406 | temp_rate_set2.numRates = (uint8_t)val_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1407 | } else { |
| 1408 | temp_rate_set2.numRates = 0; |
| 1409 | } |
| 1410 | |
| 1411 | if ((temp_rate_set.numRates + temp_rate_set2.numRates) > 12) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1412 | pe_err("more than 12 rates in CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1413 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1414 | } |
| 1415 | /* copy all rates in temp_rate_set, there are 12 rates max */ |
| 1416 | for (i = 0; i < temp_rate_set2.numRates; i++) |
| 1417 | temp_rate_set.rate[i + temp_rate_set.numRates] = |
| 1418 | temp_rate_set2.rate[i]; |
| 1419 | |
| 1420 | temp_rate_set.numRates += temp_rate_set2.numRates; |
| 1421 | |
| 1422 | /** |
| 1423 | * Sort rates in temp_rate_set (they are likely to be already sorted) |
| 1424 | * put the result in pSupportedRates |
| 1425 | */ |
| 1426 | |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1427 | qdf_mem_zero(rates, sizeof(*rates)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | for (i = 0; i < temp_rate_set.numRates; i++) { |
| 1429 | min = 0; |
| 1430 | val = 0xff; |
| 1431 | is_arate = 0; |
| 1432 | |
| 1433 | for (j = 0; (j < temp_rate_set.numRates) && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1434 | (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1435 | if ((uint32_t) (temp_rate_set.rate[j] & 0x7f) < |
| 1436 | val) { |
| 1437 | val = temp_rate_set.rate[j] & 0x7f; |
| 1438 | min = j; |
| 1439 | } |
| 1440 | } |
| 1441 | |
| 1442 | if (sirIsArate(temp_rate_set.rate[min] & 0x7f)) |
| 1443 | is_arate = 1; |
| 1444 | |
Kiran Kumar Lokere | b503c7c | 2018-05-03 16:24:53 -0700 | [diff] [blame] | 1445 | if (is_arate) |
| 1446 | rates->llaRates[a_rate_index++] = |
| 1447 | temp_rate_set.rate[min]; |
| 1448 | else |
| 1449 | rates->llbRates[b_rate_index++] = |
| 1450 | temp_rate_set.rate[min]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1451 | temp_rate_set.rate[min] = 0xff; |
| 1452 | } |
| 1453 | |
| 1454 | if (IS_DOT11_MODE_HT(self_sta_dot11mode)) { |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1455 | val_len = SIZE_OF_SUPPORTED_MCS_SET; |
| 1456 | if (wlan_mlme_get_cfg_str( |
| 1457 | rates->supportedMCSSet, |
| 1458 | &mac_ctx->mlme_cfg->rates.supported_mcs_set, |
| 1459 | &val_len) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1460 | pe_err("could not retrieve supportedMCSSet"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1461 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1462 | } |
| 1463 | |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1464 | if (session_entry->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1465 | rates->supportedMCSSet[1] = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1466 | /* |
| 1467 | * if supported MCS Set of the peer is passed in, |
| 1468 | * then do the intersection |
| 1469 | * else use the MCS set from local CFG. |
| 1470 | */ |
| 1471 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1472 | if (supported_mcs_set) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1474 | rates->supportedMCSSet[i] &= |
| 1475 | supported_mcs_set[i]; |
| 1476 | } |
| 1477 | |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1478 | lim_dump_ht_mcs_mask(rates->supportedMCSSet, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1479 | } |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1480 | lim_populate_vht_mcs_set(mac_ctx, rates, vht_caps, session_entry, |
| 1481 | session_entry->nss, NULL); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1482 | lim_populate_he_mcs_set(mac_ctx, rates, he_caps, |
| 1483 | session_entry, session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1484 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1485 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1486 | } |
| 1487 | |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 1488 | #ifdef WLAN_FEATURE_11AX |
| 1489 | /** |
| 1490 | * lim_calculate_he_nss() - function to calculate new nss from he rates |
| 1491 | * @rates: supported rtes struct object |
| 1492 | * @session: pe session entry |
| 1493 | * This function calculates nss from rx_he_mcs_map_lt_80 within rates struct |
| 1494 | * object and assigns new value to nss within pe_session |
| 1495 | * |
| 1496 | * Return: None |
| 1497 | */ |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1498 | static void lim_calculate_he_nss(struct supported_rates *rates, |
| 1499 | struct pe_session *session) |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 1500 | { |
| 1501 | HE_GET_NSS(rates->rx_he_mcs_map_lt_80, session->nss); |
| 1502 | } |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1503 | |
| 1504 | static bool lim_check_valid_mcs_for_nss(struct pe_session *session, |
| 1505 | tDot11fIEhe_cap *he_caps) |
| 1506 | { |
| 1507 | uint16_t mcs_map; |
| 1508 | uint8_t mcs_count = 2, i; |
| 1509 | |
Kiran Kumar Lokere | 8b44a51 | 2020-05-11 19:02:32 -0700 | [diff] [blame] | 1510 | if (!session->he_capable || !he_caps || !he_caps->present) |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1511 | return true; |
| 1512 | |
| 1513 | mcs_map = he_caps->rx_he_mcs_map_lt_80; |
| 1514 | |
| 1515 | do { |
| 1516 | for (i = 0; i < session->nss; i++) { |
| 1517 | if (((mcs_map >> (i * 2)) & 0x3) == 0x3) |
| 1518 | return false; |
| 1519 | } |
| 1520 | |
| 1521 | mcs_map = he_caps->tx_he_mcs_map_lt_80; |
| 1522 | mcs_count--; |
| 1523 | } while (mcs_count); |
| 1524 | |
| 1525 | return true; |
| 1526 | |
| 1527 | } |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 1528 | #else |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1529 | static void lim_calculate_he_nss(struct supported_rates *rates, |
| 1530 | struct pe_session *session) |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 1531 | { |
| 1532 | } |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1533 | |
| 1534 | static bool lim_check_valid_mcs_for_nss(struct pe_session *session, |
| 1535 | tDot11fIEhe_cap *he_caps) |
| 1536 | { |
| 1537 | return true; |
| 1538 | } |
Naveen Rawat | cbcc654 | 2017-10-30 17:55:03 -0700 | [diff] [blame] | 1539 | #endif |
| 1540 | |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1541 | QDF_STATUS lim_populate_peer_rate_set(struct mac_context *mac, |
| 1542 | struct supported_rates *pRates, |
| 1543 | uint8_t *pSupportedMCSSet, |
| 1544 | uint8_t basicOnly, |
| 1545 | struct pe_session *pe_session, |
| 1546 | tDot11fIEVHTCaps *pVHTCaps, |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1547 | tDot11fIEhe_cap *he_caps, |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 1548 | struct sDphHashNode *sta_ds, |
| 1549 | struct bss_description *bss_desc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1550 | { |
| 1551 | tSirMacRateSet tempRateSet; |
| 1552 | tSirMacRateSet tempRateSet2; |
android-t2 | 591808b | 2022-12-02 16:02:26 +0800 | [diff] [blame] | 1553 | uint32_t i, j, val, min; |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1554 | qdf_size_t val_len; |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1555 | uint8_t aRateIndex = 0; |
| 1556 | uint8_t bRateIndex = 0; |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1557 | tDot11fIEhe_cap *peer_he_caps; |
Kiran Kumar Lokere | e8ef2ca | 2019-12-30 16:31:09 -0800 | [diff] [blame] | 1558 | tSchBeaconStruct *pBeaconStruct = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1559 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1560 | /* copy operational rate set from pe_session */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1561 | if (pe_session->rateSet.numRates <= WLAN_SUPPORTED_RATES_IE_MAX_LEN) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1562 | qdf_mem_copy((uint8_t *) tempRateSet.rate, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1563 | (uint8_t *) (pe_session->rateSet.rate), |
| 1564 | pe_session->rateSet.numRates); |
| 1565 | tempRateSet.numRates = pe_session->rateSet.numRates; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1566 | } else { |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1567 | pe_err("more than WLAN_SUPPORTED_RATES_IE_MAX_LEN rates"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1568 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1569 | } |
gaurank kathpalia | 0c48d3d | 2019-01-29 15:03:07 +0530 | [diff] [blame] | 1570 | if ((pe_session->dot11mode == MLME_DOT11_MODE_11G) || |
| 1571 | (pe_session->dot11mode == MLME_DOT11_MODE_11A) || |
| 1572 | (pe_session->dot11mode == MLME_DOT11_MODE_11AC) || |
Abhishek Ambure | 5ec0d66 | 2019-11-12 17:31:26 +0530 | [diff] [blame] | 1573 | (pe_session->dot11mode == MLME_DOT11_MODE_11N) || |
| 1574 | (pe_session->dot11mode == MLME_DOT11_MODE_11AX)) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1575 | if (pe_session->extRateSet.numRates <= |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1576 | WLAN_SUPPORTED_RATES_IE_MAX_LEN) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1577 | qdf_mem_copy((uint8_t *) tempRateSet2.rate, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1578 | (uint8_t *) (pe_session->extRateSet. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1579 | rate), |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1580 | pe_session->extRateSet.numRates); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1581 | tempRateSet2.numRates = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1582 | pe_session->extRateSet.numRates; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1583 | } else { |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1584 | pe_err("pe_session->extRateSet.numRates more than WLAN_SUPPORTED_RATES_IE_MAX_LEN rates"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1585 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1586 | } |
| 1587 | } else |
| 1588 | tempRateSet2.numRates = 0; |
gaurank kathpalia | faf302c | 2018-07-12 16:07:16 +0530 | [diff] [blame] | 1589 | if ((tempRateSet.numRates + tempRateSet2.numRates) > |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1590 | WLAN_SUPPORTED_RATES_IE_MAX_LEN) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1591 | pe_err("more than 12 rates in CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1592 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1593 | } |
| 1594 | |
| 1595 | /* copy all rates in tempRateSet, there are 12 rates max */ |
| 1596 | for (i = 0; i < tempRateSet2.numRates; i++) |
| 1597 | tempRateSet.rate[i + tempRateSet.numRates] = |
| 1598 | tempRateSet2.rate[i]; |
| 1599 | tempRateSet.numRates += tempRateSet2.numRates; |
| 1600 | /** |
| 1601 | * Sort rates in tempRateSet (they are likely to be already sorted) |
| 1602 | * put the result in pSupportedRates |
| 1603 | */ |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 1604 | |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1605 | qdf_mem_zero(pRates, sizeof(*pRates)); |
| 1606 | for (i = 0; i < tempRateSet.numRates; i++) { |
| 1607 | min = 0; |
| 1608 | val = 0xff; |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1609 | for (j = 0; (j < tempRateSet.numRates) && |
| 1610 | (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) { |
| 1611 | if ((uint32_t)(tempRateSet.rate[j] & 0x7f) < |
| 1612 | val) { |
| 1613 | val = tempRateSet.rate[j] & 0x7f; |
| 1614 | min = j; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1615 | } |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1616 | } |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1617 | /* |
| 1618 | * HAL needs to know whether the rate is basic rate or not, |
| 1619 | * as it needs to update the response rate table accordingly. |
| 1620 | * e.g. if one of the 11a rates is basic rate, then that rate |
| 1621 | * can be used for sending control frames. HAL updates the |
| 1622 | * response rate table whenever basic rate set is changed. |
| 1623 | */ |
android-t2 | 591808b | 2022-12-02 16:02:26 +0800 | [diff] [blame] | 1624 | if (basicOnly && !(tempRateSet.rate[min] & 0x80)) { |
| 1625 | pe_debug("Invalid basic rate"); |
| 1626 | } else if (sirIsArate(tempRateSet.rate[min] & 0x7f)) { |
| 1627 | if (aRateIndex >= SIR_NUM_11A_RATES) { |
| 1628 | pe_debug("OOB, aRateIndex: %d", aRateIndex); |
| 1629 | } else if (aRateIndex >= 1 && (tempRateSet.rate[min] == |
| 1630 | pRates->llaRates[aRateIndex - 1])) { |
| 1631 | pe_debug("Duplicate 11a rate: %d", |
| 1632 | tempRateSet.rate[min]); |
| 1633 | } else { |
| 1634 | pRates->llaRates[aRateIndex++] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1635 | tempRateSet.rate[min]; |
android-t2 | 591808b | 2022-12-02 16:02:26 +0800 | [diff] [blame] | 1636 | } |
| 1637 | } else if (sirIsBrate(tempRateSet.rate[min] & 0x7f)) { |
| 1638 | if (bRateIndex >= SIR_NUM_11B_RATES) { |
| 1639 | pe_debug("OOB, bRateIndex: %d", bRateIndex); |
| 1640 | } else if (bRateIndex >= 1 && (tempRateSet.rate[min] == |
| 1641 | pRates->llbRates[bRateIndex - 1])) { |
| 1642 | pe_debug("Duplicate 11b rate: %d", |
| 1643 | tempRateSet.rate[min]); |
| 1644 | } else { |
| 1645 | pRates->llbRates[bRateIndex++] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1646 | tempRateSet.rate[min]; |
| 1647 | } |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1648 | } else { |
android-t2 | 591808b | 2022-12-02 16:02:26 +0800 | [diff] [blame] | 1649 | pe_debug("%d is neither 11a nor 11b rate", |
| 1650 | tempRateSet.rate[min]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1651 | } |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1652 | tempRateSet.rate[min] = 0xff; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1653 | } |
| 1654 | |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 1655 | if (IS_DOT11_MODE_HT(pe_session->dot11mode) && |
| 1656 | !lim_is_he_6ghz_band(pe_session)) { |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1657 | val_len = SIZE_OF_SUPPORTED_MCS_SET; |
| 1658 | if (wlan_mlme_get_cfg_str( |
| 1659 | pRates->supportedMCSSet, |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 1660 | &mac->mlme_cfg->rates.supported_mcs_set, |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1661 | &val_len) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1662 | pe_err("could not retrieve supportedMCSSet"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1663 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1664 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1665 | if (pe_session->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1666 | pRates->supportedMCSSet[1] = 0; |
| 1667 | |
| 1668 | /* if supported MCS Set of the peer is passed in, then do the |
| 1669 | * intersection, else use the MCS set from local CFG. |
| 1670 | */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 1671 | if (pSupportedMCSSet) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1672 | for (i = 0; i < SIR_MAC_MAX_SUPPORTED_MCS_SET; i++) |
| 1673 | pRates->supportedMCSSet[i] &= |
| 1674 | pSupportedMCSSet[i]; |
| 1675 | } |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1676 | |
| 1677 | lim_dump_ht_mcs_mask(NULL, pRates->supportedMCSSet); |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1678 | |
Naveen Rawat | 6417668 | 2017-06-14 14:28:37 -0700 | [diff] [blame] | 1679 | if (pRates->supportedMCSSet[0] == 0) { |
| 1680 | pe_debug("Incorrect MCS 0 - 7. They must be supported"); |
| 1681 | pRates->supportedMCSSet[0] = 0xFF; |
| 1682 | } |
| 1683 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1684 | pe_session->supported_nss_1x1 = |
Archana Ramachandran | 20d2e23 | 2016-02-11 16:58:40 -0800 | [diff] [blame] | 1685 | ((pRates->supportedMCSSet[1] != 0) ? false : true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1686 | } |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1687 | lim_populate_vht_mcs_set(mac, pRates, pVHTCaps, pe_session, |
| 1688 | pe_session->nss, sta_ds); |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1689 | |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1690 | if (lim_check_valid_mcs_for_nss(pe_session, he_caps)) { |
| 1691 | peer_he_caps = he_caps; |
| 1692 | } else { |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 1693 | if (!bss_desc) { |
Gururaj Pandurangi | 645d78a | 2020-07-10 13:05:38 -0700 | [diff] [blame] | 1694 | pe_err("bssDescription is NULL"); |
| 1695 | return QDF_STATUS_E_INVAL; |
| 1696 | } |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1697 | pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
| 1698 | if (!pBeaconStruct) |
| 1699 | return QDF_STATUS_E_NOMEM; |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 1700 | |
| 1701 | lim_extract_ap_capabilities( |
| 1702 | mac, (uint8_t *)bss_desc->ieFields, |
| 1703 | lim_get_ielen_from_bss_description(bss_desc), |
Kiran Kumar Lokere | 2f8a360 | 2019-11-21 17:40:06 -0800 | [diff] [blame] | 1704 | pBeaconStruct); |
| 1705 | peer_he_caps = &pBeaconStruct->he_cap; |
| 1706 | } |
| 1707 | |
| 1708 | lim_populate_he_mcs_set(mac, pRates, peer_he_caps, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1709 | pe_session, pe_session->nss); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1710 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1711 | if (IS_DOT11_MODE_HE(pe_session->dot11mode) && he_caps) { |
| 1712 | lim_calculate_he_nss(pRates, pe_session); |
Abhinav Kumar | 2ae2524 | 2020-05-11 22:46:11 +0530 | [diff] [blame] | 1713 | } else if (pe_session->vhtCapability) { |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1714 | if ((pRates->vhtRxMCSMap & MCSMAPMASK2x2) == MCSMAPMASK2x2) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1715 | pe_session->nss = NSS_1x1_MODE; |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1716 | } else if (pRates->supportedMCSSet[1] == 0) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 1717 | pe_session->nss = NSS_1x1_MODE; |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1718 | } |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1719 | pe_debug("nss 1x1 %d nss %d", pe_session->supported_nss_1x1, |
| 1720 | pe_session->nss); |
Naveen Rawat | 746a90b | 2017-06-07 15:16:35 -0700 | [diff] [blame] | 1721 | |
Kiran Kumar Lokere | e8ef2ca | 2019-12-30 16:31:09 -0800 | [diff] [blame] | 1722 | if (pBeaconStruct) |
| 1723 | qdf_mem_free(pBeaconStruct); |
| 1724 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1725 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1726 | } /*** lim_populate_peer_rate_set() ***/ |
| 1727 | |
| 1728 | /** |
| 1729 | * lim_populate_matching_rate_set() -process the CFG rate sets and |
| 1730 | * the rate sets received in the Assoc request on AP. |
| 1731 | * @mac_ctx: pointer to global mac structure |
| 1732 | * @sta_ds: station node |
| 1733 | * @oper_rate_set: pointer to operating rate set |
| 1734 | * @ext_rate_set: pointer to extended rate set |
| 1735 | * @supported_mcs_set: pointer to supported rate set |
| 1736 | * @session_entry: pointer to pe session entry |
| 1737 | * @vht_caps: pointer to vht capabilities |
| 1738 | * |
| 1739 | * This is called at the time of Association Request |
| 1740 | * processing on AP and while adding peer's context |
| 1741 | * in IBSS role to process the CFG rate sets and |
| 1742 | * the rate sets received in the Assoc request on AP |
| 1743 | * or Beacon/Probe Response from peer in IBSS. |
| 1744 | * |
| 1745 | * 1. It makes the intersection between our own rate Sat |
| 1746 | * and extemcded rate set and the ones received in the |
| 1747 | * association request. |
| 1748 | * 2. It creates a combined rate set of 12 rates max which |
| 1749 | * comprised the basic and extended rates |
| 1750 | * 3. It sorts the combined rate Set and copy it in the |
| 1751 | * rate array of the pSTA descriptor |
| 1752 | * |
| 1753 | * The parser has already ensured unicity of the rates in the |
| 1754 | * association request structure |
| 1755 | * |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1756 | * Return: QDF_STATUS_SUCCESS on success else QDF_STATUS_E_FAILURE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1757 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 1758 | QDF_STATUS lim_populate_matching_rate_set(struct mac_context *mac_ctx, |
Jeff Johnson | 81ae428 | 2019-01-06 11:18:00 -0800 | [diff] [blame] | 1759 | tpDphHashNode sta_ds, |
| 1760 | tSirMacRateSet *oper_rate_set, |
| 1761 | tSirMacRateSet *ext_rate_set, |
| 1762 | uint8_t *supported_mcs_set, |
| 1763 | struct pe_session *session_entry, |
| 1764 | tDot11fIEVHTCaps *vht_caps, |
| 1765 | tDot11fIEhe_cap *he_caps) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1766 | { |
| 1767 | tSirMacRateSet temp_rate_set; |
| 1768 | tSirMacRateSet temp_rate_set2; |
| 1769 | uint32_t i, j, val, min, is_arate; |
| 1770 | uint32_t phy_mode; |
| 1771 | uint8_t mcs_set[SIZE_OF_SUPPORTED_MCS_SET]; |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1772 | struct supported_rates *rates; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1773 | uint8_t a_rate_index = 0; |
| 1774 | uint8_t b_rate_index = 0; |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1775 | qdf_size_t val_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1776 | |
| 1777 | is_arate = 0; |
| 1778 | |
| 1779 | lim_get_phy_mode(mac_ctx, &phy_mode, session_entry); |
| 1780 | |
| 1781 | /* copy operational rate set from session_entry */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1782 | qdf_mem_copy((temp_rate_set.rate), (session_entry->rateSet.rate), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1783 | session_entry->rateSet.numRates); |
| 1784 | temp_rate_set.numRates = (uint8_t) session_entry->rateSet.numRates; |
| 1785 | |
| 1786 | if (phy_mode == WNI_CFG_PHY_MODE_11G) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1787 | qdf_mem_copy((temp_rate_set2.rate), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1788 | (session_entry->extRateSet.rate), |
| 1789 | session_entry->extRateSet.numRates); |
| 1790 | temp_rate_set2.numRates = |
| 1791 | (uint8_t) session_entry->extRateSet.numRates; |
| 1792 | } else { |
| 1793 | temp_rate_set2.numRates = 0; |
| 1794 | } |
| 1795 | |
Naveen Rawat | 24c1691 | 2016-11-17 11:28:40 -0800 | [diff] [blame] | 1796 | /* |
| 1797 | * absolute sum of both num_rates should be less than 12. following |
| 1798 | * 16-bit sum avoids false codition where 8-bit arthematic overflow |
| 1799 | * might have caused total sum to be less than 12 |
| 1800 | */ |
| 1801 | if (((uint16_t)temp_rate_set.numRates + |
| 1802 | (uint16_t)temp_rate_set2.numRates) > 12) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1803 | pe_err("more than 12 rates in CFG"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1804 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | } |
| 1806 | |
| 1807 | /* |
| 1808 | * Handling of the rate set IEs is the following: |
| 1809 | * - keep only rates that we support and that the station supports |
| 1810 | * - sort and the rates into the pSta->rate array |
| 1811 | */ |
| 1812 | |
| 1813 | /* Copy all rates in temp_rate_set, there are 12 rates max */ |
| 1814 | for (i = 0; i < temp_rate_set2.numRates; i++) |
| 1815 | temp_rate_set.rate[i + temp_rate_set.numRates] = |
| 1816 | temp_rate_set2.rate[i]; |
| 1817 | |
| 1818 | temp_rate_set.numRates += temp_rate_set2.numRates; |
| 1819 | |
| 1820 | /* |
| 1821 | * Sort rates in temp_rate_set (they are likely to be already sorted) |
| 1822 | * put the result in temp_rate_set2 |
| 1823 | */ |
| 1824 | temp_rate_set2.numRates = 0; |
| 1825 | |
| 1826 | for (i = 0; i < temp_rate_set.numRates; i++) { |
| 1827 | min = 0; |
| 1828 | val = 0xff; |
| 1829 | |
| 1830 | for (j = 0; j < temp_rate_set.numRates; j++) |
| 1831 | if ((uint32_t) (temp_rate_set.rate[j] & 0x7f) < val) { |
| 1832 | val = temp_rate_set.rate[j] & 0x7f; |
| 1833 | min = j; |
| 1834 | } |
| 1835 | |
| 1836 | temp_rate_set2.rate[temp_rate_set2.numRates++] = |
| 1837 | temp_rate_set.rate[min]; |
| 1838 | temp_rate_set.rate[min] = 0xff; |
| 1839 | } |
| 1840 | |
| 1841 | /* |
| 1842 | * Copy received rates in temp_rate_set, the parser has ensured |
| 1843 | * unicity of the rates so there cannot be more than 12 |
| 1844 | */ |
| 1845 | for (i = 0; (i < oper_rate_set->numRates && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1846 | i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1847 | temp_rate_set.rate[i] = oper_rate_set->rate[i]; |
| 1848 | |
| 1849 | temp_rate_set.numRates = oper_rate_set->numRates; |
| 1850 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1851 | pe_debug("Sum of SUPPORTED and EXTENDED Rate Set (%1d)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | temp_rate_set.numRates + ext_rate_set->numRates); |
| 1853 | |
| 1854 | if (ext_rate_set->numRates && |
| 1855 | ((temp_rate_set.numRates + ext_rate_set->numRates) > 12) && |
| 1856 | temp_rate_set.numRates < 12) { |
| 1857 | int found = 0; |
| 1858 | int tail = temp_rate_set.numRates; |
| 1859 | |
| 1860 | for (i = 0; (i < ext_rate_set->numRates && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1861 | i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | found = 0; |
| 1863 | for (j = 0; j < (uint32_t) tail; j++) { |
| 1864 | if ((temp_rate_set.rate[j] & 0x7F) == |
| 1865 | (ext_rate_set->rate[i] & 0x7F)) { |
| 1866 | found = 1; |
| 1867 | break; |
| 1868 | } |
| 1869 | } |
| 1870 | |
| 1871 | if (!found) { |
| 1872 | temp_rate_set.rate[temp_rate_set.numRates++] = |
| 1873 | ext_rate_set->rate[i]; |
| 1874 | if (temp_rate_set.numRates >= 12) |
| 1875 | break; |
| 1876 | } |
| 1877 | } |
| 1878 | } else if (ext_rate_set->numRates && |
| 1879 | ((temp_rate_set.numRates + ext_rate_set->numRates) <= 12)) { |
| 1880 | for (j = 0; ((j < ext_rate_set->numRates) && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1881 | (j < WLAN_SUPPORTED_RATES_IE_MAX_LEN) && |
| 1882 | ((i + j) < WLAN_SUPPORTED_RATES_IE_MAX_LEN)); j++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | temp_rate_set.rate[i + j] = ext_rate_set->rate[j]; |
| 1884 | |
| 1885 | temp_rate_set.numRates += ext_rate_set->numRates; |
| 1886 | } else if (ext_rate_set->numRates) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1887 | pe_debug("Relying only on the SUPPORTED Rate Set IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | } |
| 1889 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1890 | rates = &sta_ds->supportedRates; |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 1891 | qdf_mem_zero(rates, sizeof(*rates)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1892 | for (i = 0; (i < temp_rate_set2.numRates && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1893 | i < WLAN_SUPPORTED_RATES_IE_MAX_LEN); i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1894 | for (j = 0; (j < temp_rate_set.numRates && |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 1895 | j < WLAN_SUPPORTED_RATES_IE_MAX_LEN); j++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1896 | if ((temp_rate_set2.rate[i] & 0x7F) != |
| 1897 | (temp_rate_set.rate[j] & 0x7F)) |
| 1898 | continue; |
| 1899 | |
| 1900 | if (sirIsArate(temp_rate_set2.rate[i] & 0x7f) && |
| 1901 | a_rate_index < SIR_NUM_11A_RATES) { |
| 1902 | is_arate = 1; |
| 1903 | rates->llaRates[a_rate_index++] = |
| 1904 | temp_rate_set2.rate[i]; |
| 1905 | } else if ((b_rate_index < SIR_NUM_11B_RATES) && |
| 1906 | !(sirIsArate(temp_rate_set2.rate[i] & 0x7f))) { |
| 1907 | rates->llbRates[b_rate_index++] = |
| 1908 | temp_rate_set2.rate[i]; |
| 1909 | } |
| 1910 | break; |
| 1911 | } |
| 1912 | } |
| 1913 | |
| 1914 | /* |
| 1915 | * Now add the Polaris rates only when Proprietary rates are enabled. |
| 1916 | * compute the matching MCS rate set, if peer is 11n capable and self |
| 1917 | * mode is 11n |
| 1918 | */ |
| 1919 | #ifdef FEATURE_WLAN_TDLS |
| 1920 | if (sta_ds->mlmStaContext.htCapability) |
| 1921 | #else |
| 1922 | if (IS_DOT11_MODE_HT(session_entry->dot11mode) && |
| 1923 | (sta_ds->mlmStaContext.htCapability)) |
| 1924 | #endif |
| 1925 | { |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1926 | val_len = SIZE_OF_SUPPORTED_MCS_SET; |
| 1927 | if (wlan_mlme_get_cfg_str( |
| 1928 | mcs_set, |
| 1929 | &mac_ctx->mlme_cfg->rates.supported_mcs_set, |
| 1930 | &val_len) != QDF_STATUS_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 1931 | pe_err("could not retrieve supportedMCSet"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1932 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1933 | } |
| 1934 | |
Arif Hussain | 74fc571 | 2016-07-20 11:10:01 -0700 | [diff] [blame] | 1935 | if (session_entry->nss == NSS_1x1_MODE) |
Kiran Kumar Lokere | 666bf85 | 2016-05-02 12:23:02 -0700 | [diff] [blame] | 1936 | mcs_set[1] = 0; |
| 1937 | |
Karthik Kantamneni | e3bbd7f | 2018-09-19 20:27:32 +0530 | [diff] [blame] | 1938 | for (i = 0; i < val_len; i++) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1939 | sta_ds->supportedRates.supportedMCSSet[i] = |
| 1940 | mcs_set[i] & supported_mcs_set[i]; |
| 1941 | |
Abhishek Singh | 3be6fab | 2020-02-06 12:28:33 +0530 | [diff] [blame] | 1942 | lim_dump_ht_mcs_mask(mcs_set, |
| 1943 | sta_ds->supportedRates.supportedMCSSet); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1945 | lim_populate_vht_mcs_set(mac_ctx, &sta_ds->supportedRates, vht_caps, |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 1946 | session_entry, session_entry->nss, sta_ds); |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 1947 | lim_populate_he_mcs_set(mac_ctx, &sta_ds->supportedRates, he_caps, |
| 1948 | session_entry, session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | /* |
| 1950 | * Set the erpEnabled bit if the phy is in G mode and at least |
| 1951 | * one A rate is supported |
| 1952 | */ |
| 1953 | if ((phy_mode == WNI_CFG_PHY_MODE_11G) && is_arate) |
| 1954 | sta_ds->erpEnabled = eHAL_SET; |
| 1955 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 1956 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1957 | } |
| 1958 | |
| 1959 | /** |
| 1960 | * lim_populate_vht_caps() - populates vht capabilities based on input |
| 1961 | * capabilities |
| 1962 | * @input_caps: input capabilities based on which we format the vht |
| 1963 | * capabilities |
| 1964 | * |
| 1965 | * function to populate the supported vht capabilities. |
| 1966 | * |
| 1967 | * Return: vht capabilities derived based on input parameters. |
| 1968 | */ |
| 1969 | static uint32_t lim_populate_vht_caps(tDot11fIEVHTCaps input_caps) |
| 1970 | { |
| 1971 | uint32_t vht_caps; |
| 1972 | |
| 1973 | vht_caps = ((input_caps.maxMPDULen << SIR_MAC_VHT_CAP_MAX_MPDU_LEN) | |
| 1974 | (input_caps.supportedChannelWidthSet << |
| 1975 | SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET) | |
| 1976 | (input_caps.ldpcCodingCap << |
| 1977 | SIR_MAC_VHT_CAP_LDPC_CODING_CAP) | |
| 1978 | (input_caps.shortGI80MHz << |
| 1979 | SIR_MAC_VHT_CAP_SHORTGI_80MHZ) | |
| 1980 | (input_caps.shortGI160and80plus80MHz << |
| 1981 | SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ) | |
| 1982 | (input_caps.txSTBC << SIR_MAC_VHT_CAP_TXSTBC) | |
| 1983 | (input_caps.rxSTBC << SIR_MAC_VHT_CAP_RXSTBC) | |
| 1984 | (input_caps.suBeamFormerCap << |
| 1985 | SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP) | |
| 1986 | (input_caps.suBeamformeeCap << |
| 1987 | SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP) | |
| 1988 | (input_caps.csnofBeamformerAntSup << |
| 1989 | SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP) | |
| 1990 | (input_caps.numSoundingDim << |
| 1991 | SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM) | |
| 1992 | (input_caps.muBeamformerCap << |
| 1993 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP) | |
| 1994 | (input_caps.muBeamformeeCap << |
| 1995 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP) | |
| 1996 | (input_caps.vhtTXOPPS << |
| 1997 | SIR_MAC_VHT_CAP_TXOPPS) | |
| 1998 | (input_caps.htcVHTCap << |
| 1999 | SIR_MAC_VHT_CAP_HTC_CAP) | |
| 2000 | (input_caps.maxAMPDULenExp << |
| 2001 | SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO) | |
| 2002 | (input_caps.vhtLinkAdaptCap << |
| 2003 | SIR_MAC_VHT_CAP_LINK_ADAPT_CAP) | |
| 2004 | (input_caps.rxAntPattern << |
| 2005 | SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN) | |
| 2006 | (input_caps.txAntPattern << |
| 2007 | SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN) | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 2008 | (input_caps.extended_nss_bw_supp << |
| 2009 | SIR_MAC_VHT_CAP_EXTD_NSS_BW)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | |
| 2011 | return vht_caps; |
| 2012 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2013 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | /** |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 2015 | * lim_update_he_stbc_capable() - Update stbc capable flag based on |
| 2016 | * HE capability |
| 2017 | * @add_sta_params: add sta related parameters |
| 2018 | * |
| 2019 | * Update stbc cpable flag based on HE capability |
| 2020 | * |
| 2021 | * Return: None |
| 2022 | */ |
| 2023 | #ifdef WLAN_FEATURE_11AX |
| 2024 | static void lim_update_he_stbc_capable(tpAddStaParams add_sta_params) |
| 2025 | { |
| 2026 | if (add_sta_params && |
| 2027 | add_sta_params->he_capable && |
| 2028 | add_sta_params->stbc_capable) |
| 2029 | add_sta_params->stbc_capable = |
| 2030 | add_sta_params->he_config.rx_stbc_lt_80mhz; |
| 2031 | } |
| 2032 | #else |
| 2033 | static void lim_update_he_stbc_capable(tpAddStaParams add_sta_params) |
| 2034 | {} |
| 2035 | #endif |
| 2036 | |
| 2037 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2038 | * lim_add_sta()- called to add an STA context at hardware |
| 2039 | * @mac_ctx: pointer to global mac structure |
| 2040 | * @sta_ds: station node |
| 2041 | * @update_entry: set to true for updating the entry |
| 2042 | * @session_entry: pe session entry |
| 2043 | * |
| 2044 | * This function is called to add an STA context at hardware |
| 2045 | * whenever a STA is (Re) Associated. |
| 2046 | * |
Jeff Johnson | d9e0351 | 2018-06-29 12:04:03 -0700 | [diff] [blame] | 2047 | * Return: QDF_STATUS_SUCCESS on success else QDF_STATUS failure codes |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2048 | */ |
| 2049 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2050 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2051 | lim_add_sta(struct mac_context *mac_ctx, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 2052 | tpDphHashNode sta_ds, uint8_t update_entry, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | { |
| 2054 | tpAddStaParams add_sta_params = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2055 | struct scheduler_msg msg_q = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2056 | QDF_STATUS ret_code = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2057 | tSirMacAddr sta_mac, *sta_Addr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2058 | tpSirAssocReq assoc_req; |
Kiran Kumar Lokere | 80d3e1a | 2017-05-26 15:15:13 -0700 | [diff] [blame] | 2059 | uint8_t i, nw_type_11b = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2060 | tLimIbssPeerNode *peer_node; /* for IBSS mode */ |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 2061 | const uint8_t *p2p_ie = NULL; |
Tushnim Bhattacharyya | 2d693b9 | 2018-09-19 13:19:24 -0700 | [diff] [blame] | 2062 | tDot11fIEVHTCaps vht_caps; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 2063 | struct mlme_vht_capabilities_info *vht_cap_info; |
| 2064 | |
| 2065 | vht_cap_info = &mac_ctx->mlme_cfg->vht_caps.vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2067 | sir_copy_mac_addr(sta_mac, session_entry->self_mac_addr); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2068 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2069 | pe_debug("sessionid: %d update_entry = %d limsystemrole = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2070 | session_entry->smeSessionId, update_entry, |
| 2071 | GET_LIM_SYSTEM_ROLE(session_entry)); |
| 2072 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2073 | add_sta_params = qdf_mem_malloc(sizeof(tAddStaParams)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2074 | if (!add_sta_params) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2075 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2076 | |
Naveen Rawat | cb186cf | 2016-07-11 13:47:19 -0700 | [diff] [blame] | 2077 | if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry) || |
| 2078 | LIM_IS_NDI_ROLE(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2079 | sta_Addr = &sta_ds->staAddr; |
| 2080 | #ifdef FEATURE_WLAN_TDLS |
| 2081 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2082 | else if (STA_ENTRY_TDLS_PEER == sta_ds->staType) |
| 2083 | sta_Addr = &sta_ds->staAddr; |
| 2084 | #endif |
| 2085 | else |
| 2086 | sta_Addr = &sta_mac; |
| 2087 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2088 | pe_debug(QDF_MAC_ADDR_FMT ": Subtype(Assoc/Reassoc): %d", |
| 2089 | QDF_MAC_ADDR_REF(*sta_Addr), sta_ds->mlmStaContext.subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2091 | qdf_mem_copy((uint8_t *) add_sta_params->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2092 | (uint8_t *) *sta_Addr, sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2093 | qdf_mem_copy((uint8_t *) add_sta_params->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2094 | session_entry->bssId, sizeof(tSirMacAddr)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2095 | qdf_mem_copy(&add_sta_params->capab_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | &sta_ds->mlmStaContext.capabilityInfo, |
| 2097 | sizeof(add_sta_params->capab_info)); |
| 2098 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2099 | /* Copy legacy rates */ |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 2100 | qdf_mem_copy(&add_sta_params->supportedRates, |
| 2101 | &sta_ds->supportedRates, |
| 2102 | sizeof(sta_ds->supportedRates)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2103 | |
| 2104 | add_sta_params->assocId = sta_ds->assocId; |
| 2105 | |
| 2106 | add_sta_params->wmmEnabled = sta_ds->qosMode; |
| 2107 | add_sta_params->listenInterval = sta_ds->mlmStaContext.listenInterval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | if (LIM_IS_AP_ROLE(session_entry) && |
| 2109 | (sta_ds->mlmStaContext.subType == LIM_REASSOC)) { |
| 2110 | /* |
| 2111 | * TBD - need to remove this REASSOC check |
| 2112 | * after fixinf rmmod issue |
| 2113 | */ |
| 2114 | add_sta_params->updateSta = sta_ds->mlmStaContext.updateContext; |
| 2115 | } |
| 2116 | sta_ds->valid = 0; |
| 2117 | sta_ds->mlmStaContext.mlmState = eLIM_MLM_WT_ADD_STA_RSP_STATE; |
| 2118 | |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2119 | pe_debug("Assoc ID: %d wmmEnabled: %d listenInterval: %d", |
| 2120 | add_sta_params->assocId, add_sta_params->wmmEnabled, |
| 2121 | add_sta_params->listenInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2122 | add_sta_params->staType = sta_ds->staType; |
| 2123 | |
| 2124 | add_sta_params->updateSta = update_entry; |
| 2125 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2126 | add_sta_params->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2127 | |
Abhishek Singh | a91d619 | 2017-08-16 17:24:17 +0530 | [diff] [blame] | 2128 | /* Update VHT/HT Capability */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2129 | if (LIM_IS_AP_ROLE(session_entry) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2130 | LIM_IS_IBSS_ROLE(session_entry)) { |
| 2131 | add_sta_params->htCapable = sta_ds->mlmStaContext.htCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2132 | add_sta_params->vhtCapable = |
| 2133 | sta_ds->mlmStaContext.vhtCapability; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2134 | } |
Abhishek Singh | a91d619 | 2017-08-16 17:24:17 +0530 | [diff] [blame] | 2135 | #ifdef FEATURE_WLAN_TDLS |
| 2136 | /* SystemRole shouldn't be matter if staType is TDLS peer */ |
| 2137 | else if (STA_ENTRY_TDLS_PEER == sta_ds->staType) { |
| 2138 | add_sta_params->htCapable = sta_ds->mlmStaContext.htCapability; |
| 2139 | add_sta_params->vhtCapable = |
| 2140 | sta_ds->mlmStaContext.vhtCapability; |
| 2141 | } |
| 2142 | #endif |
| 2143 | else { |
| 2144 | add_sta_params->htCapable = session_entry->htCapability; |
| 2145 | add_sta_params->vhtCapable = session_entry->vhtCapability; |
| 2146 | } |
| 2147 | |
Yeshwanth Sriram Guntuka | 3f26210 | 2019-07-16 15:41:08 +0530 | [diff] [blame] | 2148 | pe_debug("updateSta: %d htcapable: %d vhtCapable: %d sta mac" |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2149 | QDF_MAC_ADDR_FMT, add_sta_params->updateSta, |
Yeshwanth Sriram Guntuka | 3f26210 | 2019-07-16 15:41:08 +0530 | [diff] [blame] | 2150 | add_sta_params->htCapable, add_sta_params->vhtCapable, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2151 | QDF_MAC_ADDR_REF(add_sta_params->staMac)); |
Abhishek Singh | a91d619 | 2017-08-16 17:24:17 +0530 | [diff] [blame] | 2152 | |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2153 | /* |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 2154 | * If HT client is connected to SAP DUT and self cap is NSS = 2 then |
| 2155 | * disable ASYNC DBS scan by sending WMI_VDEV_PARAM_SMPS_INTOLERANT |
| 2156 | * to FW, because HT client's can't drop down chain using SMPS frames. |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2157 | */ |
| 2158 | if (!policy_mgr_is_hw_dbs_2x2_capable(mac_ctx->psoc) && |
| 2159 | LIM_IS_AP_ROLE(session_entry) && |
| 2160 | (STA_ENTRY_PEER == sta_ds->staType) && |
| 2161 | !add_sta_params->vhtCapable && |
| 2162 | (session_entry->nss == 2)) { |
| 2163 | session_entry->ht_client_cnt++; |
Naveen Rawat | 903acca | 2017-09-15 17:32:13 -0700 | [diff] [blame] | 2164 | if (session_entry->ht_client_cnt == 1) { |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2165 | pe_debug("setting SMPS intolrent vdev_param"); |
| 2166 | wma_cli_set_command(session_entry->smeSessionId, |
| 2167 | (int)WMI_VDEV_PARAM_SMPS_INTOLERANT, |
| 2168 | 1, VDEV_CMD); |
| 2169 | } |
| 2170 | } |
| 2171 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2172 | lim_update_sta_he_capable(mac_ctx, add_sta_params, sta_ds, |
| 2173 | session_entry); |
| 2174 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2175 | add_sta_params->maxAmpduDensity = sta_ds->htAMpduDensity; |
| 2176 | add_sta_params->maxAmpduSize = sta_ds->htMaxRxAMpduFactor; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | add_sta_params->fShortGI20Mhz = sta_ds->htShortGI20Mhz; |
| 2178 | add_sta_params->fShortGI40Mhz = sta_ds->htShortGI40Mhz; |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 2179 | add_sta_params->ch_width = sta_ds->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2180 | add_sta_params->mimoPS = sta_ds->htMIMOPSState; |
| 2181 | |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2182 | pe_debug("maxAmpduDensity: %d maxAmpduDensity: %d", |
| 2183 | add_sta_params->maxAmpduDensity, add_sta_params->maxAmpduSize); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2184 | |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2185 | pe_debug("fShortGI20Mhz: %d fShortGI40Mhz: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2186 | add_sta_params->fShortGI20Mhz, add_sta_params->fShortGI40Mhz); |
| 2187 | |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2188 | pe_debug("txChannelWidth: %d mimoPS: %d", add_sta_params->ch_width, |
| 2189 | add_sta_params->mimoPS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2190 | |
| 2191 | if (add_sta_params->vhtCapable) { |
| 2192 | if (sta_ds->vhtSupportedChannelWidthSet) |
| 2193 | add_sta_params->ch_width = |
| 2194 | sta_ds->vhtSupportedChannelWidthSet + 1; |
| 2195 | |
| 2196 | add_sta_params->vhtSupportedRxNss = sta_ds->vhtSupportedRxNss; |
Kiran Kumar Lokere | f1f5e99 | 2016-06-20 16:48:50 -0700 | [diff] [blame] | 2197 | if (LIM_IS_AP_ROLE(session_entry) || |
| 2198 | LIM_IS_P2P_DEVICE_GO(session_entry)) |
| 2199 | add_sta_params->vhtSupportedRxNss = QDF_MIN( |
| 2200 | add_sta_params->vhtSupportedRxNss, |
| 2201 | session_entry->nss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2202 | add_sta_params->vhtTxBFCapable = |
| 2203 | #ifdef FEATURE_WLAN_TDLS |
| 2204 | ((STA_ENTRY_PEER == sta_ds->staType) |
| 2205 | || (STA_ENTRY_TDLS_PEER == sta_ds->staType)) ? |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2206 | sta_ds->vhtBeamFormerCapable : |
| 2207 | session_entry->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2208 | #else |
| 2209 | (STA_ENTRY_PEER == sta_ds->staType) ? |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2210 | sta_ds->vhtBeamFormerCapable : |
| 2211 | session_entry->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2212 | #endif |
| 2213 | add_sta_params->enable_su_tx_bformer = |
| 2214 | sta_ds->vht_su_bfee_capable; |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 2215 | add_sta_params->vht_mcs_10_11_supp = |
| 2216 | sta_ds->vht_mcs_10_11_supp; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2217 | } |
| 2218 | |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 2219 | pe_debug("TxChWidth %d vhtTxBFCap %d, su_bfer %d, vht_mcs11 %d", |
| 2220 | add_sta_params->ch_width, add_sta_params->vhtTxBFCapable, |
| 2221 | add_sta_params->enable_su_tx_bformer, |
| 2222 | add_sta_params->vht_mcs_10_11_supp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2223 | #ifdef FEATURE_WLAN_TDLS |
| 2224 | if ((STA_ENTRY_PEER == sta_ds->staType) || |
| 2225 | (STA_ENTRY_TDLS_PEER == sta_ds->staType)) |
| 2226 | #else |
| 2227 | if (STA_ENTRY_PEER == sta_ds->staType) |
| 2228 | #endif |
| 2229 | { |
| 2230 | /* |
| 2231 | * peer STA get the LDPC capability from sta_ds, |
| 2232 | * which populated from |
| 2233 | * HT/VHT capability |
| 2234 | */ |
| 2235 | if (add_sta_params->vhtTxBFCapable |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 2236 | && vht_cap_info->disable_ldpc_with_txbf_ap) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2237 | add_sta_params->htLdpcCapable = 0; |
| 2238 | add_sta_params->vhtLdpcCapable = 0; |
| 2239 | } else { |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 2240 | if (session_entry->txLdpcIniFeatureEnabled & 0x1) |
| 2241 | add_sta_params->htLdpcCapable = |
| 2242 | sta_ds->htLdpcCapable; |
| 2243 | else |
| 2244 | add_sta_params->htLdpcCapable = 0; |
| 2245 | |
| 2246 | if (session_entry->txLdpcIniFeatureEnabled & 0x2) |
| 2247 | add_sta_params->vhtLdpcCapable = |
| 2248 | sta_ds->vhtLdpcCapable; |
| 2249 | else |
| 2250 | add_sta_params->vhtLdpcCapable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2251 | } |
| 2252 | } else if (STA_ENTRY_SELF == sta_ds->staType) { |
| 2253 | /* For Self STA get the LDPC capability from config.ini */ |
| 2254 | add_sta_params->htLdpcCapable = |
| 2255 | (session_entry->txLdpcIniFeatureEnabled & 0x01); |
| 2256 | add_sta_params->vhtLdpcCapable = |
| 2257 | ((session_entry->txLdpcIniFeatureEnabled >> 1) & 0x01); |
| 2258 | } |
| 2259 | |
| 2260 | /* Update PE session ID */ |
| 2261 | add_sta_params->sessionId = session_entry->peSessionId; |
| 2262 | |
| 2263 | /* Update SME session ID */ |
| 2264 | add_sta_params->smesessionId = session_entry->smeSessionId; |
| 2265 | |
| 2266 | add_sta_params->maxTxPower = session_entry->maxTxPower; |
| 2267 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2268 | if (session_entry->parsedAssocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2269 | uint16_t aid = sta_ds->assocId; |
| 2270 | /* Get a copy of the already parsed Assoc Request */ |
| 2271 | assoc_req = |
| 2272 | (tpSirAssocReq) session_entry->parsedAssocReq[aid]; |
| 2273 | if (assoc_req && assoc_req->addIEPresent |
| 2274 | && assoc_req->addIE.length) { |
| 2275 | p2p_ie = limGetP2pIEPtr(mac_ctx, |
| 2276 | assoc_req->addIE.addIEdata, |
| 2277 | assoc_req->addIE.length); |
| 2278 | } |
| 2279 | |
| 2280 | add_sta_params->p2pCapableSta = (p2p_ie != NULL); |
| 2281 | if (assoc_req && add_sta_params->htCapable) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2282 | qdf_mem_copy(&add_sta_params->ht_caps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2283 | ((uint8_t *) &assoc_req->HTCaps) + 1, |
| 2284 | sizeof(add_sta_params->ht_caps)); |
| 2285 | } |
| 2286 | |
Tushnim Bhattacharyya | 2d693b9 | 2018-09-19 13:19:24 -0700 | [diff] [blame] | 2287 | if (assoc_req && add_sta_params->vhtCapable) { |
| 2288 | if (assoc_req->vendor_vht_ie.VHTCaps.present) |
| 2289 | vht_caps = assoc_req->vendor_vht_ie.VHTCaps; |
| 2290 | else |
| 2291 | vht_caps = assoc_req->VHTCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2292 | add_sta_params->vht_caps = |
Tushnim Bhattacharyya | 2d693b9 | 2018-09-19 13:19:24 -0700 | [diff] [blame] | 2293 | lim_populate_vht_caps(vht_caps); |
| 2294 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2295 | |
Amruta Kulkarni | 4edc97d | 2019-12-18 16:13:07 -0800 | [diff] [blame] | 2296 | lim_add_he_cap(mac_ctx, session_entry, |
| 2297 | add_sta_params, assoc_req); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2298 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2299 | } else if (LIM_IS_IBSS_ROLE(session_entry)) { |
| 2300 | |
| 2301 | /* |
| 2302 | * in IBSS mode, use peer node as the source of ht_caps |
| 2303 | * and vht_caps |
| 2304 | */ |
| 2305 | peer_node = lim_ibss_peer_find(mac_ctx, *sta_Addr); |
| 2306 | if (!peer_node) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2307 | pe_err("Can't find IBSS peer node for ADD_STA"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2308 | return QDF_STATUS_E_NOENT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | } |
| 2310 | |
| 2311 | if (peer_node->atimIePresent) { |
| 2312 | add_sta_params->atimIePresent = |
| 2313 | peer_node->atimIePresent; |
| 2314 | add_sta_params->peerAtimWindowLength = |
| 2315 | peer_node->peerAtimWindowLength; |
| 2316 | } |
| 2317 | |
| 2318 | add_sta_params->ht_caps = |
| 2319 | (peer_node->htSupportedChannelWidthSet << |
| 2320 | SIR_MAC_HT_CAP_CHWIDTH40_S) | |
| 2321 | (peer_node->htGreenfield << |
| 2322 | SIR_MAC_HT_CAP_GREENFIELD_S) | |
| 2323 | (peer_node->htShortGI20Mhz << |
| 2324 | SIR_MAC_HT_CAP_SHORTGI20MHZ_S) | |
| 2325 | (peer_node->htShortGI40Mhz << |
| 2326 | SIR_MAC_HT_CAP_SHORTGI40MHZ_S) | |
| 2327 | (SIR_MAC_TXSTBC << |
| 2328 | SIR_MAC_HT_CAP_TXSTBC_S) | |
| 2329 | (SIR_MAC_RXSTBC << |
| 2330 | SIR_MAC_HT_CAP_RXSTBC_S) | |
| 2331 | (peer_node->htMaxAmsduLength << |
| 2332 | SIR_MAC_HT_CAP_MAXAMSDUSIZE_S) | |
| 2333 | (peer_node->htDsssCckRate40MHzSupport << |
| 2334 | SIR_MAC_HT_CAP_DSSSCCK40_S); |
| 2335 | |
| 2336 | add_sta_params->vht_caps = |
| 2337 | lim_populate_vht_caps(peer_node->VHTCaps); |
| 2338 | } |
| 2339 | #ifdef FEATURE_WLAN_TDLS |
| 2340 | if (STA_ENTRY_TDLS_PEER == sta_ds->staType) { |
| 2341 | add_sta_params->ht_caps = sta_ds->ht_caps; |
| 2342 | add_sta_params->vht_caps = sta_ds->vht_caps; |
hangtian | d152e8d | 2019-02-23 11:28:23 +0800 | [diff] [blame] | 2343 | if (add_sta_params->vhtCapable) { |
| 2344 | add_sta_params->maxAmpduSize = |
| 2345 | SIR_MAC_GET_VHT_MAX_AMPDU_EXPO( |
| 2346 | sta_ds->vht_caps); |
| 2347 | } |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2348 | pe_debug("Sta type is TDLS_PEER, ht_caps: 0x%x, vht_caps: 0x%x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2349 | add_sta_params->ht_caps, |
| 2350 | add_sta_params->vht_caps); |
| 2351 | } |
| 2352 | #endif |
| 2353 | |
| 2354 | #ifdef FEATURE_WLAN_TDLS |
| 2355 | if (sta_ds->wmeEnabled && |
| 2356 | (LIM_IS_AP_ROLE(session_entry) || |
| 2357 | (STA_ENTRY_TDLS_PEER == sta_ds->staType))) |
| 2358 | #else |
| 2359 | if (sta_ds->wmeEnabled && LIM_IS_AP_ROLE(session_entry)) |
| 2360 | #endif |
| 2361 | { |
| 2362 | add_sta_params->uAPSD = 0; |
| 2363 | /* |
| 2364 | * update UAPSD and send it to LIM to add STA |
| 2365 | * bitmap MSB <- LSB MSB 4 bits are for |
| 2366 | * trigger enabled AC setting and LSB 4 bits |
| 2367 | * are for delivery enabled AC setting |
| 2368 | * 7 6 5 4 3 2 1 0 |
| 2369 | * BE BK VI VO BE BK VI VO |
| 2370 | */ |
| 2371 | add_sta_params->uAPSD |= |
| 2372 | sta_ds->qos.capability.qosInfo.acvo_uapsd; |
| 2373 | add_sta_params->uAPSD |= |
| 2374 | (sta_ds->qos.capability.qosInfo.acvi_uapsd << 1); |
| 2375 | add_sta_params->uAPSD |= |
| 2376 | (sta_ds->qos.capability.qosInfo.acbk_uapsd << 2); |
| 2377 | add_sta_params->uAPSD |= |
| 2378 | (sta_ds->qos.capability.qosInfo.acbe_uapsd << 3); |
| 2379 | /* |
| 2380 | * making delivery enabled and |
| 2381 | * trigger enabled setting the same. |
| 2382 | */ |
| 2383 | add_sta_params->uAPSD |= add_sta_params->uAPSD << 4; |
| 2384 | |
| 2385 | add_sta_params->maxSPLen = |
| 2386 | sta_ds->qos.capability.qosInfo.maxSpLen; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2387 | pe_debug("uAPSD = 0x%x, maxSpLen = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2388 | add_sta_params->uAPSD, add_sta_params->maxSPLen); |
| 2389 | } |
| 2390 | #ifdef WLAN_FEATURE_11W |
| 2391 | add_sta_params->rmfEnabled = sta_ds->rmfEnabled; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2392 | pe_debug("PMF enabled %d", add_sta_params->rmfEnabled); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2393 | #endif |
| 2394 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2395 | pe_debug("htLdpcCapable: %d vhtLdpcCapable: %d " |
| 2396 | "p2pCapableSta: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2397 | add_sta_params->htLdpcCapable, add_sta_params->vhtLdpcCapable, |
| 2398 | add_sta_params->p2pCapableSta); |
| 2399 | |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 2400 | if (!add_sta_params->htLdpcCapable) |
| 2401 | add_sta_params->ht_caps &= ~(1 << SIR_MAC_HT_CAP_ADVCODING_S); |
| 2402 | if (!add_sta_params->vhtLdpcCapable) |
| 2403 | add_sta_params->vht_caps &= |
| 2404 | ~(1 << SIR_MAC_VHT_CAP_LDPC_CODING_CAP); |
| 2405 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | /* |
| 2407 | * we need to defer the message until we get the |
| 2408 | * response back from HAL. |
| 2409 | */ |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2410 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2411 | |
yeshwanth sriram guntuka | 47f26e6 | 2017-03-07 12:43:02 +0530 | [diff] [blame] | 2412 | add_sta_params->nwType = session_entry->nwType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2413 | |
Kiran Kumar Lokere | 80d3e1a | 2017-05-26 15:15:13 -0700 | [diff] [blame] | 2414 | if (!(add_sta_params->htCapable || add_sta_params->vhtCapable)) { |
| 2415 | nw_type_11b = 1; |
| 2416 | for (i = 0; i < SIR_NUM_11A_RATES; i++) { |
| 2417 | if (sirIsArate(sta_ds->supportedRates.llaRates[i] & |
| 2418 | 0x7F)) { |
| 2419 | nw_type_11b = 0; |
| 2420 | break; |
| 2421 | } |
| 2422 | } |
| 2423 | if (nw_type_11b) |
| 2424 | add_sta_params->nwType = eSIR_11B_NW_TYPE; |
| 2425 | } |
| 2426 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 2427 | if (add_sta_params->htCapable && session_entry->ht_config.ht_tx_stbc) { |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 2428 | struct sDot11fIEHTCaps *ht_caps = (struct sDot11fIEHTCaps *) |
| 2429 | &add_sta_params->ht_caps; |
| 2430 | if (ht_caps->rxSTBC) |
| 2431 | add_sta_params->stbc_capable = 1; |
| 2432 | else |
| 2433 | add_sta_params->stbc_capable = 0; |
| 2434 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2435 | |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 2436 | if (add_sta_params->vhtCapable && add_sta_params->stbc_capable) { |
| 2437 | struct sDot11fIEVHTCaps *vht_caps = (struct sDot11fIEVHTCaps *) |
| 2438 | &add_sta_params->vht_caps; |
| 2439 | if (vht_caps->rxSTBC) |
| 2440 | add_sta_params->stbc_capable = 1; |
| 2441 | else |
| 2442 | add_sta_params->stbc_capable = 0; |
| 2443 | } |
| 2444 | |
Abhishek Ambure | a7f1c22 | 2019-11-27 19:54:26 +0530 | [diff] [blame] | 2445 | if (session_entry->opmode == QDF_SAP_MODE || |
| 2446 | session_entry->opmode == QDF_P2P_GO_MODE) { |
| 2447 | if (session_entry->parsedAssocReq) { |
| 2448 | uint16_t aid = sta_ds->assocId; |
| 2449 | /* Get a copy of the already parsed Assoc Request */ |
| 2450 | assoc_req = |
| 2451 | (tpSirAssocReq) session_entry->parsedAssocReq[aid]; |
| 2452 | |
android-t1 | 08a9ce0 | 2022-11-01 09:57:42 +0800 | [diff] [blame] | 2453 | if (assoc_req) { |
| 2454 | add_sta_params->wpa_rsn = assoc_req->rsnPresent; |
| 2455 | add_sta_params->wpa_rsn |= |
| 2456 | (assoc_req->wpaPresent << 1); |
| 2457 | } |
Abhishek Ambure | a7f1c22 | 2019-11-27 19:54:26 +0530 | [diff] [blame] | 2458 | } |
| 2459 | } |
| 2460 | |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 2461 | lim_update_he_stbc_capable(add_sta_params); |
| 2462 | |
| 2463 | msg_q.type = WMA_ADD_STA_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2464 | msg_q.reserved = 0; |
| 2465 | msg_q.bodyptr = add_sta_params; |
| 2466 | msg_q.bodyval = 0; |
| 2467 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2468 | pe_debug("Sending WMA_ADD_STA_REQ for assocId %d", sta_ds->assocId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2469 | MTRACE(mac_trace_msg_tx(mac_ctx, session_entry->peSessionId, |
| 2470 | msg_q.type)); |
| 2471 | |
| 2472 | ret_code = wma_post_ctrl_msg(mac_ctx, &msg_q); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2473 | if (QDF_STATUS_SUCCESS != ret_code) { |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2474 | SET_LIM_PROCESS_DEFD_MESGS(mac_ctx, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2475 | pe_err("ADD_STA_REQ for aId %d failed (reason %X)", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2476 | sta_ds->assocId, ret_code); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2477 | qdf_mem_free(add_sta_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2478 | } |
| 2479 | |
| 2480 | return ret_code; |
| 2481 | } |
| 2482 | |
| 2483 | /** |
| 2484 | * lim_del_sta() |
| 2485 | * |
| 2486 | ***FUNCTION: |
| 2487 | * This function is called to delete an STA context at hardware |
| 2488 | * whenever a STA is disassociated |
| 2489 | * |
| 2490 | ***LOGIC: |
| 2491 | * |
| 2492 | ***ASSUMPTIONS: |
| 2493 | * NA |
| 2494 | * |
| 2495 | ***NOTE: |
| 2496 | * NA |
| 2497 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2498 | * @param mac - Pointer to Global MAC structure |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2499 | * @param sta - Pointer to the STA datastructure created by |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2500 | * LIM and maintained by DPH |
| 2501 | * @param fRespReqd - flag to indicate whether the delete is synchronous (true) |
| 2502 | * or not (false) |
| 2503 | * @return retCode - Indicates success or failure return code |
| 2504 | */ |
| 2505 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2506 | QDF_STATUS |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2507 | lim_del_sta(struct mac_context *mac, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2508 | tpDphHashNode sta, bool fRespReqd, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | { |
| 2510 | tpDeleteStaParams pDelStaParams = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2511 | struct scheduler_msg msgQ = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2512 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2513 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2514 | pDelStaParams = qdf_mem_malloc(sizeof(tDeleteStaParams)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2515 | if (!pDelStaParams) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2516 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2517 | |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2518 | /* |
| 2519 | * 2G-AS platform: SAP associates with HT (11n)clients as 2x1 in 2G and |
| 2520 | * 2X2 in 5G |
| 2521 | * Non-2G-AS platform: SAP associates with HT (11n) clients as 2X2 in 2G |
| 2522 | * and 5G; and enable async dbs scan when all HT clients are gone |
| 2523 | * 5G-AS: Don't care |
| 2524 | */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2525 | if (!policy_mgr_is_hw_dbs_2x2_capable(mac->psoc) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2526 | LIM_IS_AP_ROLE(pe_session) && |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2527 | (sta->staType == STA_ENTRY_PEER) && |
| 2528 | !sta->mlmStaContext.vhtCapability && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2529 | (pe_session->nss == 2)) { |
| 2530 | pe_session->ht_client_cnt--; |
| 2531 | if (pe_session->ht_client_cnt == 0) { |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2532 | pe_debug("clearing SMPS intolrent vdev_param"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2533 | wma_cli_set_command(pe_session->smeSessionId, |
Tushnim Bhattacharyya | 3d17def | 2017-06-19 11:13:43 -0700 | [diff] [blame] | 2534 | (int)WMI_VDEV_PARAM_SMPS_INTOLERANT, |
| 2535 | 0, VDEV_CMD); |
| 2536 | } |
| 2537 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2539 | pDelStaParams->assocId = sta->assocId; |
| 2540 | sta->valid = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2541 | |
| 2542 | if (!fRespReqd) |
| 2543 | pDelStaParams->respReqd = 0; |
| 2544 | else { |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2545 | if (!(IS_TDLS_PEER(sta->staType))) { |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2546 | /* when lim_del_sta is called from processSmeAssocCnf |
| 2547 | * then mlmState is already set properly. */ |
| 2548 | if (eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE != |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2549 | GET_LIM_STA_CONTEXT_MLM_STATE(sta)) { |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2550 | MTRACE(mac_trace |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2551 | (mac, TRACE_CODE_MLM_STATE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2552 | pe_session->peSessionId, |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2553 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2554 | SET_LIM_STA_CONTEXT_MLM_STATE(sta, |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2555 | eLIM_MLM_WT_DEL_STA_RSP_STATE); |
| 2556 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2557 | if (LIM_IS_STA_ROLE(pe_session)) { |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2558 | MTRACE(mac_trace |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2559 | (mac, TRACE_CODE_MLM_STATE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2560 | pe_session->peSessionId, |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2561 | eLIM_MLM_WT_DEL_STA_RSP_STATE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2562 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2563 | pe_session->limMlmState = |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2564 | eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2565 | |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2566 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2567 | } |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2568 | |
| 2569 | /* we need to defer the message until we get the |
| 2570 | * response back from HAL. */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2571 | SET_LIM_PROCESS_DEFD_MESGS(mac, false); |
Ganesh Kondabattini | 520a83d | 2017-03-14 20:02:34 +0530 | [diff] [blame] | 2572 | |
| 2573 | pDelStaParams->respReqd = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | } |
| 2575 | |
| 2576 | /* Update PE session ID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2577 | pDelStaParams->sessionId = pe_session->peSessionId; |
| 2578 | pDelStaParams->smesessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2580 | pDelStaParams->staType = sta->staType; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2581 | qdf_mem_copy((uint8_t *) pDelStaParams->staMac, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2582 | (uint8_t *) sta->staAddr, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2583 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2584 | pDelStaParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2585 | msgQ.type = WMA_DELETE_STA_REQ; |
| 2586 | msgQ.reserved = 0; |
| 2587 | msgQ.bodyptr = pDelStaParams; |
| 2588 | msgQ.bodyval = 0; |
| 2589 | |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2590 | pe_debug("Sessionid %d :Sending SIR_HAL_DELETE_STA_REQ " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2591 | "for mac_addr "QDF_MAC_ADDR_FMT" and AssocID: %d MAC : " |
| 2592 | QDF_MAC_ADDR_FMT, pDelStaParams->sessionId, |
| 2593 | QDF_MAC_ADDR_REF(pDelStaParams->staMac), |
| 2594 | pDelStaParams->assocId, |
| 2595 | QDF_MAC_ADDR_REF(sta->staAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2596 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2597 | MTRACE(mac_trace_msg_tx(mac, pe_session->peSessionId, msgQ.type)); |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2598 | retCode = wma_post_ctrl_msg(mac, &msgQ); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2599 | if (QDF_STATUS_SUCCESS != retCode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2600 | if (fRespReqd) |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2601 | SET_LIM_PROCESS_DEFD_MESGS(mac, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2602 | pe_err("Posting DELETE_STA_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2603 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2604 | qdf_mem_free(pDelStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | } |
| 2606 | |
| 2607 | return retCode; |
| 2608 | } |
| 2609 | |
hqu | f2c3099 | 2019-05-14 20:17:28 +0800 | [diff] [blame] | 2610 | /** |
| 2611 | * lim_set_mbssid_info() - Save mbssid info |
| 2612 | * @pe_session: pe session entry |
| 2613 | * |
| 2614 | * Return: None |
| 2615 | */ |
hqu | f2c3099 | 2019-05-14 20:17:28 +0800 | [diff] [blame] | 2616 | static void lim_set_mbssid_info(struct pe_session *pe_session) |
| 2617 | { |
| 2618 | struct scan_mbssid_info *mbssid_info; |
| 2619 | |
Pragaspathi Thilagaraj | 64ae59d | 2019-06-22 13:00:34 +0530 | [diff] [blame] | 2620 | mbssid_info = &pe_session->lim_join_req->bssDescription.mbssid_info; |
hqu | f2c3099 | 2019-05-14 20:17:28 +0800 | [diff] [blame] | 2621 | mlme_set_mbssid_info(pe_session->vdev, mbssid_info); |
| 2622 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | |
| 2624 | /** |
| 2625 | * lim_add_sta_self() |
| 2626 | * |
| 2627 | ***FUNCTION: |
| 2628 | * This function is called to add an STA context at hardware |
| 2629 | * whenever a STA is (Re) Associated. |
| 2630 | * |
| 2631 | ***LOGIC: |
| 2632 | * |
| 2633 | ***ASSUMPTIONS: |
| 2634 | * NA |
| 2635 | * |
| 2636 | ***NOTE: |
| 2637 | * NA |
| 2638 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2639 | * @param mac - Pointer to Global MAC structure |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2640 | * @param sta - Pointer to the STA datastructure created by |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2641 | * LIM and maintained by DPH |
| 2642 | * @return retCode - Indicates success or failure return code |
| 2643 | */ |
| 2644 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2645 | QDF_STATUS |
Yeshwanth Sriram Guntuka | 3f26210 | 2019-07-16 15:41:08 +0530 | [diff] [blame] | 2646 | lim_add_sta_self(struct mac_context *mac, uint8_t updateSta, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2647 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2648 | { |
| 2649 | tpAddStaParams pAddStaParams = NULL; |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 2650 | struct scheduler_msg msgQ = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2651 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2652 | tSirMacAddr staMac; |
Pragaspathi Thilagaraj | 3cf0f65 | 2018-10-29 16:40:35 +0530 | [diff] [blame] | 2653 | uint32_t listenInterval = MLME_CFG_LISTEN_INTERVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2654 | /*This self Sta dot 11 mode comes from the cfg and the expectation here is |
| 2655 | * that cfg carries the systemwide capability that device under |
| 2656 | * consideration can support. This capability gets plumbed into the cfg |
| 2657 | * cache at system initialization time via the .dat and .ini file override |
| 2658 | * mechanisms and will not change. If it does change, it is the |
| 2659 | * responsibility of SME to evict the selfSta and reissue a new AddStaSelf |
| 2660 | * command.*/ |
Wu Gao | ccd9ca2 | 2019-01-17 14:16:43 +0800 | [diff] [blame] | 2661 | uint32_t selfStaDot11Mode = 0; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2662 | |
gaurank kathpalia | 1be77fa | 2019-01-04 13:32:09 +0530 | [diff] [blame] | 2663 | selfStaDot11Mode = mac->mlme_cfg->dot11_mode.dot11_mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2664 | |
Pragaspathi Thilagaraj | 7fb1422 | 2019-06-17 23:26:58 +0530 | [diff] [blame] | 2665 | sir_copy_mac_addr(staMac, pe_session->self_mac_addr); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2666 | pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 2667 | if (!pAddStaParams) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2668 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
| 2670 | /* / Add STA context at MAC HW (BMU, RHP & TFP) */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2671 | qdf_mem_copy((uint8_t *) pAddStaParams->staMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2672 | (uint8_t *) staMac, sizeof(tSirMacAddr)); |
| 2673 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2674 | qdf_mem_copy((uint8_t *) pAddStaParams->bssId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2675 | pe_session->bssId, sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2676 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2677 | pAddStaParams->assocId = pe_session->limAID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2678 | pAddStaParams->staType = STA_ENTRY_SELF; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2679 | pAddStaParams->status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | |
| 2681 | /* Update PE session ID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2682 | pAddStaParams->sessionId = pe_session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | |
| 2684 | /* Update SME session ID */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2685 | pAddStaParams->smesessionId = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2687 | pAddStaParams->maxTxPower = pe_session->maxTxPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2688 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2689 | pAddStaParams->updateSta = updateSta; |
| 2690 | |
hqu | f2c3099 | 2019-05-14 20:17:28 +0800 | [diff] [blame] | 2691 | lim_set_mbssid_info(pe_session); |
| 2692 | |
Jeff Johnson | ff432cd | 2018-12-14 22:57:41 -0800 | [diff] [blame] | 2693 | lim_populate_own_rate_set(mac, &pAddStaParams->supportedRates, |
| 2694 | NULL, false, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2695 | pe_session, NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2696 | if (IS_DOT11_MODE_HT(selfStaDot11Mode)) { |
| 2697 | pAddStaParams->htCapable = true; |
Abhishek Singh | 6243a00 | 2019-09-19 12:55:11 +0530 | [diff] [blame] | 2698 | |
Jeff Johnson | ff432cd | 2018-12-14 22:57:41 -0800 | [diff] [blame] | 2699 | pAddStaParams->ch_width = |
| 2700 | mac->roam.configParam.channelBondingMode5GHz; |
| 2701 | pAddStaParams->mimoPS = |
| 2702 | lim_get_ht_capability(mac, eHT_MIMO_POWER_SAVE, |
| 2703 | pe_session); |
Jeff Johnson | ff432cd | 2018-12-14 22:57:41 -0800 | [diff] [blame] | 2704 | pAddStaParams->maxAmpduDensity = |
| 2705 | lim_get_ht_capability(mac, eHT_MPDU_DENSITY, |
| 2706 | pe_session); |
| 2707 | pAddStaParams->maxAmpduSize = |
| 2708 | lim_get_ht_capability(mac, eHT_MAX_RX_AMPDU_FACTOR, |
| 2709 | pe_session); |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 2710 | pAddStaParams->fShortGI20Mhz = pe_session->ht_config.ht_sgi20; |
| 2711 | pAddStaParams->fShortGI40Mhz = pe_session->ht_config.ht_sgi40; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2712 | } |
Abhinav Kumar | 2ae2524 | 2020-05-11 22:46:11 +0530 | [diff] [blame] | 2713 | pAddStaParams->vhtCapable = pe_session->vhtCapability; |
gaurank kathpalia | 385977d | 2020-02-06 11:41:10 +0530 | [diff] [blame] | 2714 | if (pAddStaParams->vhtCapable) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2715 | pAddStaParams->ch_width = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2716 | pe_session->ch_width; |
gaurank kathpalia | 385977d | 2020-02-06 11:41:10 +0530 | [diff] [blame] | 2717 | |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2718 | pAddStaParams->vhtTxBFCapable = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2719 | pe_session->vht_config.su_beam_formee; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2720 | pAddStaParams->enable_su_tx_bformer = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2721 | pe_session->vht_config.su_beam_former; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | |
| 2723 | /* In 11ac mode, the hardware is capable of supporting 128K AMPDU size */ |
Abhinav Kumar | 2ae2524 | 2020-05-11 22:46:11 +0530 | [diff] [blame] | 2724 | if (pe_session->vhtCapability) |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 2725 | pAddStaParams->maxAmpduSize = |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2726 | mac->mlme_cfg->vht_caps.vht_cap_info.ampdu_len_exponent; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 2727 | |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 2728 | pAddStaParams->vhtTxMUBformeeCapable = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2729 | pe_session->vht_config.mu_beam_formee; |
| 2730 | pAddStaParams->enableVhtpAid = pe_session->enableVhtpAid; |
| 2731 | pAddStaParams->enableAmpduPs = pe_session->enableAmpduPs; |
| 2732 | pAddStaParams->enableHtSmps = (pe_session->enableHtSmps && |
| 2733 | (!pe_session->supported_nss_1x1)); |
| 2734 | pAddStaParams->htSmpsconfig = pe_session->htSmpsvalue; |
Archana Ramachandran | fec2481 | 2016-02-16 16:31:56 -0800 | [diff] [blame] | 2735 | pAddStaParams->send_smps_action = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2736 | pe_session->send_smps_action; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | |
| 2738 | /* For Self STA get the LDPC capability from session i.e config.ini */ |
| 2739 | pAddStaParams->htLdpcCapable = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2740 | (pe_session->txLdpcIniFeatureEnabled & 0x01); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | pAddStaParams->vhtLdpcCapable = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2742 | ((pe_session->txLdpcIniFeatureEnabled >> 1) & 0x01); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2744 | listenInterval = mac->mlme_cfg->sap_cfg.listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2745 | pAddStaParams->listenInterval = (uint16_t) listenInterval; |
| 2746 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 2747 | if (QDF_P2P_CLIENT_MODE == pe_session->opmode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2748 | pAddStaParams->p2pCapableSta = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2749 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2750 | if (pe_session->isNonRoamReassoc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2751 | pAddStaParams->nonRoamReassoc = 1; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2752 | pe_session->isNonRoamReassoc = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2753 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2754 | |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2755 | if (IS_DOT11_MODE_HE(selfStaDot11Mode)) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2756 | lim_add_self_he_cap(pAddStaParams, pe_session); |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 2757 | |
bings | 1117283 | 2019-05-23 16:41:25 +0800 | [diff] [blame] | 2758 | if (lim_is_fils_connection(pe_session)) |
| 2759 | pAddStaParams->no_ptk_4_way = true; |
| 2760 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | msgQ.type = WMA_ADD_STA_REQ; |
| 2762 | msgQ.reserved = 0; |
| 2763 | msgQ.bodyptr = pAddStaParams; |
| 2764 | msgQ.bodyval = 0; |
| 2765 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2766 | pe_debug(QDF_MAC_ADDR_FMT ": vdev %d Sending WMA_ADD_STA_REQ.LI %d", |
| 2767 | QDF_MAC_ADDR_REF(pAddStaParams->staMac), |
gaurank kathpalia | 385977d | 2020-02-06 11:41:10 +0530 | [diff] [blame] | 2768 | pe_session->vdev_id, pAddStaParams->listenInterval); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2769 | MTRACE(mac_trace_msg_tx(mac, pe_session->peSessionId, msgQ.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2770 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2771 | retCode = wma_post_ctrl_msg(mac, &msgQ); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2772 | if (QDF_STATUS_SUCCESS != retCode) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2773 | pe_err("Posting WMA_ADD_STA_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2774 | retCode); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2775 | qdf_mem_free(pAddStaParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2776 | } |
| 2777 | return retCode; |
| 2778 | } |
| 2779 | |
| 2780 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2781 | * lim_handle_cnf_wait_timeout() |
| 2782 | * |
| 2783 | ***FUNCTION: |
| 2784 | * This function is called by limProcessMessageQueue to handle |
| 2785 | * various confirmation failure cases. |
| 2786 | * |
| 2787 | ***LOGIC: |
| 2788 | * |
| 2789 | ***ASSUMPTIONS: |
| 2790 | * |
| 2791 | ***NOTE: |
| 2792 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 2793 | * @param mac - Pointer to Global MAC structure |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2794 | * @param sta - Pointer to a sta descriptor |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2795 | * @return None |
| 2796 | */ |
| 2797 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2798 | void lim_handle_cnf_wait_timeout(struct mac_context *mac, uint16_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2799 | { |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2800 | tpDphHashNode sta; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2801 | struct pe_session *pe_session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2802 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2803 | pe_session = pe_find_session_by_session_id(mac, |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 2804 | mac->lim.lim_timers.gpLimCnfWaitTimer[staId].sessionId); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2805 | if (!pe_session) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2806 | pe_err("Session Does not exist for given sessionID"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2807 | return; |
| 2808 | } |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2809 | sta = dph_get_hash_entry(mac, staId, &pe_session->dph.dphHashTable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2810 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2811 | if (!sta) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2812 | pe_err("No STA context in SIR_LIM_CNF_WAIT_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2813 | return; |
| 2814 | } |
| 2815 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2816 | switch (sta->mlmStaContext.mlmState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2817 | case eLIM_MLM_WT_ASSOC_CNF_STATE: |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2818 | pe_debug("Did not receive Assoc Cnf in eLIM_MLM_WT_ASSOC_CNF_STATE sta Assoc id %d", |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2819 | sta->assocId); |
| 2820 | lim_print_mac_addr(mac, sta->staAddr, LOGD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2821 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2822 | if (LIM_IS_AP_ROLE(pe_session)) { |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2823 | lim_reject_association(mac, sta->staAddr, |
| 2824 | sta->mlmStaContext.subType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2825 | true, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2826 | sta->mlmStaContext.authType, |
| 2827 | sta->assocId, true, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2828 | eSIR_MAC_UNSPEC_FAILURE_STATUS, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 2829 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2830 | } |
| 2831 | break; |
| 2832 | |
| 2833 | default: |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2834 | pe_warn("Received CNF_WAIT_TIMEOUT in state %d", |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 2835 | sta->mlmStaContext.mlmState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2836 | } |
| 2837 | } |
| 2838 | |
| 2839 | /** |
| 2840 | * lim_delete_dph_hash_entry()- function to delete dph hash entry |
| 2841 | * @mac_ctx: pointer to global mac structure |
| 2842 | * @sta_addr: peer station address |
| 2843 | * @sta_id: id assigned to peer station |
| 2844 | * @session_entry: pe session entry |
| 2845 | * |
| 2846 | * This function is called whenever we need to delete |
| 2847 | * the dph hash entry |
| 2848 | * |
| 2849 | * Return: none |
| 2850 | */ |
| 2851 | |
| 2852 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2853 | lim_delete_dph_hash_entry(struct mac_context *mac_ctx, tSirMacAddr sta_addr, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 2854 | uint16_t sta_id, struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2855 | { |
| 2856 | uint16_t aid; |
| 2857 | tpDphHashNode sta_ds; |
| 2858 | tUpdateBeaconParams beacon_params; |
| 2859 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2860 | qdf_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2861 | beacon_params.paramChangeBitmap = 0; |
| 2862 | lim_deactivate_and_change_per_sta_id_timer(mac_ctx, eLIM_CNF_WAIT_TIMER, |
| 2863 | sta_id); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2864 | if (!session_entry) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2865 | pe_err("NULL session_entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2866 | return; |
| 2867 | } |
| 2868 | |
Abhishek Singh | c70afa3 | 2019-09-19 15:17:21 +0530 | [diff] [blame] | 2869 | beacon_params.bss_idx = session_entry->vdev_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2870 | sta_ds = dph_lookup_hash_entry(mac_ctx, sta_addr, &aid, |
| 2871 | &session_entry->dph.dphHashTable); |
| 2872 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 2873 | if (!sta_ds) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2874 | pe_err("sta_ds is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2875 | return; |
| 2876 | } |
| 2877 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2878 | pe_debug("Deleting DPH Hash entry sta mac " QDF_MAC_ADDR_FMT, |
| 2879 | QDF_MAC_ADDR_REF(sta_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2880 | /* |
| 2881 | * update the station count and perform associated actions |
| 2882 | * do this before deleting the dph hash entry |
| 2883 | */ |
| 2884 | lim_util_count_sta_del(mac_ctx, sta_ds, session_entry); |
| 2885 | |
| 2886 | if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_IBSS_ROLE(session_entry)) { |
| 2887 | if (LIM_IS_AP_ROLE(session_entry)) { |
| 2888 | if (session_entry->gLimProtectionControl != |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 2889 | MLME_FORCE_POLICY_PROTECTION_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2890 | lim_decide_ap_protection_on_delete(mac_ctx, |
| 2891 | sta_ds, &beacon_params, session_entry); |
| 2892 | } |
| 2893 | |
gaolez | 7bb1e74 | 2017-03-21 16:37:38 +0800 | [diff] [blame] | 2894 | if (sta_ds->non_ecsa_capable) { |
| 2895 | if (session_entry->lim_non_ecsa_cap_num == 0) { |
| 2896 | pe_debug("NonECSA sta 0, id %d is ecsa", |
| 2897 | sta_id); |
| 2898 | } else { |
| 2899 | session_entry->lim_non_ecsa_cap_num--; |
| 2900 | pe_debug("reducing the non ECSA num to %d", |
| 2901 | session_entry->lim_non_ecsa_cap_num); |
| 2902 | } |
| 2903 | } |
| 2904 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2905 | if (LIM_IS_IBSS_ROLE(session_entry)) |
| 2906 | lim_ibss_decide_protection_on_delete(mac_ctx, sta_ds, |
| 2907 | &beacon_params, session_entry); |
| 2908 | |
| 2909 | lim_decide_short_preamble(mac_ctx, sta_ds, &beacon_params, |
| 2910 | session_entry); |
| 2911 | lim_decide_short_slot(mac_ctx, sta_ds, &beacon_params, |
| 2912 | session_entry); |
| 2913 | |
| 2914 | /* Send message to HAL about beacon parameter change. */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2915 | pe_debug("param bitmap: %d", beacon_params.paramChangeBitmap); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2916 | if (beacon_params.paramChangeBitmap && |
| 2917 | (false == |
| 2918 | mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { |
| 2919 | sch_set_fixed_beacon_fields(mac_ctx, session_entry); |
| 2920 | lim_send_beacon_params(mac_ctx, &beacon_params, |
| 2921 | session_entry); |
| 2922 | } |
Arif Hussain | 1513cb2 | 2018-01-05 19:56:31 -0800 | [diff] [blame] | 2923 | |
| 2924 | lim_obss_send_detection_cfg(mac_ctx, session_entry, false); |
| 2925 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2926 | #ifdef WLAN_FEATURE_11W |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 2927 | if (sta_ds->rmfEnabled) { |
Yeshwanth Sriram Guntuka | e6b5424 | 2019-07-16 14:54:16 +0530 | [diff] [blame] | 2928 | pe_debug("delete pmf timer assoc-id:%d sta mac " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 2929 | QDF_MAC_ADDR_FMT, sta_ds->assocId, |
| 2930 | QDF_MAC_ADDR_REF(sta_ds->staAddr)); |
Krunal Soni | a59e8a4 | 2017-11-19 09:00:56 -0800 | [diff] [blame] | 2931 | tx_timer_delete(&sta_ds->pmfSaQueryTimer); |
| 2932 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2933 | #endif |
| 2934 | } |
| 2935 | |
| 2936 | if (dph_delete_hash_entry(mac_ctx, sta_addr, sta_id, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 2937 | &session_entry->dph.dphHashTable) != QDF_STATUS_SUCCESS) |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2938 | pe_err("error deleting hash entry"); |
Liangwei Dong | 0527617 | 2019-12-27 10:31:46 +0800 | [diff] [blame] | 2939 | lim_ap_check_6g_compatible_peer(mac_ctx, session_entry); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2940 | } |
| 2941 | |
| 2942 | /** |
| 2943 | * lim_check_and_announce_join_success()- function to check if the received |
| 2944 | * Beacon/Probe Response is from the BSS that we're attempting to join. |
| 2945 | * @mac: pointer to global mac structure |
| 2946 | * @beacon_probe_rsp: pointer to reveived beacon/probe response frame |
| 2947 | * @header: pointer to received management frame header |
| 2948 | * @session_entry: pe session entry |
| 2949 | * |
| 2950 | * This function is called upon receiving Beacon/Probe Response |
| 2951 | * frame in WT_JOIN_BEACON_STATE to check if the received |
| 2952 | * Beacon/Probe Response is from the BSS that we're attempting |
| 2953 | * to join. |
| 2954 | * If the Beacon/Probe Response is indeed from the BSS we're |
| 2955 | * attempting to join, join success is sent to SME. |
| 2956 | * |
| 2957 | * Return: none |
| 2958 | */ |
| 2959 | |
| 2960 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 2961 | lim_check_and_announce_join_success(struct mac_context *mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2962 | tSirProbeRespBeacon *beacon_probe_rsp, tpSirMacMgmtHdr header, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 2963 | struct pe_session *session_entry) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2964 | { |
| 2965 | tSirMacSSid current_ssid; |
| 2966 | tLimMlmJoinCnf mlm_join_cnf; |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 2967 | uint32_t val; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2968 | uint32_t *noa_duration_from_beacon = NULL; |
| 2969 | uint32_t *noa2_duration_from_beacon = NULL; |
| 2970 | uint32_t noa; |
| 2971 | uint32_t total_num_noa_desc = 0; |
| 2972 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2973 | qdf_mem_copy(current_ssid.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2974 | session_entry->ssId.ssId, session_entry->ssId.length); |
| 2975 | |
| 2976 | current_ssid.length = (uint8_t) session_entry->ssId.length; |
| 2977 | |
| 2978 | /* |
| 2979 | * Check for SSID only in probe response. Beacons may not carry |
| 2980 | * SSID information in hidden SSID case |
| 2981 | */ |
| 2982 | if (((SIR_MAC_MGMT_FRAME == header->fc.type) && |
| 2983 | (SIR_MAC_MGMT_PROBE_RSP == header->fc.subType)) && |
| 2984 | current_ssid.length && |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2985 | (qdf_mem_cmp((uint8_t *) &beacon_probe_rsp->ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | (uint8_t *) ¤t_ssid, |
| 2987 | (uint8_t) (1 + current_ssid.length)))) { |
| 2988 | /* |
| 2989 | * Received SSID does not match with the one we've. |
| 2990 | * Ignore received Beacon frame |
| 2991 | */ |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 2992 | pe_debug("SSID received in Beacon does not match"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2993 | #ifdef WLAN_DEBUG |
| 2994 | mac_ctx->lim.gLimBcnSSIDMismatchCnt++; |
| 2995 | #endif |
| 2996 | return; |
| 2997 | } |
| 2998 | |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 2999 | if (!LIM_IS_STA_ROLE(session_entry)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3000 | return; |
| 3001 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3002 | pe_debug("Received Beacon/PR with BSSID:"QDF_MAC_ADDR_FMT" pe session %d vdev %d", |
| 3003 | QDF_MAC_ADDR_REF(session_entry->bssId), |
| 3004 | session_entry->peSessionId, |
gaurank kathpalia | 385977d | 2020-02-06 11:41:10 +0530 | [diff] [blame] | 3005 | session_entry->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3006 | |
| 3007 | /* Deactivate Join Failure timer */ |
| 3008 | lim_deactivate_and_change_timer(mac_ctx, eLIM_JOIN_FAIL_TIMER); |
| 3009 | /* Deactivate Periodic Join timer */ |
| 3010 | lim_deactivate_and_change_timer(mac_ctx, |
| 3011 | eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 3012 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3013 | if (QDF_P2P_CLIENT_MODE == session_entry->opmode && |
| 3014 | beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3015 | |
| 3016 | noa_duration_from_beacon = (uint32_t *) |
| 3017 | (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.NoADesc + 1); |
| 3018 | |
| 3019 | if (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.num_NoADesc) |
| 3020 | total_num_noa_desc = |
| 3021 | beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence. |
| 3022 | num_NoADesc / SIZE_OF_NOA_DESCRIPTOR; |
| 3023 | |
| 3024 | noa = *noa_duration_from_beacon; |
| 3025 | |
| 3026 | if (total_num_noa_desc > 1) { |
| 3027 | noa2_duration_from_beacon = (uint32_t *) |
| 3028 | (beacon_probe_rsp->P2PProbeRes.NoticeOfAbsence.NoADesc + |
| 3029 | SIZE_OF_NOA_DESCRIPTOR + 1); |
| 3030 | noa += *noa2_duration_from_beacon; |
| 3031 | } |
| 3032 | |
| 3033 | /* |
| 3034 | * If MAX Noa exceeds 3 secs we will consider only 3 secs to |
Jeff Johnson | 47d7524 | 2018-05-12 15:58:53 -0700 | [diff] [blame] | 3035 | * avoid arbitrary values in noa duration field |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3036 | */ |
| 3037 | noa = noa > MAX_NOA_PERIOD_IN_MICROSECS ? |
| 3038 | MAX_NOA_PERIOD_IN_MICROSECS : noa; |
| 3039 | noa = noa / 1000; /* Convert to ms */ |
| 3040 | |
Arif Hussain | 43e0971 | 2018-09-18 19:31:57 -0700 | [diff] [blame] | 3041 | session_entry->defaultAuthFailureTimeout = |
| 3042 | mac_ctx->mlme_cfg->timeouts.auth_failure_timeout; |
| 3043 | val = mac_ctx->mlme_cfg->timeouts.auth_failure_timeout + noa; |
| 3044 | if (cfg_in_range(CFG_AUTH_FAILURE_TIMEOUT, val)) |
| 3045 | mac_ctx->mlme_cfg->timeouts.auth_failure_timeout = val; |
| 3046 | else |
| 3047 | mac_ctx->mlme_cfg->timeouts.auth_failure_timeout = |
| 3048 | cfg_default(CFG_AUTH_FAILURE_TIMEOUT); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3049 | } else { |
| 3050 | session_entry->defaultAuthFailureTimeout = 0; |
| 3051 | } |
| 3052 | |
Selvaraj, Sridhar | ac4fcf3 | 2016-09-28 12:57:32 +0530 | [diff] [blame] | 3053 | |
| 3054 | /* |
| 3055 | * Check if MBO Association disallowed subattr is present and post |
| 3056 | * failure status to LIM if present |
| 3057 | */ |
| 3058 | if (!session_entry->ignore_assoc_disallowed && |
| 3059 | beacon_probe_rsp->assoc_disallowed) { |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3060 | pe_err("Connection fails due to assoc disallowed reason(%d):"QDF_MAC_ADDR_FMT" PESessionID %d", |
Selvaraj, Sridhar | ac4fcf3 | 2016-09-28 12:57:32 +0530 | [diff] [blame] | 3061 | beacon_probe_rsp->assoc_disallowed_reason, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3062 | QDF_MAC_ADDR_REF(session_entry->bssId), |
Selvaraj, Sridhar | ac4fcf3 | 2016-09-28 12:57:32 +0530 | [diff] [blame] | 3063 | session_entry->peSessionId); |
| 3064 | mlm_join_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; |
| 3065 | mlm_join_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3066 | session_entry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 3067 | mlm_join_cnf.sessionId = session_entry->peSessionId; |
| 3068 | if (session_entry->pLimMlmJoinReq) { |
| 3069 | qdf_mem_free(session_entry->pLimMlmJoinReq); |
| 3070 | session_entry->pLimMlmJoinReq = NULL; |
| 3071 | } |
| 3072 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 3073 | (uint32_t *) &mlm_join_cnf); |
| 3074 | return; |
| 3075 | } |
| 3076 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | /* Update Beacon Interval at CFG database */ |
| 3078 | |
| 3079 | if (beacon_probe_rsp->HTCaps.present) |
| 3080 | lim_update_sta_run_time_ht_capability(mac_ctx, |
| 3081 | &beacon_probe_rsp->HTCaps); |
| 3082 | if (beacon_probe_rsp->HTInfo.present) |
| 3083 | lim_update_sta_run_time_ht_info(mac_ctx, |
| 3084 | &beacon_probe_rsp->HTInfo, session_entry); |
| 3085 | session_entry->limMlmState = eLIM_MLM_JOINED_STATE; |
| 3086 | MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, |
| 3087 | session_entry->peSessionId, eLIM_MLM_JOINED_STATE)); |
| 3088 | |
| 3089 | /* |
| 3090 | * update the capability info based on recently received beacon/probe |
| 3091 | * response frame |
| 3092 | */ |
| 3093 | session_entry->limCurrentBssCaps = |
| 3094 | lim_get_u16((uint8_t *)&beacon_probe_rsp->capabilityInfo); |
| 3095 | |
| 3096 | /* |
| 3097 | * Announce join success by sending |
| 3098 | * Join confirm to SME. |
| 3099 | */ |
| 3100 | mlm_join_cnf.resultCode = eSIR_SME_SUCCESS; |
| 3101 | mlm_join_cnf.protStatusCode = eSIR_MAC_SUCCESS_STATUS; |
| 3102 | /* Update PE sessionId */ |
| 3103 | mlm_join_cnf.sessionId = session_entry->peSessionId; |
| 3104 | lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, |
| 3105 | (uint32_t *) &mlm_join_cnf); |
| 3106 | |
Abhinav Kumar | 2ae2524 | 2020-05-11 22:46:11 +0530 | [diff] [blame] | 3107 | if (session_entry->vhtCapability && |
| 3108 | beacon_probe_rsp->vendor_vht_ie.VHTCaps.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3109 | session_entry->is_vendor_specific_vhtcaps = true; |
Kiran Kumar Lokere | 8172263 | 2017-09-26 12:11:43 -0700 | [diff] [blame] | 3110 | session_entry->vendor_specific_vht_ie_sub_type = |
| 3111 | beacon_probe_rsp->vendor_vht_ie.sub_type; |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3112 | pe_debug("VHT caps are present in vendor specific IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3113 | } |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 3114 | |
| 3115 | /* Update HS 2.0 Information Element */ |
| 3116 | if (beacon_probe_rsp->hs20vendor_ie.present) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3117 | pe_debug("HS20 Indication Element Present, rel#:%u, id:%u", |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 3118 | beacon_probe_rsp->hs20vendor_ie.release_num, |
| 3119 | beacon_probe_rsp->hs20vendor_ie.hs_id_present); |
| 3120 | qdf_mem_copy(&session_entry->hs20vendor_ie, |
| 3121 | &beacon_probe_rsp->hs20vendor_ie, |
| 3122 | sizeof(tDot11fIEhs20vendor_ie) - |
| 3123 | sizeof(beacon_probe_rsp->hs20vendor_ie.hs_id)); |
| 3124 | if (beacon_probe_rsp->hs20vendor_ie.hs_id_present) |
| 3125 | qdf_mem_copy(&session_entry->hs20vendor_ie.hs_id, |
| 3126 | &beacon_probe_rsp->hs20vendor_ie.hs_id, |
| 3127 | sizeof(beacon_probe_rsp->hs20vendor_ie.hs_id)); |
| 3128 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3129 | } |
| 3130 | |
| 3131 | /** |
| 3132 | * lim_extract_ap_capabilities() |
| 3133 | * |
| 3134 | ***FUNCTION: |
| 3135 | * This function is called to extract all of the AP's capabilities |
| 3136 | * from the IEs received from it in Beacon/Probe Response frames |
| 3137 | * |
| 3138 | ***LOGIC: |
| 3139 | * This routine mimics the lim_extract_ap_capability() API. The difference here |
| 3140 | * is that this API returns the entire tSirProbeRespBeacon info as is. It is |
| 3141 | * left to the caller of this API to use this info as required |
| 3142 | * |
| 3143 | ***ASSUMPTIONS: |
| 3144 | * NA |
| 3145 | * |
| 3146 | ***NOTE: |
| 3147 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3148 | * @param mac Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3149 | * @param pIE Pointer to starting IE in Beacon/Probe Response |
| 3150 | * @param ieLen Length of all IEs combined |
| 3151 | * @param beaconStruct A pointer to tSirProbeRespBeacon that needs to be |
| 3152 | * populated |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3153 | * @return status A status reporting QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3154 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3155 | QDF_STATUS lim_extract_ap_capabilities(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3156 | uint8_t *pIE, |
| 3157 | uint16_t ieLen, |
| 3158 | tpSirProbeRespBeacon beaconStruct) |
| 3159 | { |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 3160 | qdf_mem_zero((uint8_t *) beaconStruct, sizeof(tSirProbeRespBeacon)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3161 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3162 | /* Parse the Beacon IE's, Don't try to parse if we dont have anything in IE */ |
| 3163 | if (ieLen > 0) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3164 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3165 | sir_parse_beacon_ie(mac, beaconStruct, pIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | (uint32_t) ieLen)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3167 | pe_err("APCapExtract: Beacon parsing error!"); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3168 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | } |
| 3170 | } |
| 3171 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3172 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3173 | } |
| 3174 | |
| 3175 | /** |
| 3176 | * lim_del_bss() |
| 3177 | * |
| 3178 | ***FUNCTION: |
| 3179 | * This function is called to delete BSS context at hardware |
| 3180 | * whenever a STA is disassociated |
| 3181 | * |
| 3182 | ***LOGIC: |
| 3183 | * |
| 3184 | ***ASSUMPTIONS: |
| 3185 | * NA |
| 3186 | * |
| 3187 | ***NOTE: |
| 3188 | * NA |
| 3189 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3190 | * @param mac - Pointer to Global MAC structure |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3191 | * @param sta - Pointer to the STA datastructure created by |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | * LIM and maintained by DPH |
| 3193 | * @return retCode - Indicates success or failure return code |
| 3194 | */ |
| 3195 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3196 | QDF_STATUS |
Pragaspathi Thilagaraj | e05162d | 2019-05-23 13:10:46 +0530 | [diff] [blame] | 3197 | lim_del_bss(struct mac_context *mac, tpDphHashNode sta, uint16_t bss_idx, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3198 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3199 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 3200 | struct scheduler_msg msgQ = {0}; |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3201 | QDF_STATUS retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3202 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3203 | /* DPH was storing the AssocID in staID field, */ |
| 3204 | /* staID is actually assigned by HAL when AddSTA message is sent. */ |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3205 | if (sta) { |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3206 | sta->valid = 0; |
| 3207 | sta->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
Abhishek Ambure | 2bd960b | 2019-08-21 16:30:53 +0530 | [diff] [blame] | 3208 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3209 | pe_session->limMlmState = eLIM_MLM_WT_DEL_BSS_RSP_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3210 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3211 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3212 | eLIM_MLM_WT_DEL_BSS_RSP_STATE)); |
| 3213 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3214 | if ((pe_session->peSessionId == |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3215 | mac->lim.lim_timers.gLimJoinFailureTimer.sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3216 | && (true == |
Pragaspathi Thilagaraj | 9f23038 | 2019-06-24 11:54:05 +0530 | [diff] [blame] | 3217 | tx_timer_running(&mac->lim.lim_timers.gLimJoinFailureTimer))) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3218 | lim_deactivate_and_change_timer(mac, eLIM_JOIN_FAIL_TIMER); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3219 | } |
| 3220 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | /* we need to defer the message until we get the response back from HAL. */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3222 | SET_LIM_PROCESS_DEFD_MESGS(mac, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3223 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3224 | if (pe_session->process_ho_fail) |
Deepak Dhamdhere | 2dae1bd | 2016-10-27 10:58:29 -0700 | [diff] [blame] | 3225 | msgQ.type = WMA_DELETE_BSS_HO_FAIL_REQ; |
| 3226 | else |
| 3227 | msgQ.type = WMA_DELETE_BSS_REQ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3228 | msgQ.reserved = 0; |
Abhishek Ambure | 968f151 | 2019-08-28 18:33:57 +0530 | [diff] [blame] | 3229 | msgQ.bodyptr = NULL; |
| 3230 | msgQ.bodyval = pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3232 | pe_debug("Sessionid %d : Sending HAL_DELETE_BSS_REQ BSSID:" QDF_MAC_ADDR_FMT, |
Abhishek Singh | 29405dc | 2020-02-17 13:08:32 +0530 | [diff] [blame] | 3233 | pe_session->peSessionId, |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3234 | QDF_MAC_ADDR_REF(pe_session->bssId)); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3235 | MTRACE(mac_trace_msg_tx(mac, pe_session->peSessionId, msgQ.type)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3237 | retCode = wma_post_ctrl_msg(mac, &msgQ); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3238 | if (QDF_STATUS_SUCCESS != retCode) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3239 | SET_LIM_PROCESS_DEFD_MESGS(mac, true); |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3240 | pe_err("Posting DELETE_BSS_REQ to HAL failed, reason=%X", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3241 | retCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | } |
| 3243 | |
| 3244 | return retCode; |
| 3245 | } |
| 3246 | |
| 3247 | /** |
| 3248 | * lim_update_vhtcaps_assoc_resp : Update VHT caps in assoc response. |
| 3249 | * @mac_ctx Pointer to Global MAC structure |
| 3250 | * @pAddBssParams: parameters required for add bss params. |
| 3251 | * @vht_caps: VHT capabilities. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3252 | * @pe_session : session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | * |
| 3254 | * Return : void |
| 3255 | */ |
sheenam monga | 6ab58a0 | 2020-06-29 15:43:45 +0530 | [diff] [blame] | 3256 | void lim_update_vhtcaps_assoc_resp(struct mac_context *mac_ctx, |
| 3257 | struct bss_params *pAddBssParams, |
| 3258 | tDot11fIEVHTCaps *vht_caps, |
| 3259 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | { |
| 3261 | pAddBssParams->staContext.vht_caps = |
| 3262 | ((vht_caps->maxMPDULen << |
| 3263 | SIR_MAC_VHT_CAP_MAX_MPDU_LEN) | |
| 3264 | (vht_caps->supportedChannelWidthSet << |
| 3265 | SIR_MAC_VHT_CAP_SUPP_CH_WIDTH_SET) | |
| 3266 | (vht_caps->ldpcCodingCap << |
| 3267 | SIR_MAC_VHT_CAP_LDPC_CODING_CAP) | |
| 3268 | (vht_caps->shortGI80MHz << |
| 3269 | SIR_MAC_VHT_CAP_SHORTGI_80MHZ) | |
| 3270 | (vht_caps->shortGI160and80plus80MHz << |
| 3271 | SIR_MAC_VHT_CAP_SHORTGI_160_80_80MHZ) | |
| 3272 | (vht_caps->txSTBC << |
| 3273 | SIR_MAC_VHT_CAP_TXSTBC) | |
| 3274 | (vht_caps->rxSTBC << |
| 3275 | SIR_MAC_VHT_CAP_RXSTBC) | |
| 3276 | (vht_caps->suBeamFormerCap << |
| 3277 | SIR_MAC_VHT_CAP_SU_BEAMFORMER_CAP) | |
| 3278 | (vht_caps->suBeamformeeCap << |
| 3279 | SIR_MAC_VHT_CAP_SU_BEAMFORMEE_CAP) | |
| 3280 | (vht_caps->csnofBeamformerAntSup << |
| 3281 | SIR_MAC_VHT_CAP_CSN_BEAMORMER_ANT_SUP) | |
| 3282 | (vht_caps->numSoundingDim << |
| 3283 | SIR_MAC_VHT_CAP_NUM_SOUNDING_DIM) | |
| 3284 | (vht_caps->muBeamformerCap << |
| 3285 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMER_CAP) | |
| 3286 | (vht_caps->muBeamformeeCap << |
| 3287 | SIR_MAC_VHT_CAP_NUM_BEAM_FORMEE_CAP) | |
| 3288 | (vht_caps->vhtTXOPPS << |
| 3289 | SIR_MAC_VHT_CAP_TXOPPS) | |
| 3290 | (vht_caps->htcVHTCap << |
| 3291 | SIR_MAC_VHT_CAP_HTC_CAP) | |
| 3292 | (vht_caps->maxAMPDULenExp << |
| 3293 | SIR_MAC_VHT_CAP_MAX_AMDU_LEN_EXPO) | |
| 3294 | (vht_caps->vhtLinkAdaptCap << |
| 3295 | SIR_MAC_VHT_CAP_LINK_ADAPT_CAP) | |
| 3296 | (vht_caps->rxAntPattern << |
| 3297 | SIR_MAC_VHT_CAP_RX_ANTENNA_PATTERN) | |
| 3298 | (vht_caps->txAntPattern << |
| 3299 | SIR_MAC_VHT_CAP_TX_ANTENNA_PATTERN) | |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 3300 | (vht_caps->extended_nss_bw_supp << |
| 3301 | SIR_MAC_VHT_CAP_EXTD_NSS_BW)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3302 | |
| 3303 | pAddBssParams->staContext.maxAmpduSize = |
| 3304 | SIR_MAC_GET_VHT_MAX_AMPDU_EXPO( |
| 3305 | pAddBssParams->staContext.vht_caps); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3306 | } |
| 3307 | |
| 3308 | /** |
| 3309 | * lim_update_vht_oper_assoc_resp : Update VHT Operations in assoc response. |
| 3310 | * @mac_ctx Pointer to Global MAC structure |
| 3311 | * @pAddBssParams: parameters required for add bss params. |
| 3312 | * @vht_oper: VHT Operations to update. |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3313 | * @pe_session : session entry. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3314 | * |
| 3315 | * Return : void |
| 3316 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3317 | static void lim_update_vht_oper_assoc_resp(struct mac_context *mac_ctx, |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3318 | struct bss_params *pAddBssParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3319 | tDot11fIEVHTOperation *vht_oper, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3320 | { |
Liangwei Dong | 73fdb0d | 2019-12-13 15:01:00 +0800 | [diff] [blame] | 3321 | int16_t ccfs0 = vht_oper->chan_center_freq_seg0; |
| 3322 | int16_t ccfs1 = vht_oper->chan_center_freq_seg1; |
| 3323 | int16_t offset = abs((ccfs0 - ccfs1)); |
| 3324 | uint8_t ch_width; |
| 3325 | |
| 3326 | ch_width = pAddBssParams->ch_width; |
| 3327 | if (vht_oper->chanWidth && pe_session->ch_width) { |
| 3328 | ch_width = CH_WIDTH_80MHZ; |
| 3329 | if (ccfs1 && offset == 8) |
| 3330 | ch_width = CH_WIDTH_160MHZ; |
| 3331 | else if (ccfs1 && offset > 16) |
| 3332 | ch_width = CH_WIDTH_80P80MHZ; |
| 3333 | } |
| 3334 | if (ch_width > pe_session->ch_width) |
| 3335 | ch_width = pe_session->ch_width; |
| 3336 | pAddBssParams->ch_width = ch_width; |
| 3337 | pAddBssParams->staContext.ch_width = ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3338 | } |
| 3339 | |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 3340 | #ifdef WLAN_SUPPORT_TWT |
| 3341 | /** |
| 3342 | * lim_set_sta_ctx_twt() - Save the TWT settings in STA context |
| 3343 | * @sta_ctx: Pointer to Station Context |
| 3344 | * @session: Pointer to PE session |
| 3345 | * |
| 3346 | * Return: None |
| 3347 | */ |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 3348 | static void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, struct pe_session *session) |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 3349 | { |
| 3350 | sta_ctx->twt_requestor = session->peer_twt_requestor; |
| 3351 | sta_ctx->twt_responder = session->peer_twt_responder; |
| 3352 | } |
| 3353 | #else |
| 3354 | static inline void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, |
Jeff Johnson | ec50d0d | 2018-11-18 22:19:01 -0800 | [diff] [blame] | 3355 | struct pe_session *session) |
Varun Reddy Yeturu | 4f849e5 | 2018-06-15 18:08:37 -0700 | [diff] [blame] | 3356 | { |
| 3357 | } |
| 3358 | #endif |
| 3359 | |
Abhinav Kumar | 4f95958 | 2019-08-13 12:50:20 +0530 | [diff] [blame] | 3360 | void lim_sta_add_bss_update_ht_parameter(uint32_t bss_chan_freq, |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3361 | tDot11fIEHTCaps* ht_cap, |
| 3362 | tDot11fIEHTInfo* ht_inf, |
| 3363 | bool chan_width_support, |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3364 | struct bss_params *add_bss) |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3365 | { |
| 3366 | if (!ht_cap->present) |
| 3367 | return; |
| 3368 | |
| 3369 | add_bss->htCapable = ht_cap->present; |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3370 | |
| 3371 | if (!ht_inf->present) |
| 3372 | return; |
| 3373 | |
Abhishek Singh | 52dc8ab | 2019-09-25 17:53:41 +0530 | [diff] [blame] | 3374 | if (chan_width_support && ht_cap->supportedChannelWidthSet) |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3375 | add_bss->ch_width = ht_inf->recommendedTxWidthSet; |
Abhishek Singh | 52dc8ab | 2019-09-25 17:53:41 +0530 | [diff] [blame] | 3376 | else |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3377 | add_bss->ch_width = CH_WIDTH_20MHZ; |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3378 | } |
| 3379 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 3380 | QDF_STATUS lim_sta_send_add_bss(struct mac_context *mac, tpSirAssocRsp pAssocRsp, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | tpSchBeaconStruct pBeaconStruct, |
Pragaspathi Thilagaraj | 1d8e2ab | 2019-03-04 23:59:21 +0530 | [diff] [blame] | 3382 | struct bss_description *bssDescription, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3383 | uint8_t updateEntry, struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | { |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3385 | struct bss_params *pAddBssParams = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | uint32_t retCode; |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3387 | tpDphHashNode sta = NULL; |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3388 | bool chan_width_support = false; |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3389 | bool is_vht_cap_in_vendor_ie = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3390 | tDot11fIEVHTCaps *vht_caps = NULL; |
| 3391 | tDot11fIEVHTOperation *vht_oper = NULL; |
| 3392 | tAddStaParams *sta_context; |
Pragaspathi Thilagaraj | 3cf0f65 | 2018-10-29 16:40:35 +0530 | [diff] [blame] | 3393 | uint32_t listen_interval = MLME_CFG_LISTEN_INTERVAL; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3394 | struct mlme_vht_capabilities_info *vht_cap_info; |
Abhinav Kumar | b074f2f | 2018-09-15 15:32:11 +0530 | [diff] [blame] | 3395 | |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3396 | vht_cap_info = &mac->mlme_cfg->vht_caps.vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3397 | |
| 3398 | /* Package SIR_HAL_ADD_BSS_REQ message parameters */ |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3399 | pAddBssParams = qdf_mem_malloc(sizeof(struct bss_params)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 3400 | if (!pAddBssParams) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3401 | retCode = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | goto returnFailure; |
Selvaraj, Sridhar | 6a8dcdf | 2016-10-19 15:53:58 +0530 | [diff] [blame] | 3403 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3404 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3405 | qdf_mem_copy(pAddBssParams->bssId, bssDescription->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | sizeof(tSirMacAddr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3408 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 3409 | |
| 3410 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
| 3411 | pAddBssParams->updateBss = updateEntry; |
| 3412 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3413 | if (IS_DOT11_MODE_11B(pe_session->dot11mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | bssDescription->nwType != eSIR_11B_NW_TYPE) { |
| 3415 | pAddBssParams->nwType = eSIR_11B_NW_TYPE; |
| 3416 | } else { |
| 3417 | pAddBssParams->nwType = bssDescription->nwType; |
| 3418 | } |
| 3419 | |
| 3420 | pAddBssParams->shortSlotTimeSupported = |
| 3421 | (uint8_t) pAssocRsp->capabilityInfo.shortSlotTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | pAddBssParams->llbCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3423 | (uint8_t) pe_session->beaconParams.llbCoexist; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3424 | |
Vignesh Viswanathan | a813462 | 2018-09-28 16:30:22 +0530 | [diff] [blame] | 3425 | /* Use the advertised capabilities from the received beacon/PR */ |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3426 | if (IS_DOT11_MODE_HT(pe_session->dot11mode)) { |
| 3427 | chan_width_support = |
| 3428 | lim_get_ht_capability(mac, |
| 3429 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, |
| 3430 | pe_session); |
Abhinav Kumar | 4f95958 | 2019-08-13 12:50:20 +0530 | [diff] [blame] | 3431 | lim_sta_add_bss_update_ht_parameter(bssDescription->chan_freq, |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3432 | &pAssocRsp->HTCaps, |
| 3433 | &pAssocRsp->HTInfo, |
| 3434 | chan_width_support, |
| 3435 | pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3436 | } |
| 3437 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3438 | if (pe_session->vhtCapability && (pAssocRsp->VHTCaps.present)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | pAddBssParams->vhtCapable = pAssocRsp->VHTCaps.present; |
| 3440 | vht_caps = &pAssocRsp->VHTCaps; |
| 3441 | vht_oper = &pAssocRsp->VHTOperation; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3442 | } else if (pe_session->vhtCapability && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3443 | pAssocRsp->vendor_vht_ie.VHTCaps.present){ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | pAddBssParams->vhtCapable = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3445 | pAssocRsp->vendor_vht_ie.VHTCaps.present; |
Jeff Johnson | 179fd8a | 2018-05-11 14:20:05 -0700 | [diff] [blame] | 3446 | pe_debug("VHT Caps and Operation are present in vendor Specific IE"); |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3447 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
| 3448 | vht_oper = &pAssocRsp->vendor_vht_ie.VHTOperation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | } else { |
| 3450 | pAddBssParams->vhtCapable = 0; |
| 3451 | } |
| 3452 | if (pAddBssParams->vhtCapable) { |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3453 | if (vht_oper) |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3454 | lim_update_vht_oper_assoc_resp(mac, pAddBssParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3455 | vht_oper, pe_session); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3456 | if (vht_caps) |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3457 | lim_update_vhtcaps_assoc_resp(mac, pAddBssParams, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3458 | vht_caps, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3459 | } |
| 3460 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3461 | if (lim_is_session_he_capable(pe_session) && |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 3462 | (pAssocRsp->he_cap.present)) { |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3463 | lim_add_bss_he_cap(pAddBssParams, pAssocRsp); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3464 | lim_add_bss_he_cfg(pAddBssParams, pe_session); |
Manikandan Mohan | 39accff | 2017-05-02 16:09:00 -0700 | [diff] [blame] | 3465 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3466 | /* |
| 3467 | * Populate the STA-related parameters here |
| 3468 | * Note that the STA here refers to the AP |
| 3469 | * staType = PEER |
| 3470 | */ |
| 3471 | sta_context = &pAddBssParams->staContext; |
| 3472 | /* Identifying AP as an STA */ |
| 3473 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; |
| 3474 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3475 | qdf_mem_copy(pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | bssDescription->bssId, sizeof(tSirMacAddr)); |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 3477 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3478 | listen_interval = mac->mlme_cfg->sap_cfg.listen_interval; |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 3479 | pAddBssParams->staContext.listenInterval = listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | |
| 3481 | /* Fill Assoc id from the dph table */ |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3482 | sta = dph_lookup_hash_entry(mac, pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | &pAddBssParams->staContext.assocId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3484 | &pe_session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3485 | if (!sta) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3486 | pe_err("Couldn't get assoc id for " "MAC ADDR: " |
Srinivas Girigowda | 0103acd | 2020-08-10 17:00:42 -0700 | [diff] [blame] | 3487 | QDF_MAC_ADDR_FMT, |
| 3488 | QDF_MAC_ADDR_REF( |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3489 | pAddBssParams->staContext.staMac)); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3490 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3491 | } |
| 3492 | |
| 3493 | pAddBssParams->staContext.uAPSD = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3494 | pe_session->gUapsdPerAcBitmask; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | |
| 3496 | pAddBssParams->staContext.maxSPLen = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3497 | pAddBssParams->staContext.updateSta = updateEntry; |
| 3498 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3499 | if (IS_DOT11_MODE_HT(pe_session->dot11mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | && pBeaconStruct->HTCaps.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | pAddBssParams->staContext.htCapable = 1; |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3502 | if (pe_session->ht_config.ht_tx_stbc) |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 3503 | pAddBssParams->staContext.stbc_capable = |
| 3504 | pAssocRsp->HTCaps.rxSTBC; |
| 3505 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3506 | if (pe_session->vhtCapability && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3507 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3508 | IS_BSS_VHT_CAPABLE(pBeaconStruct-> |
| 3509 | vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3510 | pAddBssParams->staContext.vhtCapable = 1; |
Kiran Kumar Lokere | 89f01f0 | 2019-08-06 18:22:39 -0700 | [diff] [blame] | 3511 | pAddBssParams->staContext.vht_mcs_10_11_supp = |
| 3512 | sta->vht_mcs_10_11_supp; |
| 3513 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3514 | pAddBssParams->staContext.vhtSupportedRxNss = |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3515 | sta->vhtSupportedRxNss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3516 | if (pAssocRsp->VHTCaps.present) |
| 3517 | vht_caps = &pAssocRsp->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3518 | else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { |
| 3519 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
Jeff Johnson | 179fd8a | 2018-05-11 14:20:05 -0700 | [diff] [blame] | 3520 | pe_debug("VHT Caps are in vendor Specific IE"); |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3521 | is_vht_cap_in_vendor_ie = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | } |
| 3523 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3524 | if ((vht_caps) && (vht_caps->suBeamFormerCap || |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3525 | vht_caps->muBeamformerCap) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3526 | pe_session->vht_config.su_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3527 | sta_context->vhtTxBFCapable = 1; |
| 3528 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3529 | if ((vht_caps) && vht_caps->muBeamformerCap && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3530 | pe_session->vht_config.mu_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | sta_context->vhtTxMUBformeeCapable = 1; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3532 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3533 | if ((vht_caps) && vht_caps->suBeamformeeCap && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3534 | pe_session->vht_config.su_beam_former) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | sta_context->enable_su_tx_bformer = 1; |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 3536 | |
| 3537 | if (vht_caps && pAddBssParams->staContext.stbc_capable) |
| 3538 | pAddBssParams->staContext.stbc_capable = |
| 3539 | vht_caps->rxSTBC; |
Kiran Kumar Lokere | c220a51 | 2019-07-24 18:30:47 -0700 | [diff] [blame] | 3540 | if (pe_session->ch_width == CH_WIDTH_160MHZ || |
| 3541 | pe_session->ch_width == CH_WIDTH_80P80MHZ) { |
| 3542 | sta_context->vht_160mhz_nss = |
| 3543 | sta->vht_160mhz_nss; |
| 3544 | sta_context->vht_80p80mhz_nss = |
| 3545 | sta->vht_80p80mhz_nss; |
| 3546 | sta_context->vht_extended_nss_bw_cap = |
| 3547 | sta->vht_extended_nss_bw_cap; |
| 3548 | } else { |
| 3549 | sta_context->vht_160mhz_nss = 0; |
| 3550 | sta_context->vht_80p80mhz_nss = 0; |
| 3551 | sta_context->vht_extended_nss_bw_cap = 0; |
| 3552 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3553 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3554 | if (lim_is_session_he_capable(pe_session) && |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 3555 | pAssocRsp->he_cap.present) { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3556 | lim_intersect_ap_he_caps(pe_session, |
Arif Hussain | 53cf569 | 2018-04-05 16:35:54 -0700 | [diff] [blame] | 3557 | pAddBssParams, |
| 3558 | NULL, |
| 3559 | pAssocRsp); |
| 3560 | lim_update_he_stbc_capable(&pAddBssParams->staContext); |
| 3561 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3562 | |
Vignesh Viswanathan | a813462 | 2018-09-28 16:30:22 +0530 | [diff] [blame] | 3563 | /* |
| 3564 | * in limExtractApCapability function intersection of FW |
| 3565 | * advertised channel width and AP advertised channel |
| 3566 | * width has been taken into account for calculating |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3567 | * pe_session->ch_width |
Vignesh Viswanathan | a813462 | 2018-09-28 16:30:22 +0530 | [diff] [blame] | 3568 | */ |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3569 | if (chan_width_support && |
Vignesh Viswanathan | a813462 | 2018-09-28 16:30:22 +0530 | [diff] [blame] | 3570 | ((pAssocRsp->HTCaps.supportedChannelWidthSet) || |
| 3571 | (pBeaconStruct->HTCaps.supportedChannelWidthSet))) { |
Liangwei Dong | 73fdb0d | 2019-12-13 15:01:00 +0800 | [diff] [blame] | 3572 | pAddBssParams->ch_width = |
| 3573 | pe_session->ch_width; |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 3574 | pAddBssParams->staContext.ch_width = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3575 | pe_session->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | } else { |
Liangwei Dong | 73fdb0d | 2019-12-13 15:01:00 +0800 | [diff] [blame] | 3577 | pAddBssParams->ch_width = CH_WIDTH_20MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3578 | sta_context->ch_width = CH_WIDTH_20MHZ; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3579 | if (!vht_cap_info->enable_txbf_20mhz) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | sta_context->vhtTxBFCapable = 0; |
| 3581 | } |
Vignesh Viswanathan | a813462 | 2018-09-28 16:30:22 +0530 | [diff] [blame] | 3582 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3583 | pAddBssParams->staContext.mimoPS = |
| 3584 | (tSirMacHTMIMOPowerSaveState) |
| 3585 | pAssocRsp->HTCaps.mimoPowerSave; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | pAddBssParams->staContext.maxAmpduDensity = |
| 3587 | pAssocRsp->HTCaps.mpduDensity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | /* |
| 3589 | * We will check gShortGI20Mhz and gShortGI40Mhz from |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3590 | * session entry if they are set then we will use what ever |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3591 | * Assoc response coming from AP supports. If these |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3592 | * values are set as 0 in session entry then we will |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | * hardcode this values to 0. |
| 3594 | */ |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3595 | if (pe_session->ht_config.ht_sgi20) { |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3596 | pAddBssParams->staContext.fShortGI20Mhz = |
| 3597 | (uint8_t)pAssocRsp->HTCaps.shortGI20MHz; |
| 3598 | } else { |
| 3599 | pAddBssParams->staContext.fShortGI20Mhz = false; |
| 3600 | } |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3601 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3602 | if (pe_session->ht_config.ht_sgi40) { |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3603 | pAddBssParams->staContext.fShortGI40Mhz = |
| 3604 | (uint8_t) pAssocRsp->HTCaps.shortGI40MHz; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3605 | } else { |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3606 | pAddBssParams->staContext.fShortGI40Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | } |
| 3608 | |
| 3609 | if (!pAddBssParams->staContext.vhtCapable) |
| 3610 | /* Use max ampd factor advertised in |
| 3611 | * HTCAP for non-vht connection */ |
| 3612 | { |
| 3613 | pAddBssParams->staContext.maxAmpduSize = |
| 3614 | pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 3615 | } else if (pAddBssParams->staContext.maxAmpduSize < |
| 3616 | pAssocRsp->HTCaps.maxRxAMPDUFactor) { |
| 3617 | pAddBssParams->staContext.maxAmpduSize = |
| 3618 | pAssocRsp->HTCaps.maxRxAMPDUFactor; |
| 3619 | } |
| 3620 | if (pAddBssParams->staContext.vhtTxBFCapable |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3621 | && vht_cap_info->disable_ldpc_with_txbf_ap) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3623 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 3624 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3625 | if (pe_session->txLdpcIniFeatureEnabled & 0x1) |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3626 | pAddBssParams->staContext.htLdpcCapable = |
| 3627 | (uint8_t) pAssocRsp->HTCaps.advCodingCap; |
| 3628 | else |
| 3629 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3630 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3631 | if (pAssocRsp->VHTCaps.present) |
| 3632 | vht_caps = &pAssocRsp->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3633 | else if (pAssocRsp->vendor_vht_ie.VHTCaps.present) { |
| 3634 | vht_caps = &pAssocRsp->vendor_vht_ie.VHTCaps; |
Jeff Johnson | 179fd8a | 2018-05-11 14:20:05 -0700 | [diff] [blame] | 3635 | pe_debug("VHT Caps is in vendor Specific IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3636 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3637 | if (vht_caps && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3638 | (pe_session->txLdpcIniFeatureEnabled & 0x2)) { |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3639 | if (!is_vht_cap_in_vendor_ie) |
| 3640 | pAddBssParams->staContext.vhtLdpcCapable = |
| 3641 | (uint8_t) pAssocRsp->VHTCaps.ldpcCodingCap; |
| 3642 | else |
| 3643 | pAddBssParams->staContext.vhtLdpcCapable = |
| 3644 | (uint8_t) vht_caps->ldpcCodingCap; |
| 3645 | } else { |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3646 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
Visweswara Tanuku | 2e2ac03 | 2018-04-12 11:25:11 +0530 | [diff] [blame] | 3647 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | } |
| 3649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | } |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 3651 | if (lim_is_he_6ghz_band(pe_session)) { |
| 3652 | if (lim_is_session_he_capable(pe_session) && |
| 3653 | pAssocRsp->he_cap.present) { |
| 3654 | lim_intersect_ap_he_caps(pe_session, |
| 3655 | pAddBssParams, |
| 3656 | NULL, |
| 3657 | pAssocRsp); |
| 3658 | lim_update_he_stbc_capable(&pAddBssParams->staContext); |
Liangwei Dong | 2b0c18b | 2019-12-10 13:29:53 +0800 | [diff] [blame] | 3659 | lim_update_he_6gop_assoc_resp(pAddBssParams, |
| 3660 | &pAssocRsp->he_op, |
| 3661 | pe_session); |
Amruta Kulkarni | 4edc97d | 2019-12-18 16:13:07 -0800 | [diff] [blame] | 3662 | lim_update_he_6ghz_band_caps(mac, |
| 3663 | &pAssocRsp->he_6ghz_band_cap, |
| 3664 | &pAddBssParams->staContext); |
Kiran Kumar Lokere | 5abc59e | 2019-11-08 17:10:08 -0800 | [diff] [blame] | 3665 | } |
| 3666 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3667 | pAddBssParams->staContext.smesessionId = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3668 | pe_session->smeSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | pAddBssParams->staContext.wpa_rsn = pBeaconStruct->rsnPresent; |
| 3670 | pAddBssParams->staContext.wpa_rsn |= |
| 3671 | (pBeaconStruct->wpaPresent << 1); |
| 3672 | /* For OSEN Connection AP does not advertise RSN or WPA IE |
| 3673 | * so from the IEs we get from supplicant we get this info |
| 3674 | * so for FW to transmit EAPOL message 4 we shall set |
| 3675 | * wpa_rsn |
| 3676 | */ |
| 3677 | if ((!pAddBssParams->staContext.wpa_rsn) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3678 | && (pe_session->isOSENConnection)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3679 | pAddBssParams->staContext.wpa_rsn = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3680 | qdf_mem_copy(&pAddBssParams->staContext.capab_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | &pAssocRsp->capabilityInfo, |
| 3682 | sizeof(pAddBssParams->staContext.capab_info)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3683 | qdf_mem_copy(&pAddBssParams->staContext.ht_caps, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3684 | (uint8_t *) &pAssocRsp->HTCaps + sizeof(uint8_t), |
| 3685 | sizeof(pAddBssParams->staContext.ht_caps)); |
| 3686 | |
| 3687 | /* If WMM IE or 802.11E IE is present then enable WMM */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3688 | if ((pe_session->limWmeEnabled && pAssocRsp->wmeEdcaPresent) || |
| 3689 | (pe_session->limQosEnabled && pAssocRsp->edcaPresent)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3690 | pAddBssParams->staContext.wmmEnabled = 1; |
| 3691 | else |
| 3692 | pAddBssParams->staContext.wmmEnabled = 0; |
| 3693 | |
| 3694 | /* Update the rates */ |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 3695 | sta = dph_get_hash_entry(mac, DPH_STA_HASH_INDEX_PEER, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3696 | &pe_session->dph.dphHashTable); |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3697 | if (sta) { |
Jeff Johnson | ecd4f21 | 2019-02-01 19:36:34 -0800 | [diff] [blame] | 3698 | qdf_mem_copy(&pAddBssParams->staContext.supportedRates, |
| 3699 | &sta->supportedRates, |
| 3700 | sizeof(sta->supportedRates)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3701 | } else |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 3702 | pe_err("could not Update the supported rates"); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3703 | pAddBssParams->staContext.encryptType = pe_session->encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3704 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3705 | pAddBssParams->maxTxPower = pe_session->maxTxPower; |
Abhishek Singh | 9e0b8cd | 2020-02-06 13:35:28 +0530 | [diff] [blame] | 3706 | |
Pragaspathi Thilagaraj | e64714a | 2019-05-23 00:46:25 +0530 | [diff] [blame] | 3707 | if (QDF_P2P_CLIENT_MODE == pe_session->opmode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3708 | pAddBssParams->staContext.p2pCapableSta = 1; |
| 3709 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | pAddBssParams->extSetStaKeyParamValid = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | |
| 3712 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3713 | if (pe_session->limRmfEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | pAddBssParams->rmfEnabled = 1; |
| 3715 | pAddBssParams->staContext.rmfEnabled = 1; |
| 3716 | } |
| 3717 | #endif |
| 3718 | |
| 3719 | /* Set a new state for MLME */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3720 | if (eLIM_MLM_WT_ASSOC_RSP_STATE == pe_session->limMlmState) |
| 3721 | pe_session->limMlmState = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3722 | eLIM_MLM_WT_ADD_BSS_RSP_ASSOC_STATE; |
| 3723 | else |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3724 | pe_session->limMlmState = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3725 | eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE; |
| 3726 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3727 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
| 3728 | pe_session->limMlmState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3729 | |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3730 | if (!pAddBssParams->staContext.htLdpcCapable) |
| 3731 | pAddBssParams->staContext.ht_caps &= |
| 3732 | ~(1 << SIR_MAC_HT_CAP_ADVCODING_S); |
| 3733 | if (!pAddBssParams->staContext.vhtLdpcCapable) |
| 3734 | pAddBssParams->staContext.vht_caps &= |
| 3735 | ~(1 << SIR_MAC_VHT_CAP_LDPC_CODING_CAP); |
| 3736 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3737 | if (pe_session->isNonRoamReassoc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | pAddBssParams->nonRoamReassoc = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | |
Abhishek Singh | 9e0b8cd | 2020-02-06 13:35:28 +0530 | [diff] [blame] | 3740 | pe_debug("update %d MxAmpduDen %d mimoPS %d vht_mcs11 %d shortSlot %d BI %d DTIM %d enc type %d p2p cab STA %d", |
| 3741 | updateEntry, |
| 3742 | pAddBssParams->staContext.maxAmpduDensity, |
| 3743 | pAddBssParams->staContext.mimoPS, |
| 3744 | pAddBssParams->staContext.vht_mcs_10_11_supp, |
| 3745 | pAddBssParams->shortSlotTimeSupported, |
| 3746 | pAddBssParams->beaconInterval, pAddBssParams->dtimPeriod, |
| 3747 | pAddBssParams->staContext.encryptType, |
| 3748 | pAddBssParams->staContext.p2pCapableSta); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 3749 | if (cds_is_5_mhz_enabled()) { |
| 3750 | pAddBssParams->ch_width = CH_WIDTH_5MHZ; |
| 3751 | pAddBssParams->staContext.ch_width = CH_WIDTH_5MHZ; |
| 3752 | } else if (cds_is_10_mhz_enabled()) { |
| 3753 | pAddBssParams->ch_width = CH_WIDTH_10MHZ; |
| 3754 | pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ; |
| 3755 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3756 | lim_set_sta_ctx_twt(&pAddBssParams->staContext, pe_session); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 3757 | |
bings | 1117283 | 2019-05-23 16:41:25 +0800 | [diff] [blame] | 3758 | if (lim_is_fils_connection(pe_session)) |
| 3759 | pAddBssParams->no_ptk_4_way = true; |
Abhishek Singh | 9e0b8cd | 2020-02-06 13:35:28 +0530 | [diff] [blame] | 3760 | |
| 3761 | /* we need to defer the message until we get the response back */ |
| 3762 | SET_LIM_PROCESS_DEFD_MESGS(mac, false); |
bings | 1117283 | 2019-05-23 16:41:25 +0800 | [diff] [blame] | 3763 | |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 3764 | retCode = wma_send_peer_assoc_req(pAddBssParams); |
| 3765 | if (QDF_IS_STATUS_ERROR(retCode)) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3766 | SET_LIM_PROCESS_DEFD_MESGS(mac, true); |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 3767 | pe_err("wma_send_peer_assoc_req failed=%X", |
| 3768 | retCode); |
| 3769 | } |
Abhishek Singh | 6e5c7a6 | 2019-09-18 12:24:54 +0530 | [diff] [blame] | 3770 | qdf_mem_free(pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | |
| 3772 | returnFailure: |
| 3773 | /* Clean-up will be done by the caller... */ |
| 3774 | return retCode; |
| 3775 | } |
| 3776 | |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 3777 | QDF_STATUS lim_sta_send_add_bss_pre_assoc(struct mac_context *mac, |
| 3778 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | { |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3780 | struct bss_params *pAddBssParams = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3781 | uint32_t retCode; |
| 3782 | tSchBeaconStruct *pBeaconStruct; |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3783 | bool chan_width_support = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3784 | tDot11fIEVHTOperation *vht_oper = NULL; |
| 3785 | tDot11fIEVHTCaps *vht_caps = NULL; |
Pragaspathi Thilagaraj | 3cf0f65 | 2018-10-29 16:40:35 +0530 | [diff] [blame] | 3786 | uint32_t listen_interval = MLME_CFG_LISTEN_INTERVAL; |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 3787 | struct bss_description *bssDescription = NULL; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3788 | struct mlme_vht_capabilities_info *vht_cap_info; |
| 3789 | |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 3790 | if (!pe_session->lim_join_req) { |
| 3791 | pe_err("Lim Join request is NULL"); |
| 3792 | return QDF_STATUS_E_FAILURE; |
| 3793 | } |
| 3794 | |
| 3795 | bssDescription = &pe_session->lim_join_req->bssDescription; |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3796 | vht_cap_info = &mac->mlme_cfg->vht_caps.vht_cap_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3797 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3798 | pBeaconStruct = qdf_mem_malloc(sizeof(tSchBeaconStruct)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 3799 | if (!pBeaconStruct) |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3800 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3801 | |
| 3802 | /* Package SIR_HAL_ADD_BSS_REQ message parameters */ |
Jianmin Zhu | f07aa51 | 2019-08-09 18:20:17 +0800 | [diff] [blame] | 3803 | pAddBssParams = qdf_mem_malloc(sizeof(struct bss_params)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 3804 | if (!pAddBssParams) { |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 3805 | retCode = QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3806 | goto returnFailure; |
| 3807 | } |
| 3808 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3809 | lim_extract_ap_capabilities(mac, (uint8_t *) bssDescription->ieFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | lim_get_ielen_from_bss_description(bssDescription), |
| 3811 | pBeaconStruct); |
| 3812 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3813 | if (mac->lim.gLimProtectionControl != |
Pragaspathi Thilagaraj | 1ee7600 | 2018-09-18 21:38:51 +0530 | [diff] [blame] | 3814 | MLME_FORCE_POLICY_PROTECTION_DISABLE) |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3815 | lim_decide_sta_protection_on_assoc(mac, pBeaconStruct, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3816 | pe_session); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3817 | qdf_mem_copy(pAddBssParams->bssId, bssDescription->bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3818 | sizeof(tSirMacAddr)); |
| 3819 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3820 | pAddBssParams->beaconInterval = bssDescription->beaconInterval; |
| 3821 | |
| 3822 | pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod; |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 3823 | pAddBssParams->updateBss = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3825 | pAddBssParams->nwType = bssDescription->nwType; |
| 3826 | |
| 3827 | pAddBssParams->shortSlotTimeSupported = |
| 3828 | (uint8_t) pBeaconStruct->capabilityInfo.shortSlotTime; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3829 | pAddBssParams->llbCoexist = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3830 | (uint8_t) pe_session->beaconParams.llbCoexist; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3831 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3832 | /* Use the advertised capabilities from the received beacon/PR */ |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3833 | if (IS_DOT11_MODE_HT(pe_session->dot11mode)) { |
| 3834 | chan_width_support = |
| 3835 | lim_get_ht_capability(mac, |
| 3836 | eHT_SUPPORTED_CHANNEL_WIDTH_SET, |
| 3837 | pe_session); |
Abhinav Kumar | 4f95958 | 2019-08-13 12:50:20 +0530 | [diff] [blame] | 3838 | lim_sta_add_bss_update_ht_parameter(bssDescription->chan_freq, |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3839 | &pBeaconStruct->HTCaps, |
| 3840 | &pBeaconStruct->HTInfo, |
| 3841 | chan_width_support, |
| 3842 | pAddBssParams); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3843 | } |
| 3844 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3845 | if (pe_session->vhtCapability && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3846 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3847 | IS_BSS_VHT_CAPABLE(pBeaconStruct->vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | |
| 3849 | pAddBssParams->vhtCapable = 1; |
| 3850 | if (pBeaconStruct->VHTOperation.present) |
| 3851 | vht_oper = &pBeaconStruct->VHTOperation; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3852 | else if (pBeaconStruct->vendor_vht_ie.VHTOperation.present) { |
| 3853 | vht_oper = &pBeaconStruct->vendor_vht_ie.VHTOperation; |
Jeff Johnson | 179fd8a | 2018-05-11 14:20:05 -0700 | [diff] [blame] | 3854 | pe_debug("VHT Operation is present in vendor Specific IE"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3855 | } |
| 3856 | |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 3857 | /* |
| 3858 | * in limExtractApCapability function intersection of FW |
| 3859 | * advertised channel width and AP advertised channel width has |
| 3860 | * been taken into account for calculating |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3861 | * pe_session->ch_width |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 3862 | */ |
| 3863 | pAddBssParams->ch_width = |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3864 | pe_session->ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3865 | pAddBssParams->staContext.maxAmpduSize = |
| 3866 | SIR_MAC_GET_VHT_MAX_AMPDU_EXPO( |
| 3867 | pAddBssParams->staContext.vht_caps); |
| 3868 | } else { |
| 3869 | pAddBssParams->vhtCapable = 0; |
| 3870 | } |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3871 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3872 | if (lim_is_session_he_capable(pe_session) && |
Jingxiang Ge | f1d8159 | 2019-10-20 12:03:22 +0800 | [diff] [blame] | 3873 | pBeaconStruct->he_cap.present) { |
| 3874 | lim_update_bss_he_capable(mac, pAddBssParams); |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3875 | lim_add_bss_he_cfg(pAddBssParams, pe_session); |
Jingxiang Ge | f1d8159 | 2019-10-20 12:03:22 +0800 | [diff] [blame] | 3876 | } |
Abhishek Singh | 9e0b8cd | 2020-02-06 13:35:28 +0530 | [diff] [blame] | 3877 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3878 | /* |
| 3879 | * Populate the STA-related parameters here |
| 3880 | * Note that the STA here refers to the AP |
| 3881 | */ |
| 3882 | /* Identifying AP as an STA */ |
| 3883 | pAddBssParams->staContext.staType = STA_ENTRY_OTHER; |
| 3884 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3885 | qdf_mem_copy(pAddBssParams->staContext.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3886 | bssDescription->bssId, sizeof(tSirMacAddr)); |
Bala Venkatesh | 2fde2c6 | 2018-09-11 20:33:24 +0530 | [diff] [blame] | 3887 | |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 3888 | listen_interval = mac->mlme_cfg->sap_cfg.listen_interval; |
Krunal Soni | b3f4542 | 2017-07-24 18:59:45 -0700 | [diff] [blame] | 3889 | pAddBssParams->staContext.listenInterval = listen_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3890 | pAddBssParams->staContext.assocId = 0; |
| 3891 | pAddBssParams->staContext.uAPSD = 0; |
| 3892 | pAddBssParams->staContext.maxSPLen = 0; |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 3893 | pAddBssParams->staContext.updateSta = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3894 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3895 | if (IS_DOT11_MODE_HT(pe_session->dot11mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3896 | && (pBeaconStruct->HTCaps.present)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3897 | pAddBssParams->staContext.htCapable = 1; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3898 | if (pe_session->vhtCapability && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3899 | (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps) || |
| 3900 | IS_BSS_VHT_CAPABLE( |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3901 | pBeaconStruct->vendor_vht_ie.VHTCaps))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3902 | pAddBssParams->staContext.vhtCapable = 1; |
| 3903 | if (pBeaconStruct->VHTCaps.present) |
| 3904 | vht_caps = &pBeaconStruct->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3905 | else if (pBeaconStruct->vendor_vht_ie.VHTCaps.present) |
| 3906 | vht_caps = &pBeaconStruct-> |
| 3907 | vendor_vht_ie.VHTCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3908 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3909 | if ((vht_caps) && (vht_caps->suBeamFormerCap || |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3910 | vht_caps->muBeamformerCap) && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3911 | pe_session->vht_config.su_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3912 | pAddBssParams->staContext.vhtTxBFCapable = 1; |
| 3913 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3914 | if ((vht_caps) && vht_caps->muBeamformerCap && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3915 | pe_session->vht_config.mu_beam_formee) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3916 | pAddBssParams->staContext.vhtTxMUBformeeCapable |
| 3917 | = 1; |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 3918 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3919 | if ((vht_caps) && vht_caps->suBeamformeeCap && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3920 | pe_session->vht_config.su_beam_former) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | pAddBssParams->staContext.enable_su_tx_bformer |
| 3922 | = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3923 | } |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3924 | if (lim_is_session_he_capable(pe_session) && |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 3925 | pBeaconStruct->he_cap.present) |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3926 | lim_intersect_ap_he_caps(pe_session, pAddBssParams, |
Krishna Kumaar Natarajan | 0103ef8 | 2017-02-17 18:15:56 -0800 | [diff] [blame] | 3927 | pBeaconStruct, NULL); |
| 3928 | |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3929 | if (pBeaconStruct->HTCaps.supportedChannelWidthSet && |
| 3930 | chan_width_support) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3931 | pAddBssParams->staContext.ch_width = |
| 3932 | (uint8_t) pBeaconStruct->HTInfo. |
| 3933 | recommendedTxWidthSet; |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3934 | if ((vht_oper) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3935 | pAddBssParams->staContext.vhtCapable && |
| 3936 | vht_oper->chanWidth) |
| 3937 | pAddBssParams->staContext.ch_width = |
| 3938 | vht_oper->chanWidth + 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3939 | } else { |
| 3940 | pAddBssParams->staContext.ch_width = |
| 3941 | CH_WIDTH_20MHZ; |
| 3942 | } |
| 3943 | pAddBssParams->staContext.mimoPS = |
| 3944 | (tSirMacHTMIMOPowerSaveState) pBeaconStruct->HTCaps. |
| 3945 | mimoPowerSave; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3946 | pAddBssParams->staContext.maxAmpduDensity = |
| 3947 | pBeaconStruct->HTCaps.mpduDensity; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3948 | /* |
| 3949 | * We will check gShortGI20Mhz and gShortGI40Mhz from ini file. |
| 3950 | * if they are set then we will use what ever Beacon coming |
| 3951 | * from AP supports. If these values are set as 0 in ini file |
| 3952 | * then we will hardcode this values to 0. |
| 3953 | */ |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3954 | if (pe_session->ht_config.ht_sgi20) |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3955 | pAddBssParams->staContext.fShortGI20Mhz = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3956 | (uint8_t)pBeaconStruct->HTCaps.shortGI20MHz; |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3957 | else |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3958 | pAddBssParams->staContext.fShortGI20Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3959 | |
Jeff Johnson | be119e6 | 2019-02-02 12:30:26 -0800 | [diff] [blame] | 3960 | if (pe_session->ht_config.ht_sgi40) |
Sandeep Puligilla | 607f34a | 2016-05-25 14:37:47 -0700 | [diff] [blame] | 3961 | pAddBssParams->staContext.fShortGI40Mhz = |
| 3962 | (uint8_t) pBeaconStruct->HTCaps.shortGI40MHz; |
| 3963 | else |
| 3964 | pAddBssParams->staContext.fShortGI40Mhz = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3965 | |
| 3966 | pAddBssParams->staContext.maxAmpduSize = |
| 3967 | pBeaconStruct->HTCaps.maxRxAMPDUFactor; |
| 3968 | if (pAddBssParams->staContext.vhtTxBFCapable |
Abhinav Kumar | d4d6eb7 | 2018-12-04 20:30:37 +0530 | [diff] [blame] | 3969 | && vht_cap_info->disable_ldpc_with_txbf_ap) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3971 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
| 3972 | } else { |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3973 | if (pe_session->txLdpcIniFeatureEnabled & 0x1) |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3974 | pAddBssParams->staContext.htLdpcCapable = |
| 3975 | (uint8_t) pBeaconStruct->HTCaps. |
| 3976 | advCodingCap; |
| 3977 | else |
| 3978 | pAddBssParams->staContext.htLdpcCapable = 0; |
| 3979 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3980 | if (pBeaconStruct->VHTCaps.present) |
| 3981 | vht_caps = &pBeaconStruct->VHTCaps; |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3982 | else if (pBeaconStruct->vendor_vht_ie.VHTCaps.present) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3983 | vht_caps = |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 3984 | &pBeaconStruct->vendor_vht_ie.VHTCaps; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | } |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 3986 | if (vht_caps && |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3987 | (pe_session->txLdpcIniFeatureEnabled & 0x2)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3988 | pAddBssParams->staContext.vhtLdpcCapable = |
| 3989 | (uint8_t) vht_caps->ldpcCodingCap; |
Kiran Kumar Lokere | 0413ba4 | 2015-11-03 14:08:09 -0800 | [diff] [blame] | 3990 | else |
| 3991 | pAddBssParams->staContext.vhtLdpcCapable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3992 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | } |
| 3994 | /* |
| 3995 | * If WMM IE or 802.11E IE is not present |
| 3996 | * and AP is HT AP then enable WMM |
| 3997 | */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 3998 | if ((pe_session->limWmeEnabled && (pBeaconStruct->wmeEdcaPresent || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3999 | pAddBssParams->staContext.htCapable)) || |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4000 | (pe_session->limQosEnabled && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4001 | (pBeaconStruct->edcaPresent || |
| 4002 | pAddBssParams->staContext.htCapable))) |
| 4003 | pAddBssParams->staContext.wmmEnabled = 1; |
| 4004 | else |
| 4005 | pAddBssParams->staContext.wmmEnabled = 0; |
| 4006 | |
| 4007 | /* Update the rates */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4008 | lim_populate_peer_rate_set(mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | &pAddBssParams->staContext. |
| 4010 | supportedRates, |
| 4011 | pBeaconStruct->HTCaps.supportedMCSSet, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4012 | false, pe_session, |
Krishna Kumaar Natarajan | d1cd56e | 2016-09-30 08:43:03 -0700 | [diff] [blame] | 4013 | &pBeaconStruct->VHTCaps, |
Pragaspathi Thilagaraj | 4af0b25 | 2020-07-16 19:54:53 +0530 | [diff] [blame] | 4014 | &pBeaconStruct->he_cap, NULL, |
| 4015 | bssDescription); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4016 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4017 | pAddBssParams->staContext.encryptType = pe_session->encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4018 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4019 | pAddBssParams->maxTxPower = pe_session->maxTxPower; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4020 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4021 | pAddBssParams->staContext.smesessionId = pe_session->smeSessionId; |
| 4022 | pAddBssParams->staContext.sessionId = pe_session->peSessionId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | pAddBssParams->extSetStaKeyParamValid = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4024 | |
| 4025 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4026 | if (pe_session->limRmfEnabled) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4027 | pAddBssParams->rmfEnabled = 1; |
| 4028 | pAddBssParams->staContext.rmfEnabled = 1; |
| 4029 | } |
| 4030 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4031 | /* Set a new state for MLME */ |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4032 | pe_session->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_PREASSOC_STATE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | |
| 4034 | MTRACE(mac_trace |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4035 | (mac, TRACE_CODE_MLM_STATE, pe_session->peSessionId, |
| 4036 | pe_session->limMlmState)); |
Naveen Rawat | 64e477e | 2016-05-20 10:34:56 -0700 | [diff] [blame] | 4037 | if (cds_is_5_mhz_enabled()) { |
| 4038 | pAddBssParams->ch_width = CH_WIDTH_5MHZ; |
| 4039 | pAddBssParams->staContext.ch_width = CH_WIDTH_5MHZ; |
| 4040 | } else if (cds_is_10_mhz_enabled()) { |
| 4041 | pAddBssParams->ch_width = CH_WIDTH_10MHZ; |
| 4042 | pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ; |
| 4043 | } |
| 4044 | |
bings | 1117283 | 2019-05-23 16:41:25 +0800 | [diff] [blame] | 4045 | if (lim_is_fils_connection(pe_session)) |
| 4046 | pAddBssParams->no_ptk_4_way = true; |
| 4047 | |
Abhishek Singh | 7944c9a | 2019-09-18 17:55:22 +0530 | [diff] [blame] | 4048 | retCode = wma_pre_assoc_req(pAddBssParams); |
| 4049 | lim_process_sta_add_bss_rsp_pre_assoc(mac, pAddBssParams, |
| 4050 | pe_session, retCode); |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 4051 | qdf_mem_free(pAddBssParams); |
Abhishek Singh | 7944c9a | 2019-09-18 17:55:22 +0530 | [diff] [blame] | 4052 | /* |
| 4053 | * Set retCode sucess as lim_process_sta_add_bss_rsp_pre_assoc take |
| 4054 | * care of failure |
| 4055 | */ |
Jianmin Zhu | 9772c4a | 2019-08-14 16:38:05 +0800 | [diff] [blame] | 4056 | retCode = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4057 | |
| 4058 | returnFailure: |
| 4059 | /* Clean-up will be done by the caller... */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4060 | qdf_mem_free(pBeaconStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | return retCode; |
| 4062 | } |
| 4063 | |
| 4064 | /** |
| 4065 | * lim_prepare_and_send_del_sta_cnf() - prepares and send del sta cnf |
| 4066 | * |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4067 | * @mac: mac global context |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4068 | * @sta: sta dph node |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4069 | * @status_code: status code |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4070 | * @pe_session: session context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4071 | * |
| 4072 | * deletes DPH entry, changes the MLM mode for station, calls |
| 4073 | * lim_send_del_sta_cnf |
| 4074 | * |
| 4075 | * Return: void |
| 4076 | */ |
| 4077 | void |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4078 | lim_prepare_and_send_del_sta_cnf(struct mac_context *mac, tpDphHashNode sta, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4079 | tSirResultCodes status_code, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4080 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | { |
| 4082 | uint16_t staDsAssocId = 0; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4083 | struct qdf_mac_addr sta_dsaddr; |
Pragaspathi Thilagaraj | b3d5253 | 2019-06-22 22:37:55 +0530 | [diff] [blame] | 4084 | struct lim_sta_context mlmStaContext; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4085 | |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4086 | if (!sta) { |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4087 | pe_err("sta is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | return; |
| 4089 | } |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4090 | staDsAssocId = sta->assocId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4091 | qdf_mem_copy((uint8_t *) sta_dsaddr.bytes, |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4092 | sta->staAddr, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4093 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4094 | mlmStaContext = sta->mlmStaContext; |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4095 | if (LIM_IS_AP_ROLE(pe_session)) |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4096 | lim_release_peer_idx(mac, sta->assocId, pe_session); |
Rajeev Kumar | be5d7fd | 2016-04-15 14:35:12 -0700 | [diff] [blame] | 4097 | |
Jeff Johnson | bddc03e | 2019-01-17 15:37:09 -0800 | [diff] [blame] | 4098 | lim_delete_dph_hash_entry(mac, sta->staAddr, sta->assocId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4099 | pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4101 | if (LIM_IS_STA_ROLE(pe_session)) { |
| 4102 | pe_session->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4103 | MTRACE(mac_trace(mac, TRACE_CODE_MLM_STATE, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4104 | pe_session->peSessionId, |
| 4105 | pe_session->limMlmState)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | } |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4107 | lim_send_del_sta_cnf(mac, sta_dsaddr, staDsAssocId, mlmStaContext, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 4108 | status_code, pe_session); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4109 | } |
| 4110 | |
| 4111 | /** ------------------------------------------------------------- |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4112 | \fn lim_init_pre_auth_timer_table |
| 4113 | \brief Initialize the Pre Auth Tanle and creates the timer for |
| 4114 | each node for the timeout value got from cfg. |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4115 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4117 | \return none |
| 4118 | -------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4119 | void lim_init_pre_auth_timer_table(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4120 | tpLimPreAuthTable pPreAuthTimerTable) |
| 4121 | { |
| 4122 | uint32_t cfgValue; |
| 4123 | uint32_t authNodeIdx; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 4124 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4125 | tLimPreAuthNode **pAuthNode = pPreAuthTimerTable->pTable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4126 | |
| 4127 | /* Get AUTH_RSP Timers value */ |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4128 | cfgValue = SYS_MS_TO_TICKS(mac->mlme_cfg->timeouts.auth_rsp_timeout); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | for (authNodeIdx = 0; authNodeIdx < pPreAuthTimerTable->numEntry; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4130 | authNodeIdx++) { |
Jeff Johnson | ab322b9 | 2018-11-21 23:10:49 -0800 | [diff] [blame] | 4131 | if (tx_timer_create(mac, &(pAuthNode[authNodeIdx]->timer), |
Naveen Rawat | 22b1a93 | 2015-08-26 12:13:18 -0700 | [diff] [blame] | 4132 | "AUTH RESPONSE TIMEOUT", |
| 4133 | lim_auth_response_timer_handler, authNodeIdx, |
| 4134 | cfgValue, 0, TX_NO_ACTIVATE) != TX_SUCCESS) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4135 | pe_err("Cannot create Auth Rsp timer of Index: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | authNodeIdx); |
| 4137 | return; |
| 4138 | } |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4139 | pAuthNode[authNodeIdx]->authNodeIdx = (uint8_t) authNodeIdx; |
| 4140 | pAuthNode[authNodeIdx]->fFree = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4141 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4142 | } |
| 4143 | |
| 4144 | /** ------------------------------------------------------------- |
| 4145 | \fn lim_acquire_free_pre_auth_node |
| 4146 | \brief Retrives a free Pre Auth node from Pre Auth Table. |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4147 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4148 | \param tpLimPreAuthTable pPreAuthTimerTable |
| 4149 | \return none |
| 4150 | -------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4151 | tLimPreAuthNode *lim_acquire_free_pre_auth_node(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | tpLimPreAuthTable pPreAuthTimerTable) |
| 4153 | { |
| 4154 | uint32_t i; |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4155 | tLimPreAuthNode **pTempNode = pPreAuthTimerTable->pTable; |
Srinivas Girigowda | 4d65ebe | 2017-10-13 21:41:42 -0700 | [diff] [blame] | 4156 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4157 | for (i = 0; i < pPreAuthTimerTable->numEntry; i++) { |
| 4158 | if (pTempNode[i]->fFree == 1) { |
| 4159 | pTempNode[i]->fFree = 0; |
| 4160 | return pTempNode[i]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4161 | } |
| 4162 | } |
| 4163 | |
| 4164 | return NULL; |
| 4165 | } |
| 4166 | |
| 4167 | /** ------------------------------------------------------------- |
| 4168 | \fn lim_get_pre_auth_node_from_index |
Jeff Johnson | 6201829 | 2018-05-06 16:18:35 -0700 | [diff] [blame] | 4169 | \brief Depending on the Index this retrieves the pre auth node. |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4170 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | \param tpLimPreAuthTable pAuthTable |
| 4172 | \param uint32_t authNodeIdx |
| 4173 | \return none |
| 4174 | -------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4175 | tLimPreAuthNode *lim_get_pre_auth_node_from_index(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4176 | tpLimPreAuthTable pAuthTable, |
| 4177 | uint32_t authNodeIdx) |
| 4178 | { |
| 4179 | if ((authNodeIdx >= pAuthTable->numEntry) |
Jeff Johnson | 8e9530b | 2019-03-18 13:41:42 -0700 | [diff] [blame] | 4180 | || (!pAuthTable->pTable)) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4181 | pe_err("Invalid Auth Timer Index: %d NumEntry: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4182 | authNodeIdx, pAuthTable->numEntry); |
| 4183 | return NULL; |
| 4184 | } |
| 4185 | |
Naveen Rawat | e6ddcaa | 2016-02-05 16:50:18 -0800 | [diff] [blame] | 4186 | return pAuthTable->pTable[authNodeIdx]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4187 | } |
| 4188 | |
| 4189 | /* Util API to check if the channels supported by STA is within range */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4190 | QDF_STATUS lim_is_dot11h_supported_channels_valid(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | tSirAssocReq *assoc) |
| 4192 | { |
| 4193 | /* |
| 4194 | * Allow all the stations to join with us. |
| 4195 | * 802.11h-2003 11.6.1 => An AP may use the supported channels list for associated STAs |
| 4196 | * as an input into an algorithm used to select a new channel for the BSS. |
| 4197 | * The specification of the algorithm is beyond the scope of this amendment. |
| 4198 | */ |
| 4199 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4200 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | } |
| 4202 | |
| 4203 | /* Util API to check if the txpower supported by STA is within range */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4204 | QDF_STATUS lim_is_dot11h_power_capabilities_in_range(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4205 | tSirAssocReq *assoc, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4206 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4207 | { |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 4208 | int8_t localMaxTxPower; |
Wu Gao | 5f76408 | 2019-01-04 15:54:38 +0800 | [diff] [blame] | 4209 | uint8_t local_pwr_constraint; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4210 | |
Amruta Kulkarni | ac761a6 | 2019-11-06 10:41:29 -0800 | [diff] [blame] | 4211 | localMaxTxPower = wlan_reg_get_channel_reg_power_for_freq( |
| 4212 | mac->pdev, pe_session->curr_op_freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4213 | |
Wu Gao | 5f76408 | 2019-01-04 15:54:38 +0800 | [diff] [blame] | 4214 | local_pwr_constraint = mac->mlme_cfg->power.local_power_constraint; |
| 4215 | localMaxTxPower -= (int8_t)local_pwr_constraint; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | |
| 4217 | /** |
| 4218 | * The min Tx Power of the associating station should not be greater than (regulatory |
| 4219 | * max tx power - local power constraint configured on AP). |
| 4220 | */ |
| 4221 | if (assoc->powerCapability.minTxPower > localMaxTxPower) { |
Srinivas Girigowda | 9fad7da | 2017-03-26 13:24:39 -0700 | [diff] [blame] | 4222 | pe_warn("minTxPower (STA): %d, localMaxTxPower (AP): %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4223 | assoc->powerCapability.minTxPower, localMaxTxPower); |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4224 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4225 | } |
| 4226 | |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 4227 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | } |
| 4229 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4230 | void lim_fill_rx_highest_supported_rate(struct mac_context *mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | uint16_t *rxHighestRate, |
| 4232 | uint8_t *pSupportedMCSSet) |
| 4233 | { |
| 4234 | tSirMacRxHighestSupportRate *pRxHighestRate; |
| 4235 | uint8_t *pBuf; |
| 4236 | uint16_t rate = 0; |
| 4237 | |
| 4238 | pBuf = pSupportedMCSSet + MCS_RX_HIGHEST_SUPPORTED_RATE_BYTE_OFFSET; |
| 4239 | rate = lim_get_u16(pBuf); |
| 4240 | |
| 4241 | pRxHighestRate = (tSirMacRxHighestSupportRate *) &rate; |
| 4242 | *rxHighestRate = pRxHighestRate->rate; |
| 4243 | |
| 4244 | return; |
| 4245 | } |
| 4246 | |
| 4247 | #ifdef WLAN_FEATURE_11W |
| 4248 | /** ------------------------------------------------------------- |
| 4249 | \fn lim_send_sme_unprotected_mgmt_frame_ind |
| 4250 | \brief Forwards the unprotected management frame to SME. |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4251 | \param struct mac_context * mac |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4252 | \param frameType - 802.11 frame type |
| 4253 | \param frame - frame buffer |
| 4254 | \param sessionId - id for the current session |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4255 | \param pe_session - PE session context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4256 | \return none |
| 4257 | -------------------------------------------------------------*/ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 4258 | void lim_send_sme_unprotected_mgmt_frame_ind(struct mac_context *mac, uint8_t frameType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | uint8_t *frame, uint32_t frameLen, |
| 4260 | uint16_t sessionId, |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4261 | struct pe_session *pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4262 | { |
Rajeev Kumar | 37d478b | 2017-04-17 16:59:28 -0700 | [diff] [blame] | 4263 | struct scheduler_msg mmhMsg = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4264 | tSirSmeUnprotMgmtFrameInd *pSirSmeMgmtFrame = NULL; |
| 4265 | uint16_t length; |
| 4266 | |
| 4267 | length = sizeof(tSirSmeUnprotMgmtFrameInd) + frameLen; |
| 4268 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4269 | pSirSmeMgmtFrame = qdf_mem_malloc(length); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 4270 | if (!pSirSmeMgmtFrame) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4271 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4272 | |
| 4273 | pSirSmeMgmtFrame->sessionId = sessionId; |
| 4274 | pSirSmeMgmtFrame->frameType = frameType; |
| 4275 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4276 | qdf_mem_copy(pSirSmeMgmtFrame->frameBuf, frame, frameLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | pSirSmeMgmtFrame->frameLen = frameLen; |
| 4278 | |
| 4279 | mmhMsg.type = eWNI_SME_UNPROT_MGMT_FRM_IND; |
| 4280 | mmhMsg.bodyptr = pSirSmeMgmtFrame; |
| 4281 | mmhMsg.bodyval = 0; |
| 4282 | |
Jeff Johnson | a5abe27 | 2019-01-06 12:52:02 -0800 | [diff] [blame] | 4283 | lim_sys_process_mmh_msg_api(mac, &mmhMsg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4284 | return; |
| 4285 | } |
| 4286 | #endif |
| 4287 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4288 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | e21b0eb | 2019-02-02 19:31:54 -0800 | [diff] [blame] | 4289 | void lim_send_sme_tsm_ie_ind(struct mac_context *mac, |
| 4290 | struct pe_session *pe_session, |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4291 | uint8_t tid, uint8_t state, |
| 4292 | uint16_t measurement_interval) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4293 | { |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4294 | struct scheduler_msg msg = {0}; |
| 4295 | struct tsm_ie_ind *tsm_ie_ind; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | |
Jeff Johnson | b5c1333 | 2018-12-03 09:54:51 -0800 | [diff] [blame] | 4297 | if (!mac || !pe_session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | return; |
| 4299 | |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4300 | tsm_ie_ind = qdf_mem_malloc(sizeof(*tsm_ie_ind)); |
| 4301 | if (!tsm_ie_ind) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4302 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4303 | |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4304 | tsm_ie_ind->sessionId = pe_session->smeSessionId; |
| 4305 | tsm_ie_ind->tsm_ie.tsid = tid; |
| 4306 | tsm_ie_ind->tsm_ie.state = state; |
| 4307 | tsm_ie_ind->tsm_ie.msmt_interval = measurement_interval; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4308 | |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4309 | msg.type = eWNI_SME_TSM_IE_IND; |
| 4310 | msg.bodyptr = tsm_ie_ind; |
| 4311 | msg.bodyval = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4312 | |
Jeff Johnson | 4f1b915 | 2019-02-02 19:58:08 -0800 | [diff] [blame] | 4313 | lim_sys_process_mmh_msg_api(mac, &msg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4315 | #endif /* FEATURE_WLAN_ESE */ |
Srinivas Dasari | d4e8725 | 2019-07-01 15:35:52 +0530 | [diff] [blame] | 4316 | |
| 4317 | void lim_extract_ies_from_deauth_disassoc(struct pe_session *session, |
| 4318 | uint8_t *deauth_disassoc_frame, |
| 4319 | uint16_t deauth_disassoc_frame_len) |
| 4320 | { |
| 4321 | uint16_t reason_code, ie_offset; |
| 4322 | struct wlan_ies ie; |
| 4323 | |
| 4324 | if (!session) { |
| 4325 | pe_err("NULL session"); |
| 4326 | return; |
| 4327 | } |
| 4328 | |
| 4329 | /* Get the offset of IEs */ |
| 4330 | ie_offset = sizeof(struct wlan_frame_hdr) + sizeof(reason_code); |
| 4331 | |
| 4332 | if (!deauth_disassoc_frame || deauth_disassoc_frame_len <= ie_offset) |
| 4333 | return; |
| 4334 | |
| 4335 | ie.data = deauth_disassoc_frame + ie_offset; |
| 4336 | ie.len = deauth_disassoc_frame_len - ie_offset; |
| 4337 | |
| 4338 | mlme_set_peer_disconnect_ies(session->vdev, &ie); |
| 4339 | } |
| 4340 | |