wifi: ath12k: Add support to set per-radio RTS threshold

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>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20250826105714.1188131-1-quic_rdevanat@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Roopni Devanathan
2025-08-26 16:27:14 +05:30
committed by Jeff Johnson
parent d103f26a5c
commit 87a67cc357
2 changed files with 45 additions and 8 deletions

View File

@@ -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;

View File

@@ -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>
@@ -9860,6 +9860,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) {
@@ -11687,16 +11688,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) {
@@ -11705,6 +11722,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;
}