From 61edca871f5d4e07b734b42526018bfc0449c9e4 Mon Sep 17 00:00:00 2001 From: Shwetha Goravanahalli Kemparaju Date: Mon, 25 Sep 2023 13:35:11 +0530 Subject: [PATCH 1/5] qcacmn: Fix OOB issue Changes to fix OOB issue seen util_scan_parse_beacon_frame. CRs-Fixed: 3582496 Change-Id: I53244be54d31e87b55d0b44ce94315c8001f417d --- .../cmn_defs/inc/wlan_cmn_ieee80211.h | 4 +++ .../scan/dispatcher/src/wlan_scan_utils_api.c | 25 +++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h index d519f3396ac1..f4ccb035f530 100644 --- a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h +++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h @@ -205,6 +205,10 @@ #define WLAN_MAX_HEOP_IE_LEN 16 #define WLAN_HEOP_OUI_TYPE "\x24" #define WLAN_HEOP_OUI_SIZE 1 +#define WLAN_MIN_HECAP_IE_LEN 22 +#define WLAN_MAX_HECAP_IE_LEN 55 +#define WLAN_HE_MCS_MAP_LEN 2 +#define WLAN_INVALID_RX_MCS_MAP 0xFFFF #define WLAN_HEOP_FIXED_PARAM_LENGTH 7 #define WLAN_HEOP_VHTOP_LENGTH 3 diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c index b6deba111005..49be228eac36 100644 --- a/umac/scan/dispatcher/src/wlan_scan_utils_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c @@ -789,6 +789,9 @@ util_scan_parse_extn_ie(struct scan_cache_entry *scan_params, scan_params->ie_list.srp = (uint8_t *)ie; break; case WLAN_EXTN_ELEMID_HECAP: + if ((extn_ie->ie_len < WLAN_MIN_HECAP_IE_LEN) || + (extn_ie->ie_len > WLAN_MAX_HECAP_IE_LEN)) + return QDF_STATUS_E_INVAL; scan_params->ie_list.hecap = (uint8_t *)ie; break; case WLAN_EXTN_ELEMID_HEOP: @@ -1317,28 +1320,36 @@ static int util_scan_scm_calc_nss_supported_by_ap( { struct htcap_cmn_ie *htcap; struct wlan_ie_vhtcaps *vhtcaps; - struct wlan_ie_hecaps *hecaps; + uint8_t *he_cap; + uint8_t *end_ptr = NULL; uint16_t rx_mcs_map = 0; + uint8_t *mcs_map_offset; htcap = (struct htcap_cmn_ie *) util_scan_entry_htcap(scan_params); vhtcaps = (struct wlan_ie_vhtcaps *) util_scan_entry_vhtcap(scan_params); - hecaps = (struct wlan_ie_hecaps *) - util_scan_entry_hecap(scan_params); + he_cap = util_scan_entry_hecap(scan_params); - if (hecaps) { + if (he_cap) { /* Using rx mcs map related to 80MHz or lower as in some * cases higher mcs may suuport lesser NSS than that * of lowe mcs. Thus giving max NSS capability. */ - rx_mcs_map = - qdf_cpu_to_le16(hecaps->mcs_bw_map[0].rx_mcs_map); + end_ptr = he_cap + he_cap[1] + sizeof(struct ie_header); + mcs_map_offset = (he_cap + sizeof(struct extn_ie_header) + + WLAN_HE_MACCAP_LEN + WLAN_HE_PHYCAP_LEN); + if ((mcs_map_offset + WLAN_HE_MCS_MAP_LEN) <= end_ptr) { + rx_mcs_map = *(uint16_t *)mcs_map_offset; + } else { + rx_mcs_map = WLAN_INVALID_RX_MCS_MAP; + scm_debug("mcs_map_offset exceeds he cap len"); + } } else if (vhtcaps) { rx_mcs_map = vhtcaps->rx_mcs_map; } - if (hecaps || vhtcaps) { + if (he_cap || vhtcaps) { if ((rx_mcs_map & 0xC000) != 0xC000) return 8; From c5560438fc171e684b6f6d73c1b514d851b2fc72 Mon Sep 17 00:00:00 2001 From: Ashish Date: Fri, 14 Jul 2023 12:23:03 +0530 Subject: [PATCH 2/5] qcacmn: Consider gindoor_channel_support ini to decide ap_power_type Currently driver does not consider gindoor_channel_support ini when it decides the ap power type and because of that it always decides ap power type as VLP. Driver should consider this ini value as well because this INI says that indoor channels are allowed so driver should set ap power mode as LPI to allow LPI power mode. Change-ID: Id7ad546ba23ce210497002e3083a22f1edc87185 CRs-Fixed: 3085997 --- umac/regulatory/core/src/reg_utils.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 2a162c13bd52..1438365da7d9 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -831,11 +831,18 @@ enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev) return REG_VERY_LOW_POWER_AP; } - if (reg_is_afc_available(pdev)) + if (reg_is_afc_available(pdev)) { ap_pwr_type = REG_STANDARD_POWER_AP; - else if (pdev_priv_obj->reg_6g_superid != FCC1_6G && - pdev_priv_obj->reg_6g_superid != FCC1_6G_CL) + } else if (pdev_priv_obj->indoor_chan_enabled) { + if (pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_INDOOR_AP]) + ap_pwr_type = REG_INDOOR_AP; + else + ap_pwr_type = REG_VERY_LOW_POWER_AP; + } else if (pdev_priv_obj->reg_rules.num_of_6g_ap_reg_rules[REG_VERY_LOW_POWER_AP]) { ap_pwr_type = REG_VERY_LOW_POWER_AP; + } + reg_debug("indoor_chan_enabled %d ap_pwr_type %d", + pdev_priv_obj->indoor_chan_enabled, ap_pwr_type); reg_set_ap_pwr_and_update_chan_list(pdev, ap_pwr_type); From 620e9cd325ac7b727b6f3580fede16802a150d00 Mon Sep 17 00:00:00 2001 From: Will Huang Date: Tue, 2 Nov 2021 14:01:03 +0800 Subject: [PATCH 3/5] qcacmn: Add QCA vendor attribute to configure ARP/NS offload feature Add a QCA vendor attribute QCA_WLAN_VENDOR_ATTR_CONFIG_ARP_NS_OFFLOAD to configure ARP/NS offload feature. Change-Id: I976ed866272c7c82ff12593339bd2d551af6741b CRs-Fixed: 3620322 --- os_if/linux/qca_vendor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 2508e3ace88a..0e2568cda2b2 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -4823,6 +4823,19 @@ enum qca_wlan_vendor_attr_config { */ QCA_WLAN_VENDOR_ATTR_CONFIG_FT_OVER_DS = 80, + /* + * 8-bit unsigned value. This attribute can be used to configure the + * firmware to enable/disable ARP/NS offload feature. Possible values + * for this attribute are 0-Disable and 1-Enable. + * + * This attribute is only applicable for STA/P2P-Client interface, + * and is optional, default behavior is APR/NS offload Enable. + * + * This attribute can be set in disconncted and connected state, and + * will restore to default behavior if interface is closed. + */ + QCA_WLAN_VENDOR_ATTR_CONFIG_ARP_NS_OFFLOAD = 81, + /* 8-bit unsigned value, whenever wifi calling (wfc) begin or end, * Userspace sends this information to driver/firmware to configure * wfc state. Driver/Firmware uses this information to From e5958f59298fec88a176a98ba43e31f7720ad16e Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Wed, 30 Aug 2023 16:58:22 +0530 Subject: [PATCH 4/5] qcacmn: Cleanup reg_cache_channel_state Cleanup reg_cache_channel_state and the related code with it. Also, changed the logic so as to compare channel freq instead of channel number in reg_modify_chan_list_for_cached_channels() Change-Id: I424b6886ed18f73bae0d2b36e36a9ddc1819688b CRs-Fixed: 2908016 --- .../regulatory/core/src/reg_build_chan_list.c | 6 +- umac/regulatory/core/src/reg_utils.c | 57 ------------------- umac/regulatory/core/src/reg_utils.h | 23 +------- .../dispatcher/inc/wlan_reg_ucfg_api.h | 22 +------ .../dispatcher/src/wlan_reg_ucfg_api.c | 16 +----- 5 files changed, 6 insertions(+), 118 deletions(-) diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index f6e70bd26ead..825d03469a52 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -732,8 +732,8 @@ static void reg_modify_chan_list_for_cached_channels( if (pdev_priv_obj->disable_cached_channels) { for (i = 0; i < num_cache_channels; i++) for (j = 0; j < NUM_CHANNELS; j++) - if (cache_chan_list[i].chan_num == - chan_list[j].chan_num) { + if (cache_chan_list[i].center_freq == + chan_list[j].center_freq) { chan_list[j].state = CHANNEL_STATE_DISABLE; chan_list[j].chan_flags |= diff --git a/umac/regulatory/core/src/reg_utils.c b/umac/regulatory/core/src/reg_utils.c index 1438365da7d9..ca82b046b72d 100644 --- a/umac/regulatory/core/src/reg_utils.c +++ b/umac/regulatory/core/src/reg_utils.c @@ -686,63 +686,6 @@ QDF_STATUS reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, return QDF_STATUS_SUCCESS; } #endif /* CONFIG_CHAN_FREQ_API */ - -#ifdef CONFIG_CHAN_NUM_API -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ - struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj; - struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj; - struct wlan_objmgr_psoc *psoc; - uint8_t i, j; - - pdev_priv_obj = reg_get_pdev_obj(pdev); - - if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) { - reg_err("pdev reg component is NULL"); - return QDF_STATUS_E_INVAL; - } - - psoc = wlan_pdev_get_psoc(pdev); - if (!psoc) { - reg_err("psoc is NULL"); - return QDF_STATUS_E_INVAL; - } - - psoc_priv_obj = reg_get_psoc_obj(psoc); - if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) { - reg_err("psoc reg component is NULL"); - return QDF_STATUS_E_INVAL; - } - if (pdev_priv_obj->num_cache_channels > 0) { - pdev_priv_obj->num_cache_channels = 0; - qdf_mem_zero(&pdev_priv_obj->cache_disable_chan_list, - sizeof(pdev_priv_obj->cache_disable_chan_list)); - } - - for (i = 0; i < num_channels; i++) { - for (j = 0; j < NUM_CHANNELS; j++) { - if (channel_list[i] == pdev_priv_obj-> - cur_chan_list[j].chan_num) { - pdev_priv_obj-> - cache_disable_chan_list[i].chan_num = - channel_list[i]; - pdev_priv_obj-> - cache_disable_chan_list[i].state = - pdev_priv_obj->cur_chan_list[j].state; - pdev_priv_obj-> - cache_disable_chan_list[i].chan_flags = - pdev_priv_obj-> - cur_chan_list[j].chan_flags; - } - } - } - pdev_priv_obj->num_cache_channels = num_channels; - - return QDF_STATUS_SUCCESS; -} -#endif /* CONFIG_CHAN_NUM_API */ #endif #ifdef CONFIG_REG_CLIENT diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index fdb8a834a28d..e151a8fd3b94 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -175,27 +175,6 @@ QDF_STATUS reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, } #endif /* defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_FREQ_API) */ -#if defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) -/** - * reg_cache_channel_state() - Cache the current state of the channels - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - */ -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels); -#else -static inline -QDF_STATUS reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ - return QDF_STATUS_SUCCESS; -} -#endif /* defined (DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) */ - #ifdef CONFIG_REG_CLIENT /** * reg_set_band() - Sets the band information for the PDEV diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index eafd72b5ce19..2d8e636bcd28 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -61,27 +62,6 @@ QDF_STATUS ucfg_reg_get_band(struct wlan_objmgr_pdev *pdev, QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev, bool sap_state); -/** - * ucfg_reg_cache_channel_state() - Cache the current state of the channles - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - * Return: QDF_STATUS - */ -#if defined(DISABLE_CHANNEL_LIST) && defined(CONFIG_CHAN_NUM_API) -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels); -#else -static inline -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, - uint32_t num_channels) -{ -} -#endif /* CONFIG_CHAN_NUM_API */ - /** * ucfg_reg_cache_channel_freq_state() - Cache the current state of the * channels based on the channel center frequency. diff --git a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c index b544dc0bd212..28dfc349a055 100644 --- a/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c +++ b/umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -311,21 +312,6 @@ void ucfg_reg_cache_channel_freq_state(struct wlan_objmgr_pdev *pdev, } #endif /* CONFIG_CHAN_FREQ_API */ -#ifdef CONFIG_CHAN_NUM_API -/** - * ucfg_reg_cache_channel_state() - Cache the current state of the channles - * @pdev: The physical dev to cache the channels for - * @channel_list: List of the channels for which states needs to be cached - * @num_channels: Number of channels in the list - * - */ -void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev, - uint32_t *channel_list, uint32_t num_channels) -{ - reg_cache_channel_state(pdev, channel_list, num_channels); -} -#endif /* CONFIG_CHAN_NUM_API */ - void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev) { reg_restore_cached_channels(pdev); From ef3473af12b31ffa6b2bcecf66f78b01a25080f1 Mon Sep 17 00:00:00 2001 From: Krupali Dhanvijay Date: Mon, 28 Aug 2023 13:23:03 +0530 Subject: [PATCH 5/5] qcacmn: Update set_disable_channel_list cmd for 6 GHz channels Currently SET_DISABLE_CHANNEL_LIST command is used to disable legacy channels only. Update this command to accept frequency for all the bands along with the channel numbers from legacy (2.4 GHz/5 GHz) and update the channel state in secondary channel list also. Change-Id: Iecc9f73dca65900d82a2f2a044cb854cea58c638 CRs-Fixed: 3601253 --- .../regulatory/core/src/reg_build_chan_list.c | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/umac/regulatory/core/src/reg_build_chan_list.c b/umac/regulatory/core/src/reg_build_chan_list.c index 825d03469a52..6059b406d57b 100644 --- a/umac/regulatory/core/src/reg_build_chan_list.c +++ b/umac/regulatory/core/src/reg_build_chan_list.c @@ -722,7 +722,9 @@ static void reg_modify_chan_list_for_cached_channels( { uint32_t i, j; uint32_t num_cache_channels = pdev_priv_obj->num_cache_channels; - struct regulatory_channel *chan_list = pdev_priv_obj->cur_chan_list; + struct regulatory_channel *cur_chan_list = pdev_priv_obj->cur_chan_list; + struct regulatory_channel *sec_chan_list = + pdev_priv_obj->secondary_cur_chan_list; struct regulatory_channel *cache_chan_list = pdev_priv_obj->cache_disable_chan_list; @@ -730,15 +732,24 @@ static void reg_modify_chan_list_for_cached_channels( return; if (pdev_priv_obj->disable_cached_channels) { - for (i = 0; i < num_cache_channels; i++) - for (j = 0; j < NUM_CHANNELS; j++) + for (i = 0; i < num_cache_channels; i++) { + for (j = 0; j < NUM_CHANNELS; j++) { if (cache_chan_list[i].center_freq == - chan_list[j].center_freq) { - chan_list[j].state = + cur_chan_list[j].center_freq) { + cur_chan_list[j].state = CHANNEL_STATE_DISABLE; - chan_list[j].chan_flags |= + cur_chan_list[j].chan_flags |= REGULATORY_CHAN_DISABLED; } + if (cache_chan_list[i].center_freq == + sec_chan_list[j].center_freq) { + sec_chan_list[j].state = + CHANNEL_STATE_DISABLE; + sec_chan_list[j].chan_flags |= + REGULATORY_CHAN_DISABLED; + } + } + } } } #else @@ -1278,8 +1289,6 @@ void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj reg_modify_chan_list_for_chan_144(pdev_priv_obj->cur_chan_list, pdev_priv_obj->en_chan_144); - reg_modify_chan_list_for_cached_channels(pdev_priv_obj); - reg_modify_chan_list_for_srd_channels(pdev_priv_obj->pdev_ptr, pdev_priv_obj->cur_chan_list); @@ -1292,6 +1301,8 @@ void reg_compute_pdev_current_chan_list(struct wlan_regulatory_pdev_priv_obj cur_chan_list); reg_populate_secondary_cur_chan_list(pdev_priv_obj); + + reg_modify_chan_list_for_cached_channels(pdev_priv_obj); } void reg_reset_reg_rules(struct reg_rule_info *reg_rules)