wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/706-02-ath12k-fix-single-wiphy-debugfs-issues.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

164 lines
5.5 KiB
Diff

From fd116351844f9896b56ca7226637bddcfa5f8756 Mon Sep 17 00:00:00 2001
From: Harshitha Prem <quic_hprem@quicinc.com>
Date: Sat, 7 Jan 2023 10:38:56 +0530
Subject: [PATCH 1/2] ath12k: fix single wiphy debugfs issues
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In single wiphy design, when multiple hardware are registered
as one wiphy to mac80211, then we encounter following issues:
1. Warning - "debugfs: File 'ath12k' in directory
'phy0' already present!"
2. Failed to create mld link because of vif debugfs failure
To address the above change:
for #1:
Existing debugfs directory in non-single wiphy architecture:
/sys/kernel/debug/ieee80211/phyX/ath12k is symlink of
/sys/kernel/debug/ath12k/qcnXXX/mac0
Proposed debugfs directory for single wiphy architecture:
/sys/kernel/debug/ieee80211/phyX/ath12k_hwY is symlink of
/sys/kernel/debug/ath12k/qcnXXX/mac0
Where X is phy index and
Y is hw index fetched from - “iw phyX info | grep hw_idx”
for #2:
Existing twt debugfs directory in non-single wiphy architecture:
/sys/kernel/debug/ieee80211/phyX/netdev:wlanY
Proposed twt debugfs directory in single wiphy architecture:
/sys/kernel/debug/ieee80211/phyX/netdev:wlanY/linkZ
where Z is the links used in mld vap and 0 for non-mld vap
Signed-off-by: Harshitha Prem <quic_hprem@quicinc.com>
---
drivers/net/wireless/ath/ath12k/core.h | 1 +
drivers/net/wireless/ath/ath12k/debugfs.c | 67 ++++++++++++++++-------
drivers/net/wireless/ath/ath12k/mac.c | 1 +
3 files changed, 49 insertions(+), 20 deletions(-)
--- a/drivers/net/wireless/ath/ath12k/debugfs.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs.c
@@ -2440,7 +2440,15 @@ int ath12k_debugfs_register(struct ath12
/* Create a symlink under ieee80211/phy* */
snprintf(buf, 100, "../../ath12k/%pd2", ar->debug.debugfs_pdev);
- debugfs_create_symlink("ath12k", hw->wiphy->debugfsdir, buf);
+
+ if (!hw->wiphy->num_hw) {
+ debugfs_create_symlink("ath12k", hw->wiphy->debugfsdir, buf);
+ } else {
+ char dirname[32] = {0};
+
+ snprintf(dirname, 32, "ath12k_hw%d", ar->link_idx);
+ debugfs_create_symlink(dirname, hw->wiphy->debugfsdir, buf);
+ }
ath12k_debugfs_htt_stats_init(ar);
@@ -2459,7 +2467,7 @@ int ath12k_debugfs_register(struct ath12
ar->debug.debugfs_pdev, ar,
&fops_pktlog_filter);
- if (hw->wiphy->bands[NL80211_BAND_5GHZ]) {
+ if (ar->mac.sbands[NL80211_BAND_5GHZ].channels) {
debugfs_create_file("dfs_simulate_radar", 0200,
ar->debug.debugfs_pdev, ar,
&fops_simulate_radar);
@@ -2468,7 +2476,7 @@ int ath12k_debugfs_register(struct ath12
&ar->dfs_block_radar_events);
}
- if (hw->wiphy->bands[NL80211_BAND_6GHZ]) {
+ if (ar->mac.sbands[NL80211_BAND_6GHZ].channels) {
debugfs_create_file("simulate_awgn", 0200,
ar->debug.debugfs_pdev, ar,
&fops_simulate_awgn);
@@ -2705,35 +2713,63 @@ static const struct file_operations ath1
int ath12k_debugfs_add_interface(struct ath12k_link_vif *arvif)
{
struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_hw *hw = arvif->ar->ah->hw;
+ struct ieee80211_vif *vif = ahvif->vif;
+ u8 link_id = arvif->link_id;
+ int ret = 0;
- if (ahvif->vif->type == NL80211_IFTYPE_AP && !arvif->debugfs_twt) {
- arvif->debugfs_twt = debugfs_create_dir("twt",
- ahvif->vif->debugfs_dir);
- if (!arvif->debugfs_twt || IS_ERR(arvif->debugfs_twt)) {
- ath12k_warn(arvif->ar->ab,
- "failed to create directory %p\n",
- arvif->debugfs_twt);
- arvif->debugfs_twt = NULL;
- return -1;
- }
-
- debugfs_create_file("add_dialog", 0200, arvif->debugfs_twt,
- arvif, &ath12k_fops_twt_add_dialog);
+ if (ahvif->vif->type != NL80211_IFTYPE_AP)
+ goto exit;
- debugfs_create_file("del_dialog", 0200, arvif->debugfs_twt,
- arvif, &ath12k_fops_twt_del_dialog);
+ if (arvif->debugfs_twt)
+ goto exit;
- debugfs_create_file("pause_dialog", 0200, arvif->debugfs_twt,
- arvif, &ath12k_fops_twt_pause_dialog);
+ if (!hw->wiphy->num_hw)
+ arvif->debugfs_twt = debugfs_create_dir("twt",
+ vif->debugfs_dir);
+ else
+ arvif->debugfs_twt = debugfs_create_dir("twt",
+ vif->link_debugfs[link_id]);
- debugfs_create_file("resume_dialog", 0200, arvif->debugfs_twt,
- arvif, &ath12k_fops_twt_resume_dialog);
+ if (!arvif->debugfs_twt || IS_ERR(arvif->debugfs_twt)) {
+ ath12k_warn(arvif->ar->ab,
+ "failed to create directory %p\n",
+ arvif->debugfs_twt);
+ arvif->debugfs_twt = NULL;
+ ret = -1;
+ goto exit;
}
- return 0;
+
+ debugfs_create_file("add_dialog", 0200, arvif->debugfs_twt,
+ arvif, &ath12k_fops_twt_add_dialog);
+
+ debugfs_create_file("del_dialog", 0200, arvif->debugfs_twt,
+ arvif, &ath12k_fops_twt_del_dialog);
+
+ debugfs_create_file("pause_dialog", 0200, arvif->debugfs_twt,
+ arvif, &ath12k_fops_twt_pause_dialog);
+
+ debugfs_create_file("resume_dialog", 0200, arvif->debugfs_twt,
+ arvif, &ath12k_fops_twt_resume_dialog);
+
+exit:
+ return ret;
}
void ath12k_debugfs_remove_interface(struct ath12k_link_vif *arvif)
{
+ struct ath12k_vif *ahvif = arvif->ahvif;
+ struct ieee80211_vif *vif = ahvif->vif;
+ u8 link_id = arvif->link_id;
+
+ if (!arvif->debugfs_twt)
+ return;
+
+ if (!vif || !vif->link_debugfs[link_id]) {
+ arvif->debugfs_twt = NULL;
+ return;
+ }
+
debugfs_remove_recursive(arvif->debugfs_twt);
arvif->debugfs_twt = NULL;
}