Skip to contentSkip to conversation

ath11k: refactor debugfs code into debugfs.c

PATCH In review Kalle Valo 1 participant 6 messages Sep 16, 2020 – Sep 22, 2020 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
author
#1 lore raw

PATCH 2/4 ath11k: debugfs: use ath11k_debugfs_ prefix

In reply to Kalle Valo

As these functions are now defined in debugfs.c change the prefix to use ath11k_debugfs_ as well.

No functional changes. Compile tested only.

---
 drivers/net/wireless/ath/ath11k/core.c        | 12 +++---
 drivers/net/wireless/ath/ath11k/debugfs.c     | 46 ++++++++++-----------
 drivers/net/wireless/ath/ath11k/debugfs.h     | 58 +++++++++++++--------------
 drivers/net/wireless/ath/ath11k/debugfs_sta.c |  4 +-
 drivers/net/wireless/ath/ath11k/dp.c          |  2 +-
 drivers/net/wireless/ath/ath11k/dp_rx.c       |  8 ++--
 drivers/net/wireless/ath/ath11k/dp_tx.c       |  2 +-
 drivers/net/wireless/ath/ath11k/mac.c         |  6 +--
 drivers/net/wireless/ath/ath11k/wmi.c         |  2 +-
 9 files changed, 70 insertions(+), 70 deletions(-)
drivers/net/wireless/ath/ath11k/core.c +6 -6
index ce81702b27d2..1277f5117548 100644
@@ -412,7 +412,7 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 		return ret;
 	}
 
