wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/712-02-ath12k-add-support-rts-threshold-readable-command-fo.patch
John Crispin 144c5d00f4 ipq95xx/mac80211: update to ATH12.3-CS
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

146 lines
4.2 KiB
Diff

From b00a94bd96573978940dc2c6932033b009d3a634 Mon Sep 17 00:00:00 2001
From: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Date: Fri, 17 Feb 2023 16:27:51 +0530
Subject: [PATCH] ath12k: add support rts threshold readable command for MLO
Currently, we are getting rts threshold for each phy. But,
in multi-link operation we have only one phy due to this
we are not able to get correct rts threshold value for
different vaps.
So, Fix this issue by creating rts_threshold file per netdev
for MLO.
Existing rts_threshold for non MLO case
cat /sys/kernel/debug/ieee80211/phyX/rts_threshold
proposed solution for single wiphy architecture
SLO: cat /sys/kernel/debug/ieee80211/phy0/netdev:wlanX/link0/rts_threshold
MLO: cat /sys/kernel/debug/ieee80211/phy0/netdev:wlanX/linkY/rts_threshold
Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
---
drivers/net/wireless/ath/ath12k/debugfs.c | 48 ++++++++++++++++++++++-
1 file changed, 46 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/ath/ath12k/debugfs.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs.c
@@ -3134,6 +3134,47 @@ static ssize_t ath12k_write_twt_resume_d
return count;
}
+static ssize_t ath12k_read_rts_threshold(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath12k_link_vif *arvif = file->private_data;
+ struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_vif *vif = ahvif->vif;
+ u8 link_id = arvif->link_id;
+ struct ieee80211_bss_conf *link_conf;
+ int ret, len = 0;
+ const int size = 20;
+ char *buf;
+
+ rcu_read_lock();
+ link_conf = rcu_dereference(vif->link_conf[link_id]);
+
+ if (!link_conf) {
+ rcu_read_unlock();
+ return -EINVAL;
+ }
+
+ buf = kzalloc(size, GFP_KERNEL);
+
+ if (!buf) {
+ rcu_read_unlock();
+ return -ENOMEM;
+ }
+
+ len = scnprintf(buf + len, size - len,
+ "%d\n", link_conf->rts_threshold);
+ rcu_read_unlock();
+ ret = simple_read_from_buffer(ubuf, count, ppos, buf, len);
+ kfree(buf);
+ return ret;
+}
+
+static const struct file_operations ath12k_fops_rts_threshold = {
+ .read = ath12k_read_rts_threshold,
+ .open = simple_open
+};
+
static const struct file_operations ath12k_fops_twt_add_dialog = {
.write = ath12k_write_twt_add_dialog,
.open = simple_open
@@ -3171,12 +3212,18 @@ int ath12k_debugfs_add_interface(struct
if (arvif->debugfs_twt)
goto exit;
- if (!hw->wiphy->num_hw)
+ if (!hw->wiphy->num_hw) {
arvif->debugfs_twt = debugfs_create_dir("twt",
vif->debugfs_dir);
- else
+ } else {
arvif->debugfs_twt = debugfs_create_dir("twt",
vif->link_debugfs[link_id]);
+ arvif->debugfs_rtsthreshold = debugfs_create_file("rts_threshold",
+ 0200,
+ vif->link_debugfs[link_id],
+ arvif,
+ &ath12k_fops_rts_threshold);
+ }
if (!arvif->debugfs_twt || IS_ERR(arvif->debugfs_twt)) {
ath12k_warn(arvif->ar->ab,
@@ -3199,6 +3246,19 @@ int ath12k_debugfs_add_interface(struct
debugfs_create_file("resume_dialog", 0200, arvif->debugfs_twt,
arvif, &ath12k_fops_twt_resume_dialog);
+ if (hw->wiphy->num_hw) {
+ if (!arvif->debugfs_rtsthreshold || IS_ERR(arvif->debugfs_rtsthreshold)) {
+ ath12k_warn(arvif->ar->ab,
+ "failed to create file %p\n",
+ arvif->debugfs_rtsthreshold);
+ debugfs_remove_recursive(arvif->debugfs_twt);
+ arvif->debugfs_twt = NULL;
+ arvif->debugfs_rtsthreshold = NULL;
+ ret = -ENOMEM;
+ goto exit;
+ }
+ }
+
exit:
return ret;
}
@@ -3212,11 +3272,18 @@ void ath12k_debugfs_remove_interface(str
if (!arvif->debugfs_twt)
return;
+ if (!arvif->debugfs_rtsthreshold)
+ return;
+
if (!vif || !vif->link_debugfs[link_id]) {
arvif->debugfs_twt = NULL;
+ arvif->debugfs_rtsthreshold = NULL;
return;
}
debugfs_remove_recursive(arvif->debugfs_twt);
arvif->debugfs_twt = NULL;
+
+ debugfs_remove(arvif->debugfs_rtsthreshold);
+ arvif->debugfs_rtsthreshold = NULL;
}
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -357,6 +357,7 @@ struct ath12k_link_vif {
u32 vht_cap;
#ifdef CPTCFG_ATH12K_DEBUGFS
struct dentry *debugfs_twt;
+ struct dentry *debugfs_rtsthreshold;
#endif /* CPTCFG_ATH12K_DEBUGFS */
struct work_struct update_bcn_template_work;
u64 obss_color_bitmap;