* [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold
@ 2025-08-26 10:57 Roopni Devanathan
2025-09-17 2:14 ` Baochen Qiang
2025-09-18 23:47 ` Jeff Johnson
0 siblings, 2 replies; 3+ messages in thread
From: Roopni Devanathan @ 2025-08-26 10:57 UTC (permalink / raw)
To: ath12k; +Cc: linux-wireless, Roopni Devanathan
Currently, command to set RTS threshold makes changes to the threshold of
all radios in the multi-radio wiphy. But each radio in a multi-radio wiphy
can have different RTS threshold requirements.
To support this requirement, use the index of radio for which the RTS
threshold needs to be changed from mac80211 - radio_idx. Based on the value
passed, set the RTS threshold value for the corresponding radios. Following
are the possible values of radio_idx and the corresponding behavior in
multi-radio wiphys:
1. radio_idx is -1: consider RTS threshold as a global parameter, i.e.,
make changes to all the radios in a wiphy. If setting RTS threshold
fails for any radio, then the previous RTS threshold values of
respective radios will be restored.
2. radio_idx denotes a specific radio: make changes in RTS threshold to
that radio alone.
3. radio_idx is any other number: report it as an invalid number.
In case of single-radio wiphys, continue with the existing behavior, i.e.,
set the passed RTS threshold value to the radio present.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.h | 3 +-
drivers/net/wireless/ath/ath12k/mac.c | 50 ++++++++++++++++++++++----
2 files changed, 45 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 519f826f56c8..da7e99f2ca0b 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#ifndef ATH12K_CORE_H
@@ -730,6 +730,7 @@ struct ath12k {
u32 txpower_scale;
u32 power_scale;
u32 chan_tx_pwr;
+ u32 rts_threshold;
u32 num_stations;
u32 max_num_stations;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index bd1ec3b2c084..c0e0423464e3 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause-Clear
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
*/
#include <net/mac80211.h>
@@ -9848,6 +9848,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
param_value = hw->wiphy->rts_threshold;
+ ar->rts_threshold = param_value;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
param_id, param_value);
if (ret) {
@@ -11675,16 +11676,32 @@ static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw,
int radio_idx, u32 value)
{
struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
+ struct wiphy *wiphy = hw->wiphy;
struct ath12k *ar;
- int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD, ret = 0, i;
+ int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
+ int ret = 0, ret_err, i;
lockdep_assert_wiphy(hw->wiphy);
- /* Currently we set the rts threshold value to all the vifs across
- * all radios of the single wiphy.
- * TODO Once support for vif specific RTS threshold in mac80211 is
- * available, ath12k can make use of it.
- */
+ if (radio_idx >= wiphy->n_radio || radio_idx < -1)
+ return -EINVAL;
+
+ if (radio_idx != -1) {
+ /* Update RTS threshold in specified radio */
+ ar = ath12k_ah_to_ar(ah, radio_idx);
+ ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value);
+ if (ret) {
+ ath12k_warn(ar->ab,
+ "failed to set RTS config for all vdevs of pdev %d",
+ ar->pdev->pdev_id);
+ return ret;
+ }
+
+ ar->rts_threshold = value;
+ return 0;
+ }
+
+ /* Radio_index passed is -1, so set RTS threshold for all radios. */
for_each_ar(ah, ar, i) {
ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value);
if (ret) {
@@ -11693,6 +11710,25 @@ static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw,
break;
}
}
+ if (!ret) {
+ /* Setting new RTS threshold for vdevs of all radios passed, so update
+ * the RTS threshold value for all radios
+ */
+ for_each_ar(ah, ar, i)
+ ar->rts_threshold = value;
+ return 0;
+ }
+
+ /* RTS threshold config failed, revert to the previous RTS threshold */
+ for (i = i - 1; i >= 0; i--) {
+ ar = ath12k_ah_to_ar(ah, i);
+ ret_err = ath12k_set_vdev_param_to_all_vifs(ar, param_id,
+ ar->rts_threshold);
+ if (ret_err)
+ ath12k_warn(ar->ab,
+ "failed to restore RTS threshold for all vdevs of pdev %d",
+ ar->pdev->pdev_id);
+ }
return ret;
}
base-commit: 95bf875b89b48a95a82aca922eeaf19d52543028
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold
2025-08-26 10:57 [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold Roopni Devanathan
@ 2025-09-17 2:14 ` Baochen Qiang
2025-09-18 23:47 ` Jeff Johnson
1 sibling, 0 replies; 3+ messages in thread
From: Baochen Qiang @ 2025-09-17 2:14 UTC (permalink / raw)
To: Roopni Devanathan, ath12k; +Cc: linux-wireless
On 8/26/2025 6:57 PM, Roopni Devanathan wrote:
> Currently, command to set RTS threshold makes changes to the threshold of
> all radios in the multi-radio wiphy. But each radio in a multi-radio wiphy
> can have different RTS threshold requirements.
>
> To support this requirement, use the index of radio for which the RTS
> threshold needs to be changed from mac80211 - radio_idx. Based on the value
> passed, set the RTS threshold value for the corresponding radios. Following
> are the possible values of radio_idx and the corresponding behavior in
> multi-radio wiphys:
> 1. radio_idx is -1: consider RTS threshold as a global parameter, i.e.,
> make changes to all the radios in a wiphy. If setting RTS threshold
> fails for any radio, then the previous RTS threshold values of
> respective radios will be restored.
> 2. radio_idx denotes a specific radio: make changes in RTS threshold to
> that radio alone.
> 3. radio_idx is any other number: report it as an invalid number.
>
> In case of single-radio wiphys, continue with the existing behavior, i.e.,
> set the passed RTS threshold value to the radio present.
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
> ---
> drivers/net/wireless/ath/ath12k/core.h | 3 +-
> drivers/net/wireless/ath/ath12k/mac.c | 50 ++++++++++++++++++++++----
> 2 files changed, 45 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
> index 519f826f56c8..da7e99f2ca0b 100644
> --- a/drivers/net/wireless/ath/ath12k/core.h
> +++ b/drivers/net/wireless/ath/ath12k/core.h
> @@ -1,7 +1,7 @@
> /* SPDX-License-Identifier: BSD-3-Clause-Clear */
> /*
> * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
> - * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> */
>
> #ifndef ATH12K_CORE_H
> @@ -730,6 +730,7 @@ struct ath12k {
> u32 txpower_scale;
> u32 power_scale;
> u32 chan_tx_pwr;
> + u32 rts_threshold;
> u32 num_stations;
> u32 max_num_stations;
>
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index bd1ec3b2c084..c0e0423464e3 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -1,7 +1,7 @@
> // SPDX-License-Identifier: BSD-3-Clause-Clear
> /*
> * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
> - * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
> */
>
> #include <net/mac80211.h>
> @@ -9848,6 +9848,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
>
> param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
> param_value = hw->wiphy->rts_threshold;
> + ar->rts_threshold = param_value;
> ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
> param_id, param_value);
> if (ret) {
> @@ -11675,16 +11676,32 @@ static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw,
> int radio_idx, u32 value)
> {
> struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
> + struct wiphy *wiphy = hw->wiphy;
> struct ath12k *ar;
> - int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD, ret = 0, i;
> + int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
> + int ret = 0, ret_err, i;
>
> lockdep_assert_wiphy(hw->wiphy);
>
> - /* Currently we set the rts threshold value to all the vifs across
> - * all radios of the single wiphy.
> - * TODO Once support for vif specific RTS threshold in mac80211 is
> - * available, ath12k can make use of it.
> - */
> + if (radio_idx >= wiphy->n_radio || radio_idx < -1)
> + return -EINVAL;
> +
> + if (radio_idx != -1) {
> + /* Update RTS threshold in specified radio */
> + ar = ath12k_ah_to_ar(ah, radio_idx);
> + ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value);
> + if (ret) {
> + ath12k_warn(ar->ab,
> + "failed to set RTS config for all vdevs of pdev %d",
> + ar->pdev->pdev_id);
> + return ret;
> + }
> +
> + ar->rts_threshold = value;
> + return 0;
> + }
> +
> + /* Radio_index passed is -1, so set RTS threshold for all radios. */
> for_each_ar(ah, ar, i) {
> ret = ath12k_set_vdev_param_to_all_vifs(ar, param_id, value);
> if (ret) {
> @@ -11693,6 +11710,25 @@ static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw,
> break;
> }
> }
> + if (!ret) {
> + /* Setting new RTS threshold for vdevs of all radios passed, so update
> + * the RTS threshold value for all radios
> + */
> + for_each_ar(ah, ar, i)
> + ar->rts_threshold = value;
> + return 0;
> + }
> +
> + /* RTS threshold config failed, revert to the previous RTS threshold */
> + for (i = i - 1; i >= 0; i--) {
> + ar = ath12k_ah_to_ar(ah, i);
> + ret_err = ath12k_set_vdev_param_to_all_vifs(ar, param_id,
> + ar->rts_threshold);
> + if (ret_err)
> + ath12k_warn(ar->ab,
> + "failed to restore RTS threshold for all vdevs of pdev %d",
> + ar->pdev->pdev_id);
> + }
>
> return ret;
> }
>
> base-commit: 95bf875b89b48a95a82aca922eeaf19d52543028
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold
2025-08-26 10:57 [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold Roopni Devanathan
2025-09-17 2:14 ` Baochen Qiang
@ 2025-09-18 23:47 ` Jeff Johnson
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2025-09-18 23:47 UTC (permalink / raw)
To: ath12k, Roopni Devanathan; +Cc: linux-wireless
On Tue, 26 Aug 2025 16:27:14 +0530, Roopni Devanathan wrote:
> Currently, command to set RTS threshold makes changes to the threshold of
> all radios in the multi-radio wiphy. But each radio in a multi-radio wiphy
> can have different RTS threshold requirements.
>
> To support this requirement, use the index of radio for which the RTS
> threshold needs to be changed from mac80211 - radio_idx. Based on the value
> passed, set the RTS threshold value for the corresponding radios. Following
> are the possible values of radio_idx and the corresponding behavior in
> multi-radio wiphys:
> 1. radio_idx is -1: consider RTS threshold as a global parameter, i.e.,
> make changes to all the radios in a wiphy. If setting RTS threshold
> fails for any radio, then the previous RTS threshold values of
> respective radios will be restored.
> 2. radio_idx denotes a specific radio: make changes in RTS threshold to
> that radio alone.
> 3. radio_idx is any other number: report it as an invalid number.
>
> [...]
Applied, thanks!
[1/1] wifi: ath12k: Add support to set per-radio RTS threshold
commit: 87a67cc357a8d01f244ae04284eac4c41c221e34
Best regards,
--
Jeff Johnson <jeff.johnson@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-18 23:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 10:57 [PATCH ath-next] wifi: ath12k: Add support to set per-radio RTS threshold Roopni Devanathan
2025-09-17 2:14 ` Baochen Qiang
2025-09-18 23:47 ` Jeff Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox