diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index 4e516eee38..09b212947e 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1969,6 +1969,8 @@ static void mlme_init_feature_flag_in_cfg( cfg_get(psoc, CFG_CHANNEL_BONDING_MODE_24GHZ); feature_flags->channel_bonding_mode_5ghz = cfg_get(psoc, CFG_CHANNEL_BONDING_MODE_5GHZ); + feature_flags->update_cw_allowed = + cfg_get(psoc, CFG_ALLOW_UPDATE_CHANNEL_WIDTH); } static void mlme_init_sap_protection_cfg(struct wlan_objmgr_psoc *psoc, diff --git a/components/mlme/dispatcher/inc/cfg_mlme_feature_flag.h b/components/mlme/dispatcher/inc/cfg_mlme_feature_flag.h index 393972b88f..c25e70ac8d 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_feature_flag.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_feature_flag.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-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 * any purpose with or without fee is hereby granted, provided that the @@ -222,6 +223,29 @@ CFG_VALUE_OR_DEFAULT, \ "Configures Channel Bonding in 5 GHz") +/* + * + * update_cw_allowed - process set channel width or not + * @Min: 0 + * @Max: 1 + * @Default: 1 + * + * This ini is used to check whether driver allowed to process set channel + * width request from upper layer or not. + * + * Related: None + * + * Supported Feature: STA + * + * Usage: External + * + * + */ +#define CFG_ALLOW_UPDATE_CHANNEL_WIDTH CFG_INI_BOOL( \ + "update_cw_allowed", \ + 1, \ + "is update chan width allowed") + #define CFG_FEATURE_FLAG_ALL \ CFG(CFG_ACCEPT_SHORT_SLOT_ASSOC_ONLY) \ CFG(CFG_HCF_ENABLED) \ @@ -235,7 +259,8 @@ CFG(CFG_BLOCK_ACK_ENABLED) \ CFG(CFG_ENABLE_AMPDUPS) \ CFG(CFG_CHANNEL_BONDING_MODE_24GHZ) \ - CFG(CFG_CHANNEL_BONDING_MODE_5GHZ) + CFG(CFG_CHANNEL_BONDING_MODE_5GHZ) \ + CFG(CFG_ALLOW_UPDATE_CHANNEL_WIDTH) #endif /* __CFG_MLME_FEATURE_FLAG_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index d7ccc0d994..3b7c638f7d 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -4569,6 +4569,18 @@ QDF_STATUS wlan_mlme_get_tx_retry_multiplier(struct wlan_objmgr_psoc *psoc, uint32_t *tx_retry_multiplier); +/** + * wlan_mlme_get_update_chan_width_allowed - Get value of INI + * is_update_chan_width_allowed + * @psoc: pointer to psoc object + * @value: pointer to the value which will be filled for the caller + * + * Return: QDF Status + */ +QDF_STATUS +wlan_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc, + bool *value); + /** * wlan_mlme_get_channel_bonding_5ghz - Get the channel bonding * val for 5ghz freq diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index 9392fde196..1ef7e6053a 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -1199,6 +1199,7 @@ struct wlan_mlme_rates { * @enable_block_ack: enable block ack feature * @channel_bonding_mode_24ghz: configures Channel Bonding in 24 GHz * @channel_bonding_mode_5ghz: configures Channel Bonding in 5 GHz + * @update_cw_allowed: to check update chan width allowed or not */ struct wlan_mlme_feature_flag { bool accept_short_slot_assoc; @@ -1214,6 +1215,7 @@ struct wlan_mlme_feature_flag { uint32_t enable_block_ack; uint32_t channel_bonding_mode_24ghz; uint32_t channel_bonding_mode_5ghz; + bool update_cw_allowed; }; /** diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 6ddb0e0068..82aa45db3e 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -4681,6 +4681,18 @@ QDF_STATUS ucfg_mlme_set_restricted_80p80_bw_supp(struct wlan_objmgr_psoc *psoc, */ bool ucfg_mlme_get_restricted_80p80_bw_supp(struct wlan_objmgr_psoc *psoc); +/** + * ucfg_mlme_get_update_chan_width_allowed - Get value of INI + * is_update_chan_width_allowed + * @psoc: pointer to psoc object + * @value: pointer to the value which will be filled for the caller + * + * Return: QDF Status + */ +QDF_STATUS +ucfg_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc, + bool *value); + /** * ucfg_mlme_get_channel_bonding_24ghz() - get channel bonding mode of 24ghz * @psoc: pointer to psoc object @@ -4702,6 +4714,7 @@ ucfg_mlme_get_channel_bonding_24ghz(struct wlan_objmgr_psoc *psoc, QDF_STATUS ucfg_mlme_set_channel_bonding_24ghz(struct wlan_objmgr_psoc *psoc, uint32_t value); + /** * ucfg_mlme_get_channel_bonding_5ghz() - get channel bonding mode of 5ghz * @psoc: pointer to psoc object diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 9c5b9874c5..6e4be6268a 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -6822,6 +6822,23 @@ wlan_mlme_get_tx_retry_multiplier(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS +wlan_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) { + *value = cfg_default(CFG_ALLOW_UPDATE_CHANNEL_WIDTH); + return QDF_STATUS_E_INVAL; + } + + *value = mlme_obj->cfg.feature_flags.update_cw_allowed; + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS wlan_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc, uint32_t *value) diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c index afcc164469..dd5f94584a 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c @@ -1865,6 +1865,13 @@ ucfg_mlme_set_channel_bonding_24ghz(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS +ucfg_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc, + bool *value) +{ + return wlan_mlme_get_update_chan_width_allowed(psoc, value); +} + QDF_STATUS ucfg_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc, uint32_t *value) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 95dbf06b12..a48eadcbc0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11100,6 +11100,20 @@ static int hdd_set_channel_width(struct wlan_hdd_link_info *link_info, struct nlattr *chn_bd = NULL; struct nlattr *mlo_link_id; enum eSirMacHTChannelWidth chwidth; + struct wlan_objmgr_psoc *psoc; + bool update_cw_allowed; + + psoc = wlan_vdev_get_psoc(link_info->vdev); + if (!psoc) { + hdd_debug("psoc is null"); + return -EINVAL; + } + + ucfg_mlme_get_update_chan_width_allowed(psoc, &update_cw_allowed); + if (!update_cw_allowed) { + hdd_debug("update_channel_width is disabled via INI"); + return -EINVAL; + } if (!tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MLO_LINKS]) goto skip_mlo;