Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 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 | * |
| 21 | * This file lim_prop_exts_utils.cc contains the utility functions |
| 22 | * to populate, parse proprietary extensions required to |
| 23 | * support ANI feature set. |
| 24 | * |
| 25 | * Author: Chandra Modumudi |
| 26 | * Date: 11/27/02 |
| 27 | * History:- |
| 28 | * Date Modified by Modification Information |
| 29 | * -------------------------------------------------------------------- |
| 30 | * |
| 31 | */ |
| 32 | #include "ani_global.h" |
| 33 | #include "wni_cfg.h" |
| 34 | #include "sir_common.h" |
| 35 | #include "sir_debug.h" |
| 36 | #include "utils_api.h" |
| 37 | #include "cfg_api.h" |
| 38 | #include "lim_api.h" |
| 39 | #include "lim_types.h" |
| 40 | #include "lim_utils.h" |
| 41 | #include "lim_assoc_utils.h" |
| 42 | #include "lim_prop_exts_utils.h" |
| 43 | #include "lim_ser_des_utils.h" |
| 44 | #include "lim_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include "lim_ft_defs.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 46 | #include "lim_session.h" |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 47 | #include "wma.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 48 | #include "wlan_utility.h" |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 49 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 50 | #define LIM_GET_NOISE_MAX_TRY 5 |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 51 | |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 52 | #ifdef FEATURE_WLAN_ESE |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 53 | /** |
| 54 | * get_local_power_constraint_probe_response() - extracts local constraint |
| 55 | * from probe response |
| 56 | * @beacon_struct: beacon structure |
| 57 | * @local_constraint: local constraint pointer |
| 58 | * @session: A pointer to session entry. |
| 59 | * |
| 60 | * Return: None |
| 61 | */ |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 62 | static void get_local_power_constraint_probe_response( |
| 63 | tpSirProbeRespBeacon beacon_struct, |
| 64 | int8_t *local_constraint, |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 65 | struct pe_session *session) |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 66 | { |
| 67 | if (beacon_struct->eseTxPwr.present) |
| 68 | *local_constraint = |
| 69 | beacon_struct->eseTxPwr.power_limit; |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | /** |
| 73 | * get_ese_version_ie_probe_response() - extracts ESE version IE |
| 74 | * from probe response |
| 75 | * @beacon_struct: beacon structure |
| 76 | * @session: A pointer to session entry. |
| 77 | * |
| 78 | * Return: None |
| 79 | */ |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 80 | static void get_ese_version_ie_probe_response(struct mac_context *mac_ctx, |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 81 | tpSirProbeRespBeacon beacon_struct, |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 82 | struct pe_session *session) |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 83 | { |
Wu Gao | 51a6356 | 2018-11-08 16:29:10 +0800 | [diff] [blame] | 84 | if (mac_ctx->mlme_cfg->lfr.ese_enabled) |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 85 | session->is_ese_version_ie_present = |
| 86 | beacon_struct->is_ese_ver_ie_present; |
| 87 | } |
| 88 | #else |
| 89 | static void get_local_power_constraint_probe_response( |
| 90 | tpSirProbeRespBeacon beacon_struct, |
| 91 | int8_t *local_constraint, |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 92 | struct pe_session *session) |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 93 | { |
| 94 | |
| 95 | } |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 96 | |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 97 | static inline void get_ese_version_ie_probe_response(struct mac_context *mac_ctx, |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 98 | tpSirProbeRespBeacon beacon_struct, |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 99 | struct pe_session *session) |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 100 | { |
| 101 | } |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 102 | #endif |
| 103 | |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 104 | #ifdef WLAN_FEATURE_11AX |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 105 | static void lim_extract_he_op(struct pe_session *session, |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 106 | tSirProbeRespBeacon *beacon_struct) |
| 107 | { |
| 108 | if (session->he_capable && beacon_struct->he_op.present) { |
| 109 | qdf_mem_copy(&session->he_op, &beacon_struct->he_op, |
| 110 | sizeof(session->he_op)); |
| 111 | pe_debug("he_op.bss_color %d", session->he_op.bss_color); |
| 112 | pe_debug("he_op.default_pe %d", session->he_op.default_pe); |
| 113 | } |
| 114 | } |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 115 | |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 116 | static bool lim_check_he_80_mcs11_supp(struct pe_session *session, |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 117 | tSirProbeRespBeacon *beacon_struct) { |
| 118 | uint8_t rx_mcs_map; |
| 119 | uint8_t tx_mcs_map; |
| 120 | rx_mcs_map = beacon_struct->he_cap.rx_he_mcs_map_lt_80; |
| 121 | tx_mcs_map = beacon_struct->he_cap.tx_he_mcs_map_lt_80; |
| 122 | if ((session->nss == NSS_1x1_MODE) && |
| 123 | ((HE_GET_MCS_4_NSS(rx_mcs_map, 1) == HE_MCS_0_11) || |
| 124 | (HE_GET_MCS_4_NSS(tx_mcs_map, 1) == HE_MCS_0_11))) |
| 125 | return true; |
| 126 | |
| 127 | if ((session->nss == NSS_2x2_MODE) && |
| 128 | ((HE_GET_MCS_4_NSS(rx_mcs_map, 2) == HE_MCS_0_11) || |
| 129 | (HE_GET_MCS_4_NSS(tx_mcs_map, 2) == HE_MCS_0_11))) |
| 130 | return true; |
| 131 | |
| 132 | return false; |
| 133 | } |
| 134 | |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 135 | static void lim_check_he_ldpc_cap(struct pe_session *session, |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 136 | tSirProbeRespBeacon *beacon_struct) |
| 137 | { |
| 138 | if (session->he_capable && beacon_struct->he_cap.present) { |
| 139 | if (beacon_struct->he_cap.ldpc_coding) |
| 140 | return; |
| 141 | else if ((session->ch_width == CH_WIDTH_20MHZ) && |
| 142 | !lim_check_he_80_mcs11_supp(session, |
| 143 | beacon_struct)) |
| 144 | return; |
| 145 | session->he_capable = false; |
| 146 | pe_err("LDPC check failed for HE operation"); |
| 147 | if (session->vhtCapability) { |
| 148 | session->dot11mode = WNI_CFG_DOT11_MODE_11AC; |
| 149 | pe_debug("Update dot11mode to 11ac"); |
| 150 | } else { |
| 151 | session->dot11mode = WNI_CFG_DOT11_MODE_11N; |
| 152 | pe_debug("Update dot11mode to 11N"); |
| 153 | } |
| 154 | } |
| 155 | } |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 156 | #else |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 157 | static inline void lim_extract_he_op(struct pe_session *session, |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 158 | tSirProbeRespBeacon *beacon_struct) |
| 159 | {} |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 160 | static void lim_check_he_ldpc_cap(struct pe_session *session, |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 161 | tSirProbeRespBeacon *beacon_struct) |
| 162 | {} |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 163 | #endif |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 164 | |
| 165 | static void lim_objmgr_update_vdev_nss(struct wlan_objmgr_psoc *psoc, |
| 166 | uint8_t vdev_id, uint8_t nss) |
| 167 | { |
| 168 | struct wlan_objmgr_vdev *vdev; |
| 169 | |
| 170 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, |
| 171 | WLAN_LEGACY_MAC_ID); |
| 172 | if (!vdev) { |
| 173 | pe_err("vdev not found for id: %d", vdev_id); |
| 174 | return; |
| 175 | } |
| 176 | wlan_vdev_obj_lock(vdev); |
| 177 | wlan_vdev_mlme_set_nss(vdev, nss); |
| 178 | wlan_vdev_obj_unlock(vdev); |
| 179 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID); |
| 180 | } |
Vignesh Viswanathan | 0942935 | 2017-08-10 14:48:58 +0530 | [diff] [blame] | 181 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | * lim_extract_ap_capability() - extract AP's HCF/WME/WSM capability |
| 183 | * @mac_ctx: Pointer to Global MAC structure |
| 184 | * @p_ie: Pointer to starting IE in Beacon/Probe Response |
| 185 | * @ie_len: Length of all IEs combined |
| 186 | * @qos_cap: Bits are set according to capabilities |
| 187 | * @prop_cap: Pointer to prop info IE. |
| 188 | * @uapsd: pointer to uapsd |
| 189 | * @local_constraint: Pointer to local power constraint. |
| 190 | * @session: A pointer to session entry. |
| 191 | * |
| 192 | * This function is called to extract AP's HCF/WME/WSM capability |
| 193 | * from the IEs received from it in Beacon/Probe Response frames |
| 194 | * |
| 195 | * Return: None |
| 196 | */ |
| 197 | void |
Jeff Johnson | 9320c1e | 2018-12-02 13:09:20 -0800 | [diff] [blame] | 198 | lim_extract_ap_capability(struct mac_context *mac_ctx, uint8_t *p_ie, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 199 | uint16_t ie_len, uint8_t *qos_cap, uint16_t *prop_cap, uint8_t *uapsd, |
Jeff Johnson | 32ce2ff | 2018-11-18 22:08:58 -0800 | [diff] [blame] | 200 | int8_t *local_constraint, struct pe_session *session) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 201 | { |
| 202 | tSirProbeRespBeacon *beacon_struct; |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 203 | uint8_t ap_bcon_ch_width; |
| 204 | bool new_ch_width_dfn = false; |
| 205 | tDot11fIEVHTOperation *vht_op; |
| 206 | uint8_t fw_vht_ch_wd; |
| 207 | uint8_t vht_ch_wd; |
| 208 | uint8_t center_freq_diff; |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 209 | struct s_ext_cap *ext_cap; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 210 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 211 | beacon_struct = qdf_mem_malloc(sizeof(tSirProbeRespBeacon)); |
Arif Hussain | f5b6c41 | 2018-10-10 19:41:09 -0700 | [diff] [blame] | 212 | if (!beacon_struct) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 213 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 214 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 215 | *qos_cap = 0; |
| 216 | *prop_cap = 0; |
| 217 | *uapsd = 0; |
Srinivas Girigowda | 09625b0 | 2018-09-10 15:28:09 -0700 | [diff] [blame] | 218 | pe_debug("The IE's being received:"); |
Srinivas Girigowda | b896a56 | 2017-03-16 17:41:26 -0700 | [diff] [blame] | 219 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG, |
| 220 | p_ie, ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 221 | if (sir_parse_beacon_ie(mac_ctx, beacon_struct, p_ie, |
Jeff Johnson | 0301ecb | 2018-06-29 09:36:23 -0700 | [diff] [blame] | 222 | (uint32_t) ie_len) != QDF_STATUS_SUCCESS) { |
Nishank Aggarwal | be2cb79 | 2017-03-23 16:16:28 +0530 | [diff] [blame] | 223 | pe_err("sir_parse_beacon_ie failed to parse beacon"); |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 224 | qdf_mem_free(beacon_struct); |
| 225 | return; |
| 226 | } |
Paul Zhang | 42dade0 | 2017-05-12 19:20:37 +0800 | [diff] [blame] | 227 | |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 228 | if (beacon_struct->wmeInfoPresent || |
| 229 | beacon_struct->wmeEdcaPresent || |
| 230 | beacon_struct->HTCaps.present) |
| 231 | LIM_BSS_CAPS_SET(WME, *qos_cap); |
| 232 | if (LIM_BSS_CAPS_GET(WME, *qos_cap) |
| 233 | && beacon_struct->wsmCapablePresent) |
| 234 | LIM_BSS_CAPS_SET(WSM, *qos_cap); |
| 235 | if (beacon_struct->propIEinfo.capabilityPresent) |
| 236 | *prop_cap = beacon_struct->propIEinfo.capability; |
| 237 | if (beacon_struct->HTCaps.present) |
| 238 | mac_ctx->lim.htCapabilityPresentInBeacon = 1; |
| 239 | else |
| 240 | mac_ctx->lim.htCapabilityPresentInBeacon = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 241 | |
Nishank Aggarwal | be2cb79 | 2017-03-23 16:16:28 +0530 | [diff] [blame] | 242 | pe_debug("Bcon: VHTCap.present: %d SU Beamformer: %d BSS_VHT_CAPABLE: %d", |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 243 | beacon_struct->VHTCaps.present, |
| 244 | beacon_struct->VHTCaps.suBeamFormerCap, |
| 245 | IS_BSS_VHT_CAPABLE(beacon_struct->VHTCaps)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 247 | vht_op = &beacon_struct->VHTOperation; |
| 248 | if (IS_BSS_VHT_CAPABLE(beacon_struct->VHTCaps) && |
| 249 | vht_op->present && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 250 | session->vhtCapability) { |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 251 | session->vhtCapabilityPresentInBeacon = 1; |
| 252 | if (((beacon_struct->Vendor1IEPresent && |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 253 | beacon_struct->vendor_vht_ie.present && |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 254 | beacon_struct->Vendor3IEPresent)) && |
| 255 | (((beacon_struct->VHTCaps.txMCSMap & VHT_MCS_3x3_MASK) == |
| 256 | VHT_MCS_3x3_MASK) && |
| 257 | ((beacon_struct->VHTCaps.txMCSMap & VHT_MCS_2x2_MASK) != |
| 258 | VHT_MCS_2x2_MASK))) |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 259 | session->vht_config.su_beam_formee = 0; |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 260 | } else { |
| 261 | session->vhtCapabilityPresentInBeacon = 0; |
| 262 | } |
| 263 | |
| 264 | if (session->vhtCapabilityPresentInBeacon == 1 && |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 265 | !session->htSupportedChannelWidthSet) { |
Kiran Kumar Lokere | eaaa346 | 2018-11-01 19:03:23 -0700 | [diff] [blame] | 266 | if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable_txbf_20mhz) |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 267 | session->vht_config.su_beam_formee = 0; |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 268 | } else if (session->vhtCapabilityPresentInBeacon && |
| 269 | vht_op->chanWidth) { |
| 270 | /* If VHT is supported min 80 MHz support is must */ |
| 271 | ap_bcon_ch_width = vht_op->chanWidth; |
| 272 | if ((ap_bcon_ch_width == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) && |
| 273 | vht_op->chanCenterFreqSeg2) { |
| 274 | new_ch_width_dfn = true; |
| 275 | if (vht_op->chanCenterFreqSeg2 > |
| 276 | vht_op->chanCenterFreqSeg1) |
| 277 | center_freq_diff = vht_op->chanCenterFreqSeg2 - |
| 278 | vht_op->chanCenterFreqSeg1; |
| 279 | else |
| 280 | center_freq_diff = vht_op->chanCenterFreqSeg1 - |
| 281 | vht_op->chanCenterFreqSeg2; |
| 282 | if (center_freq_diff == 8) |
| 283 | ap_bcon_ch_width = |
| 284 | WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ; |
| 285 | else if (center_freq_diff > 16) |
| 286 | ap_bcon_ch_width = |
| 287 | WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 288 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 289 | |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 290 | fw_vht_ch_wd = wma_get_vht_ch_width(); |
| 291 | vht_ch_wd = QDF_MIN(fw_vht_ch_wd, ap_bcon_ch_width); |
| 292 | /* |
Kiran Kumar Lokere | 9e58d23 | 2016-08-23 18:49:16 -0700 | [diff] [blame] | 293 | * If the supported channel width is greater than 80MHz and |
| 294 | * AP supports Nss > 1 in 160MHz mode then connect the STA |
| 295 | * in 2x2 80MHz mode instead of connecting in 160MHz mode. |
| 296 | */ |
Kiran Kumar Lokere | 1aa9c9a | 2016-10-05 18:50:59 -0700 | [diff] [blame] | 297 | if ((vht_ch_wd > WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) && |
Wu Gao | 9381621 | 2018-08-31 16:49:54 +0800 | [diff] [blame] | 298 | mac_ctx->mlme_cfg->sta.sta_prefer_80mhz_over_160mhz) { |
Kiran Kumar Lokere | 9e58d23 | 2016-08-23 18:49:16 -0700 | [diff] [blame] | 299 | if (!(IS_VHT_NSS_1x1(beacon_struct->VHTCaps.txMCSMap)) |
| 300 | && |
| 301 | (!IS_VHT_NSS_1x1(beacon_struct->VHTCaps.rxMCSMap))) |
| 302 | vht_ch_wd = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ; |
| 303 | } |
| 304 | /* |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 305 | * VHT OP IE old definition: |
| 306 | * vht_op->chanCenterFreqSeg1: center freq of 80MHz/160MHz/ |
| 307 | * primary 80 in 80+80MHz. |
| 308 | * |
| 309 | * vht_op->chanCenterFreqSeg2: center freq of secondary 80 |
| 310 | * in 80+80MHz. |
| 311 | * |
| 312 | * VHT OP IE NEW definition: |
| 313 | * vht_op->chanCenterFreqSeg1: center freq of 80MHz/primary |
| 314 | * 80 in 80+80MHz/center freq of the 80 MHz channel segment |
| 315 | * that contains the primary channel in 160MHz mode. |
| 316 | * |
| 317 | * vht_op->chanCenterFreqSeg2: center freq of secondary 80 |
| 318 | * in 80+80MHz/center freq of 160MHz. |
| 319 | */ |
| 320 | session->ch_center_freq_seg0 = vht_op->chanCenterFreqSeg1; |
| 321 | session->ch_center_freq_seg1 = vht_op->chanCenterFreqSeg2; |
| 322 | if (vht_ch_wd == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) { |
| 323 | /* DUT or AP supports only 160MHz */ |
| 324 | if (ap_bcon_ch_width == |
| 325 | WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) { |
| 326 | /* AP is in 160MHz mode */ |
| 327 | if (!new_ch_width_dfn) { |
| 328 | session->ch_center_freq_seg1 = |
| 329 | vht_op->chanCenterFreqSeg1; |
| 330 | session->ch_center_freq_seg0 = |
| 331 | lim_get_80Mhz_center_channel( |
| 332 | beacon_struct->channelNumber); |
| 333 | } |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 334 | } else { |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 335 | /* DUT supports only 160MHz and AP is |
| 336 | * in 80+80 mode |
| 337 | */ |
| 338 | vht_ch_wd = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ; |
| 339 | session->ch_center_freq_seg1 = 0; |
| 340 | } |
| 341 | } else if (vht_ch_wd == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) { |
| 342 | /* DUT or AP supports only 80MHz */ |
| 343 | if (ap_bcon_ch_width == |
| 344 | WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ && |
| 345 | !new_ch_width_dfn) |
| 346 | /* AP is in 160MHz mode */ |
Naveen Rawat | c0c91cd | 2015-11-05 14:27:37 -0800 | [diff] [blame] | 347 | session->ch_center_freq_seg0 = |
| 348 | lim_get_80Mhz_center_channel( |
| 349 | beacon_struct->channelNumber); |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 350 | else |
| 351 | session->ch_center_freq_seg1 = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 352 | } |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 353 | session->ch_width = vht_ch_wd + 1; |
Nishank Aggarwal | be2cb79 | 2017-03-23 16:16:28 +0530 | [diff] [blame] | 354 | pe_debug("cntr_freq0: %d cntr_freq1: %d width: %d", |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 355 | session->ch_center_freq_seg0, |
| 356 | session->ch_center_freq_seg1, |
| 357 | session->ch_width); |
| 358 | if (CH_WIDTH_80MHZ < session->ch_width) { |
Krunal Soni | 53993f7 | 2016-07-08 18:20:03 -0700 | [diff] [blame] | 359 | session->vht_config.su_beam_former = 0; |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 360 | session->nss = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 361 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | } |
Naveen Rawat | 0cc24ab | 2016-11-10 15:12:18 -0800 | [diff] [blame] | 363 | |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 364 | if (session->vhtCapability && |
| 365 | session->vhtCapabilityPresentInBeacon && |
| 366 | beacon_struct->ext_cap.present) { |
| 367 | ext_cap = (struct s_ext_cap *)beacon_struct->ext_cap.bytes; |
| 368 | session->gLimOperatingMode.present = |
| 369 | ext_cap->oper_mode_notification; |
| 370 | if (ext_cap->oper_mode_notification) { |
| 371 | if (CH_WIDTH_160MHZ > session->ch_width) |
| 372 | session->gLimOperatingMode.chanWidth = |
| 373 | session->ch_width; |
| 374 | else |
| 375 | session->gLimOperatingMode.chanWidth = |
| 376 | CH_WIDTH_160MHZ; |
| 377 | } else { |
Nishank Aggarwal | be2cb79 | 2017-03-23 16:16:28 +0530 | [diff] [blame] | 378 | pe_err("AP does not support op_mode rx"); |
Kiran Kumar Lokere | 1d4094e | 2016-08-31 19:04:04 -0700 | [diff] [blame] | 379 | } |
| 380 | } |
Kiran Kumar Lokere | 59a569e | 2018-01-24 15:00:50 -0800 | [diff] [blame] | 381 | lim_check_he_ldpc_cap(session, beacon_struct); |
Kiran Kumar Lokere | e6476b2 | 2017-10-16 23:40:32 -0700 | [diff] [blame] | 382 | lim_extract_he_op(session, beacon_struct); |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 383 | /* Extract the UAPSD flag from WMM Parameter element */ |
| 384 | if (beacon_struct->wmeEdcaPresent) |
| 385 | *uapsd = beacon_struct->edcaParams.qosInfo.uapsd; |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 386 | |
Wu Gao | 4f8938a | 2018-11-26 11:49:00 +0800 | [diff] [blame] | 387 | if (mac_ctx->mlme_cfg->sta.allow_tpc_from_ap) { |
Padma, Santhosh Kumar | 29df362 | 2016-08-16 19:15:16 +0530 | [diff] [blame] | 388 | if (beacon_struct->powerConstraintPresent) { |
| 389 | *local_constraint -= |
| 390 | beacon_struct->localPowerConstraint. |
| 391 | localPowerConstraints; |
| 392 | } else { |
| 393 | get_local_power_constraint_probe_response( |
| 394 | beacon_struct, local_constraint, session); |
| 395 | } |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 396 | } |
Selvaraj, Sridhar | 40fcc69 | 2017-05-04 16:32:20 +0530 | [diff] [blame] | 397 | |
| 398 | get_ese_version_ie_probe_response(mac_ctx, beacon_struct, session); |
| 399 | |
Kiran Kumar Lokere | 02b9aa4 | 2016-05-26 14:54:49 -0700 | [diff] [blame] | 400 | session->country_info_present = false; |
| 401 | /* Initializing before first use */ |
| 402 | if (beacon_struct->countryInfoPresent) |
| 403 | session->country_info_present = true; |
Agrawal Ashish | 0f94b57 | 2016-02-22 13:27:06 +0530 | [diff] [blame] | 404 | /* Check if Extended caps are present in probe resp or not */ |
| 405 | if (beacon_struct->ext_cap.present) |
| 406 | session->is_ext_caps_present = true; |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 407 | /* Update HS 2.0 Information Element */ |
| 408 | if (beacon_struct->hs20vendor_ie.present) { |
Nishank Aggarwal | be2cb79 | 2017-03-23 16:16:28 +0530 | [diff] [blame] | 409 | pe_debug("HS20 Indication Element Present, rel#: %u id: %u", |
Nitesh Shah | 0ddd4f6 | 2016-05-27 10:07:32 +0530 | [diff] [blame] | 410 | beacon_struct->hs20vendor_ie.release_num, |
| 411 | beacon_struct->hs20vendor_ie.hs_id_present); |
| 412 | qdf_mem_copy(&session->hs20vendor_ie, |
| 413 | &beacon_struct->hs20vendor_ie, |
| 414 | sizeof(tDot11fIEhs20vendor_ie) - |
| 415 | sizeof(beacon_struct->hs20vendor_ie.hs_id)); |
| 416 | if (beacon_struct->hs20vendor_ie.hs_id_present) |
| 417 | qdf_mem_copy(&session->hs20vendor_ie.hs_id, |
| 418 | &beacon_struct->hs20vendor_ie.hs_id, |
| 419 | sizeof(beacon_struct->hs20vendor_ie.hs_id)); |
| 420 | } |
Naveen Rawat | fa2a100 | 2018-05-17 16:06:37 -0700 | [diff] [blame] | 421 | |
| 422 | lim_objmgr_update_vdev_nss(mac_ctx->psoc, session->smeSessionId, |
| 423 | session->nss); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 424 | qdf_mem_free(beacon_struct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 425 | return; |
| 426 | } /****** end lim_extract_ap_capability() ******/ |
| 427 | |
| 428 | /** |
| 429 | * lim_get_htcb_state |
| 430 | * |
| 431 | ***FUNCTION: |
| 432 | * This routing provides the translation of Airgo Enum to HT enum for determining |
| 433 | * secondary channel offset. |
| 434 | * Airgo Enum is required for backward compatibility purposes. |
| 435 | * |
| 436 | * |
| 437 | ***NOTE: |
| 438 | * |
Jeff Johnson | 348973e | 2018-11-22 16:51:12 -0800 | [diff] [blame] | 439 | * @param mac - Pointer to Global MAC structure |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 440 | * @return The corresponding HT enumeration |
| 441 | */ |
| 442 | ePhyChanBondState lim_get_htcb_state(ePhyChanBondState aniCBMode) |
| 443 | { |
| 444 | switch (aniCBMode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 445 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW: |
| 446 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED: |
| 447 | case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 448 | case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: |
| 449 | return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 450 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW: |
| 451 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED: |
| 452 | case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 453 | case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: |
| 454 | return PHY_DOUBLE_CHANNEL_LOW_PRIMARY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 455 | case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED: |
| 456 | return PHY_SINGLE_CHANNEL_CENTERED; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 457 | default: |
| 458 | return PHY_SINGLE_CHANNEL_CENTERED; |
| 459 | } |
| 460 | } |