blob: 12735b1e46c746d7760c1153fdd9bec6fc299a8f [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Kiran Kumar Lokere59a569e2018-01-24 15:00:50 -08002 * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08004 * 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 Dhavali7090c5f2015-11-02 17:55:19 -080020 *
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 Dhavali7090c5f2015-11-02 17:55:19 -080045#include "lim_ft_defs.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080046#include "lim_session.h"
Naveen Rawatc0c91cd2015-11-05 14:27:37 -080047#include "wma.h"
Naveen Rawat08db88f2017-09-08 15:07:48 -070048#include "wlan_utility.h"
Naveen Rawatc0c91cd2015-11-05 14:27:37 -080049
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080050#define LIM_GET_NOISE_MAX_TRY 5
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +053051
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053052#ifdef FEATURE_WLAN_ESE
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +053053/**
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 Kumar29df3622016-08-16 19:15:16 +053062static void get_local_power_constraint_probe_response(
63 tpSirProbeRespBeacon beacon_struct,
64 int8_t *local_constraint,
Jeff Johnson32ce2ff2018-11-18 22:08:58 -080065 struct pe_session *session)
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +053066{
67 if (beacon_struct->eseTxPwr.present)
68 *local_constraint =
69 beacon_struct->eseTxPwr.power_limit;
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053070}
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 Johnson9320c1e2018-12-02 13:09:20 -080080static void get_ese_version_ie_probe_response(struct mac_context *mac_ctx,
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053081 tpSirProbeRespBeacon beacon_struct,
Jeff Johnson32ce2ff2018-11-18 22:08:58 -080082 struct pe_session *session)
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053083{
Wu Gao51a63562018-11-08 16:29:10 +080084 if (mac_ctx->mlme_cfg->lfr.ese_enabled)
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +053085 session->is_ese_version_ie_present =
86 beacon_struct->is_ese_ver_ie_present;
87}
88#else
89static void get_local_power_constraint_probe_response(
90 tpSirProbeRespBeacon beacon_struct,
91 int8_t *local_constraint,
Jeff Johnson32ce2ff2018-11-18 22:08:58 -080092 struct pe_session *session)
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +053093{
94
95}
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053096
Jeff Johnson9320c1e2018-12-02 13:09:20 -080097static inline void get_ese_version_ie_probe_response(struct mac_context *mac_ctx,
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +053098 tpSirProbeRespBeacon beacon_struct,
Jeff Johnson32ce2ff2018-11-18 22:08:58 -080099 struct pe_session *session)
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +0530100{
101}
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +0530102#endif
103
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -0700104#ifdef WLAN_FEATURE_11AX
Jeff Johnson32ce2ff2018-11-18 22:08:58 -0800105static void lim_extract_he_op(struct pe_session *session,
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -0700106 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 Lokere59a569e2018-01-24 15:00:50 -0800115
Jeff Johnson32ce2ff2018-11-18 22:08:58 -0800116static bool lim_check_he_80_mcs11_supp(struct pe_session *session,
Kiran Kumar Lokere59a569e2018-01-24 15:00:50 -0800117 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 Johnson32ce2ff2018-11-18 22:08:58 -0800135static void lim_check_he_ldpc_cap(struct pe_session *session,
Kiran Kumar Lokere59a569e2018-01-24 15:00:50 -0800136 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 Lokeree6476b22017-10-16 23:40:32 -0700156#else
Jeff Johnson32ce2ff2018-11-18 22:08:58 -0800157static inline void lim_extract_he_op(struct pe_session *session,
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -0700158 tSirProbeRespBeacon *beacon_struct)
159{}
Jeff Johnson32ce2ff2018-11-18 22:08:58 -0800160static void lim_check_he_ldpc_cap(struct pe_session *session,
Kiran Kumar Lokere59a569e2018-01-24 15:00:50 -0800161 tSirProbeRespBeacon *beacon_struct)
162{}
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -0700163#endif
Naveen Rawatfa2a1002018-05-17 16:06:37 -0700164
165static 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 Viswanathan09429352017-08-10 14:48:58 +0530181/**
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800182 * 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 */
197void
Jeff Johnson9320c1e2018-12-02 13:09:20 -0800198lim_extract_ap_capability(struct mac_context *mac_ctx, uint8_t *p_ie,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800199 uint16_t ie_len, uint8_t *qos_cap, uint16_t *prop_cap, uint8_t *uapsd,
Jeff Johnson32ce2ff2018-11-18 22:08:58 -0800200 int8_t *local_constraint, struct pe_session *session)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800201{
202 tSirProbeRespBeacon *beacon_struct;
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700203 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 Lokere1d4094e2016-08-31 19:04:04 -0700209 struct s_ext_cap *ext_cap;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800210
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530211 beacon_struct = qdf_mem_malloc(sizeof(tSirProbeRespBeacon));
Arif Hussainf5b6c412018-10-10 19:41:09 -0700212 if (!beacon_struct)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800213 return;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800214
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800215 *qos_cap = 0;
216 *prop_cap = 0;
217 *uapsd = 0;
Srinivas Girigowda09625b02018-09-10 15:28:09 -0700218 pe_debug("The IE's being received:");
Srinivas Girigowdab896a562017-03-16 17:41:26 -0700219 QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
220 p_ie, ie_len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800221 if (sir_parse_beacon_ie(mac_ctx, beacon_struct, p_ie,
Jeff Johnson0301ecb2018-06-29 09:36:23 -0700222 (uint32_t) ie_len) != QDF_STATUS_SUCCESS) {
Nishank Aggarwalbe2cb792017-03-23 16:16:28 +0530223 pe_err("sir_parse_beacon_ie failed to parse beacon");
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700224 qdf_mem_free(beacon_struct);
225 return;
226 }
Paul Zhang42dade02017-05-12 19:20:37 +0800227
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700228 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 Dhavali7090c5f2015-11-02 17:55:19 -0800241
Nishank Aggarwalbe2cb792017-03-23 16:16:28 +0530242 pe_debug("Bcon: VHTCap.present: %d SU Beamformer: %d BSS_VHT_CAPABLE: %d",
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700243 beacon_struct->VHTCaps.present,
244 beacon_struct->VHTCaps.suBeamFormerCap,
245 IS_BSS_VHT_CAPABLE(beacon_struct->VHTCaps));
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700247 vht_op = &beacon_struct->VHTOperation;
248 if (IS_BSS_VHT_CAPABLE(beacon_struct->VHTCaps) &&
249 vht_op->present &&
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800250 session->vhtCapability) {
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700251 session->vhtCapabilityPresentInBeacon = 1;
252 if (((beacon_struct->Vendor1IEPresent &&
Kapil Gupta4b2efbb2016-10-03 13:07:20 +0530253 beacon_struct->vendor_vht_ie.present &&
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700254 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 Soni53993f72016-07-08 18:20:03 -0700259 session->vht_config.su_beam_formee = 0;
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700260 } else {
261 session->vhtCapabilityPresentInBeacon = 0;
262 }
263
264 if (session->vhtCapabilityPresentInBeacon == 1 &&
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700265 !session->htSupportedChannelWidthSet) {
Kiran Kumar Lokereeaaa3462018-11-01 19:03:23 -0700266 if (!mac_ctx->mlme_cfg->vht_caps.vht_cap_info.enable_txbf_20mhz)
Krunal Soni53993f72016-07-08 18:20:03 -0700267 session->vht_config.su_beam_formee = 0;
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700268 } 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 Dhavali7090c5f2015-11-02 17:55:19 -0800288 }
Naveen Rawatc0c91cd2015-11-05 14:27:37 -0800289
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700290 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 Lokere9e58d232016-08-23 18:49:16 -0700293 * 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 Lokere1aa9c9a2016-10-05 18:50:59 -0700297 if ((vht_ch_wd > WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) &&
Wu Gao93816212018-08-31 16:49:54 +0800298 mac_ctx->mlme_cfg->sta.sta_prefer_80mhz_over_160mhz) {
Kiran Kumar Lokere9e58d232016-08-23 18:49:16 -0700299 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 Lokere02b9aa42016-05-26 14:54:49 -0700305 * 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 Rawatc0c91cd2015-11-05 14:27:37 -0800334 } else {
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700335 /* 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 Rawatc0c91cd2015-11-05 14:27:37 -0800347 session->ch_center_freq_seg0 =
348 lim_get_80Mhz_center_channel(
349 beacon_struct->channelNumber);
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700350 else
351 session->ch_center_freq_seg1 = 0;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800352 }
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700353 session->ch_width = vht_ch_wd + 1;
Nishank Aggarwalbe2cb792017-03-23 16:16:28 +0530354 pe_debug("cntr_freq0: %d cntr_freq1: %d width: %d",
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700355 session->ch_center_freq_seg0,
356 session->ch_center_freq_seg1,
357 session->ch_width);
358 if (CH_WIDTH_80MHZ < session->ch_width) {
Krunal Soni53993f72016-07-08 18:20:03 -0700359 session->vht_config.su_beam_former = 0;
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700360 session->nss = 1;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800361 }
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800362 }
Naveen Rawat0cc24ab2016-11-10 15:12:18 -0800363
Kiran Kumar Lokere1d4094e2016-08-31 19:04:04 -0700364 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 Aggarwalbe2cb792017-03-23 16:16:28 +0530378 pe_err("AP does not support op_mode rx");
Kiran Kumar Lokere1d4094e2016-08-31 19:04:04 -0700379 }
380 }
Kiran Kumar Lokere59a569e2018-01-24 15:00:50 -0800381 lim_check_he_ldpc_cap(session, beacon_struct);
Kiran Kumar Lokeree6476b22017-10-16 23:40:32 -0700382 lim_extract_he_op(session, beacon_struct);
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700383 /* Extract the UAPSD flag from WMM Parameter element */
384 if (beacon_struct->wmeEdcaPresent)
385 *uapsd = beacon_struct->edcaParams.qosInfo.uapsd;
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +0530386
Wu Gao4f8938a2018-11-26 11:49:00 +0800387 if (mac_ctx->mlme_cfg->sta.allow_tpc_from_ap) {
Padma, Santhosh Kumar29df3622016-08-16 19:15:16 +0530388 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 Lokere02b9aa42016-05-26 14:54:49 -0700396 }
Selvaraj, Sridhar40fcc692017-05-04 16:32:20 +0530397
398 get_ese_version_ie_probe_response(mac_ctx, beacon_struct, session);
399
Kiran Kumar Lokere02b9aa42016-05-26 14:54:49 -0700400 session->country_info_present = false;
401 /* Initializing before first use */
402 if (beacon_struct->countryInfoPresent)
403 session->country_info_present = true;
Agrawal Ashish0f94b572016-02-22 13:27:06 +0530404 /* 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 Shah0ddd4f62016-05-27 10:07:32 +0530407 /* Update HS 2.0 Information Element */
408 if (beacon_struct->hs20vendor_ie.present) {
Nishank Aggarwalbe2cb792017-03-23 16:16:28 +0530409 pe_debug("HS20 Indication Element Present, rel#: %u id: %u",
Nitesh Shah0ddd4f62016-05-27 10:07:32 +0530410 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 Rawatfa2a1002018-05-17 16:06:37 -0700421
422 lim_objmgr_update_vdev_nss(mac_ctx->psoc, session->smeSessionId,
423 session->nss);
Anurag Chouhan600c3a02016-03-01 10:33:54 +0530424 qdf_mem_free(beacon_struct);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800425 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 Johnson348973e2018-11-22 16:51:12 -0800439 * @param mac - Pointer to Global MAC structure
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800440 * @return The corresponding HT enumeration
441 */
442ePhyChanBondState lim_get_htcb_state(ePhyChanBondState aniCBMode)
443{
444 switch (aniCBMode) {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800445 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 Dhavali7090c5f2015-11-02 17:55:19 -0800448 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
449 return PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800450 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 Dhavali7090c5f2015-11-02 17:55:19 -0800453 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
454 return PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800455 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
456 return PHY_SINGLE_CHANNEL_CENTERED;
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800457 default:
458 return PHY_SINGLE_CHANNEL_CENTERED;
459 }
460}