-	ret = ath11k_debug_soc_create(ab);
+	ret = ath11k_debugfs_soc_create(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to create ath11k debugfs\n");
 		goto err_qmi_deinit;
@@ -427,7 +427,7 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 	return 0;
 
 err_debugfs_reg:
-	ath11k_debug_soc_destroy(ab);
+	ath11k_debugfs_soc_destroy(ab);
 err_qmi_deinit:
 	ath11k_qmi_deinit_service(ab);
 	return ret;
@@ -435,7 +435,7 @@ static int ath11k_core_soc_create(struct ath11k_base *ab)
 
 static void ath11k_core_soc_destroy(struct ath11k_base *ab)
 {
-	ath11k_debug_soc_destroy(ab);
+	ath11k_debugfs_soc_destroy(ab);
 	ath11k_dp_free(ab);
 	ath11k_reg_free(ab);
 	ath11k_qmi_deinit_service(ab);
@@ -445,7 +445,7 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
 {
 	int ret;
 
-	ret = ath11k_debug_pdev_create(ab);
+	ret = ath11k_debugfs_pdev_create(ab);
 	if (ret) {
 		ath11k_err(ab, "failed to create core pdev debugfs: %d\n", ret);
 		return ret;
@@ -485,7 +485,7 @@ static int ath11k_core_pdev_create(struct ath11k_base *ab)
 err_mac_unregister:
 	ath11k_mac_unregister(ab);
 err_pdev_debug:
-	ath11k_debug_pdev_destroy(ab);
+	ath11k_debugfs_pdev_destroy(ab);
 
 	return ret;
 }
@@ -497,7 +497,7 @@ static void ath11k_core_pdev_destroy(struct ath11k_base *ab)
 	ath11k_mac_unregister(ab);
 	ath11k_hif_irq_disable(ab);
 	ath11k_dp_pdev_free(ab);
-	ath11k_debug_pdev_destroy(ab);
+	ath11k_debugfs_pdev_destroy(ab);
 }
 
 static int ath11k_core_start(struct ath11k_base *ab,
drivers/net/wireless/ath/ath11k/debugfs.c +23 -23

156 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs.h +29 -29

148 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs_sta.c +2 -2
index 7308ed254232..d189cc80805a 100644
@@ -825,10 +825,10 @@ void ath11k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 {
 	struct ath11k *ar = hw->priv;
 
-	if (ath11k_debug_is_extd_tx_stats_enabled(ar))
+	if (ath11k_debugfs_is_extd_tx_stats_enabled(ar))
 		debugfs_create_file("tx_stats", 0400, dir, sta,
 				    &fops_tx_stats);
-	if (ath11k_debug_is_extd_rx_stats_enabled(ar))
+	if (ath11k_debugfs_is_extd_rx_stats_enabled(ar))
 		debugfs_create_file("rx_stats", 0400, dir, sta,
 				    &fops_rx_stats);
 
drivers/net/wireless/ath/ath11k/dp.c +1 -1
index 2617ec221775..677e2d9fec11 100644
@@ -832,7 +832,7 @@ void ath11k_dp_pdev_free(struct ath11k_base *ab)
 	for (i = 0; i < ab->num_radios; i++) {
 		ar = ab->pdevs[i].ar;
 		ath11k_dp_rx_pdev_free(ab, i);
-		ath11k_debug_unregister(ar);
+		ath11k_debugfs_unregister(ar);
 		ath11k_dp_rx_pdev_mon_detach(ar);
 	}
 }
drivers/net/wireless/ath/ath11k/dp_rx.c +4 -4
index a507c1231a59..2c9251bde78b 100644
@@ -1433,7 +1433,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar,
 			HTT_USR_CMPLTN_LONG_RETRY(usr_stats->cmpltn_cmn.flags) +
 			HTT_USR_CMPLTN_SHORT_RETRY(usr_stats->cmpltn_cmn.flags);
 
-		if (ath11k_debug_is_extd_tx_stats_enabled(ar))
+		if (ath11k_debugfs_is_extd_tx_stats_enabled(ar))
 			ath11k_accumulate_per_peer_tx_stats(arsta,
 							    peer_stats, rate_idx);
 	}
@@ -1511,7 +1511,7 @@ static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab,
 		goto exit;
 	}
 
-	if (ath11k_debug_is_pktlog_lite_mode_enabled(ar))
+	if (ath11k_debugfs_is_pktlog_lite_mode_enabled(ar))
 		trace_ath11k_htt_ppdu_stats(ar, skb->data, len);
 
 	ppdu_info = ath11k_dp_htt_get_ppdu_desc(ar, ppdu_id);
@@ -2909,7 +2909,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,
 		memset(&ppdu_info, 0, sizeof(ppdu_info));
 		ppdu_info.peer_id = HAL_INVALID_PEERID;
 
-		if (ath11k_debug_is_pktlog_rx_stats_enabled(ar))
+		if (ath11k_debugfs_is_pktlog_rx_stats_enabled(ar))
 			trace_ath11k_htt_rxdesc(ar, skb->data, DP_RX_BUFFER_SIZE);
 
 		hal_status = ath11k_hal_rx_parse_mon_status(ab, &ppdu_info, skb);
@@ -2937,7 +2937,7 @@ int ath11k_dp_rx_process_mon_status(struct ath11k_base *ab, int mac_id,
 		arsta = (struct ath11k_sta *)peer->sta->drv_priv;
 		ath11k_dp_rx_update_peer_stats(arsta, &ppdu_info);
 
-		if (ath11k_debug_is_pktlog_peer_valid(ar, peer->addr))
+		if (ath11k_debugfs_is_pktlog_peer_valid(ar, peer->addr))
 			trace_ath11k_htt_rxdesc(ar, skb->data, DP_RX_BUFFER_SIZE);
 
 		spin_unlock_bh(&ab->base_lock);
drivers/net/wireless/ath/ath11k/dp_tx.c +1 -1
index 6565d9808042..7975cc036ba4 100644
@@ -457,7 +457,7 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 	    (info->flags & IEEE80211_TX_CTL_NO_ACK))
 		info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
 
-	if (ath11k_debug_is_extd_tx_stats_enabled(ar)) {
+	if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) {
 		if (ts->flags & HAL_TX_STATUS_FLAGS_FIRST_MSDU) {
 			if (ar->last_ppdu_id == 0) {
 				ar->last_ppdu_id = ts->ppdu_id;
drivers/net/wireless/ath/ath11k/mac.c +3 -3
index c1217e3b3b98..69621160cb62 100644
@@ -2967,7 +2967,7 @@ static int ath11k_mac_station_add(struct ath11k *ar,
 	ath11k_dbg(ab, ATH11K_DBG_MAC, "Added peer: %pM for VDEV: %d\n",
 		   sta->addr, arvif->vdev_id);
 
-	if (ath11k_debug_is_extd_tx_stats_enabled(ar)) {
+	if (ath11k_debugfs_is_extd_tx_stats_enabled(ar)) {
 		arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), GFP_KERNEL);
 		if (!arsta->tx_stats) {
 			ret = -ENOMEM;
@@ -4101,7 +4101,7 @@ static int ath11k_mac_config_mon_status_default(struct ath11k *ar, bool enable)
 
 	if (enable) {
 		tlv_filter = ath11k_mac_mon_status_filter_default;
-		tlv_filter.rx_filter = ath11k_debug_rx_filter(ar);
+		tlv_filter.rx_filter = ath11k_debugfs_rx_filter(ar);
 	}
 
 	for (i = 0; i < ab->hw_params.num_rxmda_per_pdev; i++) {
@@ -6226,7 +6226,7 @@ static int __ath11k_mac_register(struct ath11k *ar)
 		goto err_free;
 	}
 
-	ret = ath11k_debug_register(ar);
+	ret = ath11k_debugfs_register(ar);
 	if (ret) {
 		ath11k_err(ar->ab, "debugfs registration failed: %d\n", ret);
 		goto err_free;
drivers/net/wireless/ath/ath11k/wmi.c +1 -1
index adde14a390ec..078f88371ff1 100644
@@ -6301,7 +6301,7 @@ static void ath11k_peer_assoc_conf_event(struct ath11k_base *ab, struct sk_buff
 
 static void ath11k_update_stats_event(struct ath11k_base *ab, struct sk_buff *skb)
 {
-	ath11k_debug_fw_stats_process(ab, skb);
+	ath11k_debugfs_fw_stats_process(ab, skb);
 }
 
 /* PDEV_CTL_FAILSAFE_CHECK_EVENT is received from FW when the frequency scanned
Signature · 7 lines
2.7.4


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

Kalle Valo

author
#0 lore raw

PATCH 1/4 ath11k: refactor debugfs code into debugfs.c

If CONFIG_ATH11K_DEBUGFS is disabled there are warnings debug.c:

drivers/net/wireless/ath/ath11k/debug.c:36:20: warning: 'htt_bp_lmac_ring' defined but not used [-Wunused-variable]

   36 | static const char *htt_bp_lmac_ring[HTT_SW_LMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.c:15:20: warning: 'htt_bp_umac_ring' defined but not used [-Wunused-variable]
   15 | static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~

Fix this by refactoring debugfs code to debugfs.c. This also reduces the number of ifdefs in debug.c and makes it easier to maintain the code.

No functional changes. Compile tested only.

---
 drivers/net/wireless/ath/ath11k/Makefile  |    2 +-
 drivers/net/wireless/ath/ath11k/debug.c   | 1108 +---------------------------
 drivers/net/wireless/ath/ath11k/debug.h   |  244 +------
 drivers/net/wireless/ath/ath11k/debugfs.c | 1112 +++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/debugfs.h |  253 +++++++
 5 files changed, 1369 insertions(+), 1350 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/debugfs.c
 create mode 100644 drivers/net/wireless/ath/ath11k/debugfs.h
drivers/net/wireless/ath/ath11k/Makefile +1 -1
index bc4911f0339d..bb57d0e2dd9f 100644
@@ -18,7 +18,7 @@ ath11k-y += core.o \
 	    dbring.o \
 	    hw.o
 
-ath11k-$(CONFIG_ATH11K_DEBUGFS) += debug_htt_stats.o debugfs_sta.o
+ath11k-$(CONFIG_ATH11K_DEBUGFS) += debugfs.o debug_htt_stats.o debugfs_sta.o
 ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
 ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
 ath11k-$(CONFIG_THERMAL) += thermal.o
drivers/net/wireless/ath/ath11k/debug.c +2 -1106

1,123 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debug.h +1 -243

263 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs.c new file +1112 -0

1,112 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs.h new file +253 -0

253 lines not on this page · raw message

Signature · 7 lines
2.7.4


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
author
#2 lore raw

PATCH 3/4 ath11k: rename debug_htt_stats.[c|h] to debugfs_htt_stats.[c|h]

For consistency with debugfs.c rename debug_htt_stats files and functions to debugfs_htt_stats.

No functional changes. Compile tested only.

---
 drivers/net/wireless/ath/ath11k/Makefile           |    2 +-
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c  | 4598 --------------------
 drivers/net/wireless/ath/ath11k/debug_htt_stats.h  | 1690 -------
 drivers/net/wireless/ath/ath11k/debugfs.c          |    4 +-
 .../net/wireless/ath/ath11k/debugfs_htt_stats.c    | 4598 ++++++++++++++++++++
 .../net/wireless/ath/ath11k/debugfs_htt_stats.h    | 1690 +++++++
 drivers/net/wireless/ath/ath11k/debugfs_sta.c      |    2 +-
 7 files changed, 6292 insertions(+), 6292 deletions(-)
 delete mode 100644 drivers/net/wireless/ath/ath11k/debug_htt_stats.c
 delete mode 100644 drivers/net/wireless/ath/ath11k/debug_htt_stats.h
 create mode 100644 drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c
 create mode 100644 drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h
drivers/net/wireless/ath/ath11k/Makefile +1 -1
index bb57d0e2dd9f..c41d87bd025a 100644
@@ -18,7 +18,7 @@ ath11k-y += core.o \
 	    dbring.o \
 	    hw.o
 
-ath11k-$(CONFIG_ATH11K_DEBUGFS) += debugfs.o debug_htt_stats.o debugfs_sta.o
+ath11k-$(CONFIG_ATH11K_DEBUGFS) += debugfs.o debugfs_htt_stats.o debugfs_sta.o
 ath11k-$(CONFIG_NL80211_TESTMODE) += testmode.o
 ath11k-$(CONFIG_ATH11K_TRACING) += trace.o
 ath11k-$(CONFIG_THERMAL) += thermal.o
drivers/net/wireless/ath/ath11k/debug_htt_stats.c deleted +0 -4598

2,992 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debug_htt_stats.h deleted +0 -1690

1,690 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs.c +2 -2
index 7ac5f69cb6ad..5193b308a992 100644

Lines of this file are not shown. View the raw message.

drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c new file +4598 -0

4,598 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h new file +1690 -0

1,690 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debugfs_sta.c +1 -1
index d189cc80805a..14f2e904a89d 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 7 lines
2.7.4


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

Part of the diff is not shown here. View the raw message.

author
#3 lore raw

PATCH 4/4 ath11k: debugfs: move some function declarations to correct header files

In reply to Kalle Valo

Some of the function declarations are for functions in debugfs_htt_stats.c and debugfs_sta.c, move them to corresponding header files. As debugfs_sta.h didn't exist create it.

Also in debugfs_htt_stats.h move dunction declarations to the end of the file.

No functional changes. Compile tested only.

---
 drivers/net/wireless/ath/ath11k/debugfs.h          | 28 +-------------
 .../net/wireless/ath/ath11k/debugfs_htt_stats.c    |  8 ++--
 .../net/wireless/ath/ath11k/debugfs_htt_stats.h    |  7 +++-
 drivers/net/wireless/ath/ath11k/debugfs_sta.c      | 23 +++++------
 drivers/net/wireless/ath/ath11k/debugfs_sta.h      | 44 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/dp_rx.c            |  7 ++--
 drivers/net/wireless/ath/ath11k/dp_tx.c            |  5 ++-
 drivers/net/wireless/ath/ath11k/mac.c              |  3 +-
 8 files changed, 75 insertions(+), 50 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath11k/debugfs_sta.h
drivers/net/wireless/ath/ath11k/debugfs.h +1 -27
index 4b7867c5f26f..d1ed2e72e5d1 100644
@@ -110,12 +110,9 @@ int ath11k_debugfs_pdev_create(struct ath11k_base *ab);
 void ath11k_debugfs_pdev_destroy(struct ath11k_base *ab);
 int ath11k_debugfs_register(struct ath11k *ar);
 void ath11k_debugfs_unregister(struct ath11k *ar);
-void ath11k_dbg_htt_ext_stats_handler(struct ath11k_base *ab,
-				      struct sk_buff *skb);
 void ath11k_debugfs_fw_stats_process(struct ath11k_base *ab, struct sk_buff *skb);
 
 void ath11k_debugfs_fw_stats_init(struct ath11k *ar);
-int ath11k_dbg_htt_stats_req(struct ath11k *ar);
 
 static inline bool ath11k_debugfs_is_pktlog_lite_mode_enabled(struct ath11k *ar)
 {
@@ -148,15 +145,6 @@ static inline int ath11k_debugfs_rx_filter(struct ath11k *ar)
 	return ar->debug.rx_filter;
 }
 
-void ath11k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-			    struct ieee80211_sta *sta, struct dentry *dir);
-void
-ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
-				    struct ath11k_per_peer_tx_stats *peer_stats,
-				    u8 legacy_rate_idx);
-void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
-					       struct sk_buff *msdu,
-					       struct hal_tx_status *ts);
 #else
 static inline int ath11k_debugfs_soc_create(struct ath11k_base *ab)
 {
@@ -209,7 +197,7 @@ static inline int ath11k_debugfs_is_extd_rx_stats_enabled(struct ath11k *ar)
 	return 0;
 }
 
-static inline int ath11k_dbg_htt_stats_req(struct ath11k *ar)
+static inline int ath11k_debugfs_htt_stats_req(struct ath11k *ar)
 {
 	return 0;
 }
@@ -234,20 +222,6 @@ static inline int ath11k_debugfs_rx_filter(struct ath11k *ar)
 	return 0;
 }
 
-static inline void
-ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
-				    struct ath11k_per_peer_tx_stats *peer_stats,
-				    u8 legacy_rate_idx)
-{
-}
-
-static inline void
-ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
-					  struct sk_buff *msdu,
-					  struct hal_tx_status *ts)
-{
-}
-
 #endif /* CONFIG_MAC80211_DEBUGFS*/
 
 #endif /* _ATH11K_DEBUGFS_H_ */
drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c +4 -4
index 6f6e8ca014a1..9191ffa081c2 100644
@@ -4253,8 +4253,8 @@ static int ath11k_dbg_htt_ext_stats_parse(struct ath11k_base *ab,
 	return 0;
 }
 
-void ath11k_dbg_htt_ext_stats_handler(struct ath11k_base *ab,
-				      struct sk_buff *skb)
+void ath11k_debugfs_htt_ext_stats_handler(struct ath11k_base *ab,
+					  struct sk_buff *skb)
 {
 	struct ath11k_htt_extd_stats_msg *msg;
 	struct debug_htt_stats_req *stats_req;
@@ -4402,7 +4402,7 @@ static int ath11k_prep_htt_stats_cfg_params(struct ath11k *ar, u8 type,
 	return 0;
 }
 
-int ath11k_dbg_htt_stats_req(struct ath11k *ar)
+int ath11k_debugfs_htt_stats_req(struct ath11k *ar)
 {
 	struct debug_htt_stats_req *stats_req = ar->debug.htt_stats.stats_req;
 	u8 type = stats_req->type;
@@ -4476,7 +4476,7 @@ static int ath11k_open_htt_stats(struct inode *inode, struct file *file)
 	ar->debug.htt_stats.stats_req = stats_req;
 	stats_req->type = type;
 
-	ret = ath11k_dbg_htt_stats_req(ar);
+	ret = ath11k_debugfs_htt_stats_req(ar);
 	if (ret < 0)
 		goto out;
 
drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h +5 -2
index d2d01bfc5081..a36a4fed8800 100644
@@ -1660,8 +1660,6 @@ struct htt_pdev_obss_pd_stats_tlv {
 	u32        num_obss_tx_ppdu_failure;
 };
 
-void ath11k_debugfs_htt_stats_init(struct ath11k *ar);
-
 struct htt_ring_backpressure_stats_tlv {
 	u32 pdev_id;
 	u32 current_head_idx;
@@ -1687,4 +1685,9 @@ struct htt_ring_backpressure_stats_tlv {
 	u32 backpressure_hist[5];
 };
 
+void ath11k_debugfs_htt_stats_init(struct ath11k *ar);
+void ath11k_debugfs_htt_ext_stats_handler(struct ath11k_base *ab,
+					  struct sk_buff *skb);
+int ath11k_debugfs_htt_stats_req(struct ath11k *ar);
+
 #endif
drivers/net/wireless/ath/ath11k/debugfs_sta.c +12 -11
index 14f2e904a89d..270c0edbb10f 100644
@@ -5,16 +5,16 @@
 
 #include <linux/vmalloc.h>
 
+#include "debugfs_sta.h"
 #include "core.h"
 #include "peer.h"
 #include "debug.h"
 #include "dp_tx.h"
 #include "debugfs_htt_stats.h"
 
-void
-ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
-				    struct ath11k_per_peer_tx_stats *peer_stats,
-				    u8 legacy_rate_idx)
+void ath11k_debugfs_sta_add_tx_stats(struct ath11k_sta *arsta,
+				     struct ath11k_per_peer_tx_stats *peer_stats,
+				     u8 legacy_rate_idx)
 {
 	struct rate_info *txrate = &arsta->txrate;
 	struct ath11k_htt_tx_stats *tx_stats;
@@ -125,9 +125,9 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
 	tx_stats->tx_duration += peer_stats->duration;
 }
 
-void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
-					       struct sk_buff *msdu,
-					       struct hal_tx_status *ts)
+void ath11k_debugfs_sta_update_txcompl(struct ath11k *ar,
+				       struct sk_buff *msdu,
+				       struct hal_tx_status *ts)
 {
 	struct ath11k_base *ab = ar->ab;
 	struct ath11k_per_peer_tx_stats *peer_stats = &ar->cached_stats;
@@ -200,7 +200,8 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar,
 	arsta->txrate.nss = arsta->last_txrate.nss;
 	arsta->txrate.bw = ath11k_mac_bw_to_mac80211_bw(bw);
 
-	ath11k_accumulate_per_peer_tx_stats(arsta, peer_stats, rate_idx);
+	ath11k_debugfs_sta_add_tx_stats(arsta, peer_stats, rate_idx);
+
 err_out:
 	spin_unlock_bh(&ab->base_lock);
 	rcu_read_unlock();
@@ -428,7 +429,7 @@ ath11k_dbg_sta_open_htt_peer_stats(struct inode *inode, struct file *file)
 	ar->debug.htt_stats.stats_req = stats_req;
 	stats_req->type = ATH11K_DBG_HTT_EXT_STATS_PEER_INFO;
 	memcpy(stats_req->peer_addr, sta->addr, ETH_ALEN);
-	ret = ath11k_dbg_htt_stats_req(ar);
+	ret = ath11k_debugfs_htt_stats_req(ar);
 	mutex_unlock(&ar->conf_mutex);
 	if (ret < 0)
 		goto out;
@@ -820,8 +821,8 @@ static const struct file_operations fops_htt_peer_stats_reset = {
 	.llseek = default_llseek,
 };
 
-void ath11k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-			    struct ieee80211_sta *sta, struct dentry *dir)
+void ath11k_debugfs_sta_op_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+			       struct ieee80211_sta *sta, struct dentry *dir)
 {
 	struct ath11k *ar = hw->priv;
 
drivers/net/wireless/ath/ath11k/debugfs_sta.h new file +44 -0

44 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/dp_rx.c +4 -3
index 2c9251bde78b..345eaa4f20f3 100644
@@ -9,6 +9,8 @@
 #include <crypto/hash.h>
 #include "core.h"
 #include "debug.h"
+#include "debugfs_htt_stats.h"
+#include "debugfs_sta.h"
 #include "hal_desc.h"
 #include "hw.h"
 #include "dp_rx.h"
@@ -1434,8 +1436,7 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar,
 			HTT_USR_CMPLTN_SHORT_RETRY(usr_stats->cmpltn_cmn.flags);
 
 		if (ath11k_debugfs_is_extd_tx_stats_enabled(ar))
-			ath11k_accumulate_per_peer_tx_stats(arsta,
-							    peer_stats, rate_idx);
+			ath11k_debugfs_sta_add_tx_stats(arsta, peer_stats, rate_idx);
 	}
 
 	spin_unlock_bh(&ab->base_lock);
@@ -1658,7 +1659,7 @@ void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
 		ath11k_htt_pull_ppdu_stats(ab, skb);
 		break;
 	case HTT_T2H_MSG_TYPE_EXT_STATS_CONF:
-		ath11k_dbg_htt_ext_stats_handler(ab, skb);
+		ath11k_debugfs_htt_ext_stats_handler(ab, skb);
 		break;
 	case HTT_T2H_MSG_TYPE_PKTLOG:
 		ath11k_htt_pktlog(ab, skb);
drivers/net/wireless/ath/ath11k/dp_tx.c +3 -2
index 7975cc036ba4..8625465500de 100644
@@ -6,6 +6,7 @@
 #include "core.h"
 #include "dp_tx.h"
 #include "debug.h"
+#include "debugfs_sta.h"
 #include "hw.h"
 #include "peer.h"
 
@@ -465,12 +466,12 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,
 				   ar->cached_ppdu_id == ar->last_ppdu_id) {
 				ar->cached_ppdu_id = ar->last_ppdu_id;
 				ar->cached_stats.is_ampdu = true;
-				ath11k_update_per_peer_stats_from_txcompl(ar, msdu, ts);
+				ath11k_debugfs_sta_update_txcompl(ar, msdu, ts);
 				memset(&ar->cached_stats, 0,
 				       sizeof(struct ath11k_per_peer_tx_stats));
 			} else {
 				ar->cached_stats.is_ampdu = false;
-				ath11k_update_per_peer_stats_from_txcompl(ar, msdu, ts);
+				ath11k_debugfs_sta_update_txcompl(ar, msdu, ts);
 				memset(&ar->cached_stats, 0,
 				       sizeof(struct ath11k_per_peer_tx_stats));
 			}
drivers/net/wireless/ath/ath11k/mac.c +2 -1
index 69621160cb62..86a1b984859f 100644
@@ -14,6 +14,7 @@
 #include "dp_rx.h"
 #include "testmode.h"
 #include "peer.h"
+#include "debugfs_sta.h"
 
 #define CHAN2G(_channel, _freq, _flags) { \
 	.band                   = NL80211_BAND_2GHZ, \
@@ -5867,7 +5868,7 @@ static const struct ieee80211_ops ath11k_ops = {
 	.sta_statistics			= ath11k_mac_op_sta_statistics,
 	CFG80211_TESTMODE_CMD(ath11k_tm_cmd)
 #ifdef CONFIG_ATH11K_DEBUGFS
-	.sta_add_debugfs		= ath11k_sta_add_debugfs,
+	.sta_add_debugfs		= ath11k_debugfs_sta_op_add,
 #endif
 };
 
Signature · 7 lines
2.7.4


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
author
#4 lore raw
In reply to Kalle Valo
Quoted 9 lines · Kalle Valo

If CONFIG_ATH11K_DEBUGFS is disabled there are warnings debug.c:

drivers/net/wireless/ath/ath11k/debug.c:36:20: warning: 'htt_bp_lmac_ring' defined but not used [-Wunused-variable]

   36 | static const char *htt_bp_lmac_ring[HTT_SW_LMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.c:15:20: warning: 'htt_bp_umac_ring' defined but not used [-Wunused-variable]
   15 | static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~
Quoted 7 lines

Fix this by refactoring debugfs code to debugfs.c. This also reduces the number of ifdefs in debug.c and makes it easier to maintain the code.

No functional changes. Compile tested only.

4 patches applied to ath-next branch of ath.git, thanks.

da3a9d3c1576 ath11k: refactor debugfs code into debugfs.c
cb4e57db2ff0 ath11k: debugfs: use ath11k_debugfs_ prefix
56292162b9a2 ath11k: rename debug_htt_stats.[c|h] to debugfs_htt_stats.[c|h] 568f06036ee2 ath11k: debugfs: move some function declarations to correct header files

Signature · 3 lines
https://patchwork.kernel.org/patch/11781017/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author
#5 lore raw
In reply to Kalle Valo
Quoted 9 lines · Kalle Valo

If CONFIG_ATH11K_DEBUGFS is disabled there are warnings debug.c:

drivers/net/wireless/ath/ath11k/debug.c:36:20: warning: 'htt_bp_lmac_ring' defined but not used [-Wunused-variable]

   36 | static const char *htt_bp_lmac_ring[HTT_SW_LMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath11k/debug.c:15:20: warning: 'htt_bp_umac_ring' defined but not used [-Wunused-variable]
   15 | static const char *htt_bp_umac_ring[HTT_SW_UMAC_RING_IDX_MAX] = {
      |                    ^~~~~~~~~~~~~~~~
Quoted 7 lines

Fix this by refactoring debugfs code to debugfs.c. This also reduces the number of ifdefs in debug.c and makes it easier to maintain the code.

No functional changes. Compile tested only.

4 patches applied to ath-next branch of ath.git, thanks.

da3a9d3c1576 ath11k: refactor debugfs code into debugfs.c
cb4e57db2ff0 ath11k: debugfs: use ath11k_debugfs_ prefix
56292162b9a2 ath11k: rename debug_htt_stats.[c|h] to debugfs_htt_stats.[c|h] 568f06036ee2 ath11k: debugfs: move some function declarations to correct header files

Signature · 9 lines
https://patchwork.kernel.org/patch/11781017/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


-- 
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k