Skip to contentSkip to conversation

ath11k: Add some bug fixes and enhancements in htt stats

PATCH Superseded Bhagavathi Perumal S 2 participants 6 messages Apr 15, 2019 – Apr 23, 2019 Qualcomm Atheros ATH11K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ath11k: Add some bug fixes and enhancements in htt stats

This fixes few coding bugs, And adds htt peer stats as a separate debugfs entry and htt stats reset.

Bhagavathi Perumal S (3):
ath11k: Fix few coding bugs in htt stats
ath11k: Add htt peer stats support
ath11k: Add debugfs entry to support htt stats reset

 drivers/net/wireless/ath/ath11k/core.h            |   11 +-
 drivers/net/wireless/ath/ath11k/debug.h           |   50 +
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c | 1338 +++++++++------------
 drivers/net/wireless/ath/ath11k/debug_htt_stats.h |  134 +--
 drivers/net/wireless/ath/ath11k/debugfs_sta.c     |   56 +
 drivers/net/wireless/ath/ath11k/dp.h              |   41 +
 drivers/net/wireless/ath/ath11k/dp_tx.c           |   12 +-
 drivers/net/wireless/ath/ath11k/dp_tx.h           |    4 +-
 8 files changed, 709 insertions(+), 937 deletions(-)
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw

PATCH 1/3 ath11k: Fix few coding bugs in htt stats

Identified incorrect processing of tlv buffer, fix it by removing tlv headers from stats tlv structures.

And fix few bugs to make htt stats work,
-Fix NULL deferences when accessing variable tlv buffers. -Setting correct pdev id when requesting htt stats.

---
 drivers/net/wireless/ath/ath11k/core.h            |   10 +-
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c | 1182 +++++++--------------
 drivers/net/wireless/ath/ath11k/debug_htt_stats.h |  108 +-
 drivers/net/wireless/ath/ath11k/dp.h              |    1 +
 drivers/net/wireless/ath/ath11k/dp_tx.c           |    6 +-
 drivers/net/wireless/ath/ath11k/dp_tx.h           |    3 +-
 6 files changed, 417 insertions(+), 893 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +7 -3
index b2a3cac..c5f0a71 100644
@@ -366,11 +366,15 @@ struct ath11k_fw_stats {
 	struct list_head peers_extd;
 };
 
+struct ath11k_dbg_htt_stats {
+	u8 type;
+	/* protects shared stats req buffer */
+	spinlock_t lock;
+};
+
 struct ath11k_debug {
 	struct dentry *debugfs_pdev;
-	u32 htt_stats_type;
-	/* protects shared stats req buffer */
-	spinlock_t stats_lock;
+	struct ath11k_dbg_htt_stats htt_stats;
 	u32 extd_tx_stats;
 	struct ath11k_fw_stats fw_stats;
 	struct completion fw_stats_complete;
drivers/net/wireless/ath/ath11k/debug_htt_stats.c +399 -783

2,130 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debug_htt_stats.h +5 -103

617 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/dp.h +1 -0
index 5674053..fb880df 100644
@@ -1156,6 +1156,7 @@ struct htt_ext_stats_cfg_cmd {
 	u32 cfg_param1;
 	u32 cfg_param2;
 	u32 cfg_param3;
+	u32 reserved;
 	u32 cookie_lsb;
 	u32 cookie_msb;
 } __packed;
drivers/net/wireless/ath/ath11k/dp_tx.c +3 -3
index 5324c5f..c6b0339 100644
@@ -856,7 +856,7 @@ int ath11k_dp_htt_rx_filter_setup(struct ath11k_base *ab, u32 ring_id,
 	return ret;
 }
 
-int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 mask, u64 cookie)
+int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type, u64 cookie)
 {
 	struct ath11k_base *ab = ar->ab;
 	struct ath11k_dp *dp = &ab->dp;
@@ -875,9 +875,9 @@ int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 mask, u64 cookie)
 	memset(cmd, 0, sizeof(*cmd));
 	cmd->hdr.msg_type = HTT_H2T_MSG_TYPE_EXT_STATS_CFG;
 
-	cmd->hdr.pdev_mask = 1 << DP_SW2HW_MACID(ar->pdev->pdev_id);
+	cmd->hdr.pdev_mask = 1 << ar->pdev->pdev_id;
 
-	cmd->hdr.stats_type = mask;
+	cmd->hdr.stats_type = type;
 	cmd->cookie_lsb = lower_32_bits(cookie);
 	cmd->cookie_msb = upper_32_bits(cookie);
 
drivers/net/wireless/ath/ath11k/dp_tx.h +2 -1
index a9d03da..8dd8e2b 100644
@@ -26,5 +26,6 @@ int ath11k_dp_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx_tid,
 					enum hal_reo_cmd_status));
 
 int ath11k_dp_htt_h2t_ppdu_stats_req(struct ath11k *ar, u32 mask);
-int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 mask, u64 cookie);
+int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type,
+				    u64 cookie);
 #endif
Signature · 7 lines
1.9.1


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

PATCH 2/3 ath11k: Add htt peer stats support

In reply to Bhagavathi Perumal S

This adds separate debugfs entry to get per peer htt stats. And adds config params in htt stats request, this is used to enter peer mac addr for per peer stats and other default settings.

Example output log is,

$cat /sys/kernel/debug/ieee80211/phy0/netdev:wlan0/stations/8c:fd:f0:07:3e:39/htt_peer_stats HTT_PEER_DETAILS_TLV:
peer_type = 0
sw_peer_id = 6
vdev_id = 0
pdev_id = 0
ast_idx = 906
mac_addr = 8c:fd:f0:07:3e:39
peer_flags = 0x18b0
qpeer_flags = 0x8
....

---
 drivers/net/wireless/ath/ath11k/debug.h           |  50 ++++++++++
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c | 115 +++++++++++++++++-----
 drivers/net/wireless/ath/ath11k/debug_htt_stats.h |  30 ------
 drivers/net/wireless/ath/ath11k/debugfs_sta.c     |  56 +++++++++++
 drivers/net/wireless/ath/ath11k/dp.h              |  40 ++++++++
 drivers/net/wireless/ath/ath11k/dp_tx.c           |   8 +-
 drivers/net/wireless/ath/ath11k/dp_tx.h           |   1 +
 7 files changed, 243 insertions(+), 57 deletions(-)
drivers/net/wireless/ath/ath11k/debug.h +50 -0
index 66a596c..4c1fcca 100644
@@ -23,6 +23,48 @@ enum ath11k_debug_mask {
 	ATH11K_DBG_ANY		= 0xffffffff,
 };
 
+/* htt_dbg_ext_stats_type */
+enum ath11k_dbg_htt_ext_stats_type {
+	ATH11K_DBG_HTT_EXT_STATS_RESET                      =  0,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TX                    =  1,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_RX                    =  2,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_HWQ                =  3,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_SCHED              =  4,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_ERROR                 =  5,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TQM                   =  6,
+	ATH11K_DBG_HTT_EXT_STATS_TQM_CMDQ                   =  7,
+	ATH11K_DBG_HTT_EXT_STATS_TX_DE_INFO                 =  8,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_RATE               =  9,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_RX_RATE               =  10,
+	ATH11K_DBG_HTT_EXT_STATS_PEER_INFO                  =  11,
+	ATH11K_DBG_HTT_EXT_STATS_TX_SELFGEN_INFO            =  12,
+	ATH11K_DBG_HTT_EXT_STATS_TX_MU_HWQ                  =  13,
+	ATH11K_DBG_HTT_EXT_STATS_RING_IF_INFO               =  14,
+	ATH11K_DBG_HTT_EXT_STATS_SRNG_INFO                  =  15,
+	ATH11K_DBG_HTT_EXT_STATS_SFM_INFO                   =  16,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_MU                 =  17,
+	ATH11K_DBG_HTT_EXT_STATS_ACTIVE_PEERS_LIST          =  18,
+	ATH11K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS             =  19,
+	ATH11K_DBG_HTT_EXT_STATS_TWT_SESSIONS               =  20,
+	ATH11K_DBG_HTT_EXT_STATS_REO_RESOURCE_STATS         =  21,
+	ATH11K_DBG_HTT_EXT_STATS_TX_SOUNDING_INFO           =  22,
+
+	/* keep this last */
+	ATH11K_DBG_HTT_NUM_EXT_STATS,
+};
+
+struct debug_htt_stats_req {
+	bool done;
+	u8 pdev_id;
+	u8 type;
+	u8 peer_addr[ETH_ALEN];
+	struct completion cmpln;
+	u32 buf_len;
+	u8 buf[0];
+};
+
+#define ATH11K_HTT_STATS_BUF_SIZE (1024 * 512)
+
 #define ATH11K_FW_STATS_BUF_SIZE (1024 * 1024)
 
 enum ath11k_pktlog_filter {
@@ -101,6 +143,8 @@ void ath11k_debug_fw_stats_process(struct ath11k_base *ab, u8 *evt_buf,
 				   u32 len);
 
 void ath11k_debug_fw_stats_init(struct ath11k *ar);
+int ath11k_dbg_htt_stats_req(struct ath11k *ar,
+			     struct debug_htt_stats_req *stats_req);
 
 static inline int ath11k_debug_is_extd_tx_stats_enabled(struct ath11k *ar)
 {
@@ -157,6 +201,12 @@ static inline int ath11k_debug_is_extd_rx_stats_enabled(struct ath11k *ar)
 {
 	return 0;
 }
+
+static inline int ath11k_dbg_htt_stats_req(struct ath11k *ar,
+					   struct debug_htt_stats_req *stats_req)
+{
+	return 0;
+}
 #endif /* CONFIG_ATH11K_DEBUGFS */
 
 #ifdef CONFIG_MAC80211_DEBUGFS
drivers/net/wireless/ath/ath11k/debug_htt_stats.c +89 -26

164 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/debug_htt_stats.h +0 -30
index ce1f8fb..a542bd3 100644
@@ -6,36 +6,6 @@
 #ifndef DEBUG_HTT_STATS_H
 #define DEBUG_HTT_STATS_H
 
-/* htt_dbg_ext_stats_type */
-enum htt_dbg_ext_stats_type {
-	HTT_DBG_EXT_STATS_RESET                      =  0,
-	HTT_DBG_EXT_STATS_PDEV_TX                    =  1,
-	HTT_DBG_EXT_STATS_PDEV_RX                    =  2,
-	HTT_DBG_EXT_STATS_PDEV_TX_HWQ                =  3,
-	HTT_DBG_EXT_STATS_PDEV_TX_SCHED              =  4,
-	HTT_DBG_EXT_STATS_PDEV_ERROR                 =  5,
-	HTT_DBG_EXT_STATS_PDEV_TQM                   =  6,
-	HTT_DBG_EXT_STATS_TQM_CMDQ                   =  7,
-	HTT_DBG_EXT_STATS_TX_DE_INFO                 =  8,
-	HTT_DBG_EXT_STATS_PDEV_TX_RATE               =  9,
-	HTT_DBG_EXT_STATS_PDEV_RX_RATE               =  10,
-	HTT_DBG_EXT_STATS_PEER_INFO                  =  11,
-	HTT_DBG_EXT_STATS_TX_SELFGEN_INFO            =  12,
-	HTT_DBG_EXT_STATS_TX_MU_HWQ                  =  13,
-	HTT_DBG_EXT_STATS_RING_IF_INFO               =  14,
-	HTT_DBG_EXT_STATS_SRNG_INFO                  =  15,
-	HTT_DBG_EXT_STATS_SFM_INFO                   =  16,
-	HTT_DBG_EXT_STATS_PDEV_TX_MU                 =  17,
-	HTT_DBG_EXT_STATS_ACTIVE_PEERS_LIST          =  18,
-	HTT_DBG_EXT_STATS_PDEV_CCA_STATS             =  19,
-	HTT_DBG_EXT_STATS_TWT_SESSIONS               =  20,
-	HTT_DBG_EXT_STATS_REO_RESOURCE_STATS         =  21,
-	HTT_DBG_EXT_STATS_TX_SOUNDING_INFO           =  22,
-
-	/* keep this last */
-	HTT_DBG_NUM_EXT_STATS,
-};
-
 enum htt_tlv_tag_t {
 	HTT_STATS_TX_PDEV_CMN_TAG                           = 0,
 	HTT_STATS_TX_PDEV_UNDERRUN_TAG                      = 1,
drivers/net/wireless/ath/ath11k/debugfs_sta.c +56 -0

66 lines not on this page · raw message

drivers/net/wireless/ath/ath11k/dp.h +40 -0
index fb880df..2774a4c 100644
@@ -1161,6 +1161,46 @@ struct htt_ext_stats_cfg_cmd {
 	u32 cookie_msb;
 } __packed;
 
+/* htt stats config default params */
+#define HTT_STAT_DEFAULT_RESET_START_OFFSET 0
+#define HTT_STAT_DEFAULT_CFG0_ALL_HWQS 0xffffffff
+#define HTT_STAT_DEFAULT_CFG0_ALL_TXQS 0xffffffff
+#define HTT_STAT_DEFAULT_CFG0_ALL_CMDQS 0xffff
+#define HTT_STAT_DEFAULT_CFG0_ALL_RINGS 0xffff
+#define HTT_STAT_DEFAULT_CFG0_ACTIVE_PEERS 0xff
+#define HTT_STAT_DEFAULT_CFG0_CCA_CUMULATIVE 0x10
+#define HTT_STAT_DEFAULT_CFG0_ACTIVE_VDEVS 0xff
+
+/* HTT_DBG_EXT_STATS_PEER_INFO
+ * PARAMS:
+ * @config_param0:
+ *  [Bit0] - [0] for sw_peer_id, [1] for mac_addr based request
+ *  [Bit15 : Bit 1] htt_peer_stats_req_mode_t
+ *  [Bit31 : Bit16] sw_peer_id
+ * @config_param1:
+ *  peer_stats_req_type_mask:32 (enum htt_peer_stats_tlv_enum)
+ *   0 bit htt_peer_stats_cmn_tlv
+ *   1 bit htt_peer_details_tlv
+ *   2 bit htt_tx_peer_rate_stats_tlv
+ *   3 bit htt_rx_peer_rate_stats_tlv
+ *   4 bit htt_tx_tid_stats_tlv/htt_tx_tid_stats_v1_tlv
+ *   5 bit htt_rx_tid_stats_tlv
+ *   6 bit htt_msdu_flow_stats_tlv
+ * @config_param2: [Bit31 : Bit0] mac_addr31to0
+ * @config_param3: [Bit15 : Bit0] mac_addr47to32
+ *                [Bit31 : Bit16] reserved
+ */
+#define HTT_STAT_PEER_INFO_MAC_ADDR BIT(0)
+#define HTT_STAT_DEFAULT_PEER_REQ_TYPE 0x7f
+
+/* Used to set different configs to the specified stats type.*/
+struct htt_ext_stats_cfg_params {
+	u32 cfg0;
+	u32 cfg1;
+	u32 cfg2;
+	u32 cfg3;
+};
+
 /**
  * @brief target -> host extended statistics upload
  *
drivers/net/wireless/ath/ath11k/dp_tx.c +7 -1
index c6b0339..d121624 100644
@@ -856,7 +856,9 @@ int ath11k_dp_htt_rx_filter_setup(struct ath11k_base *ab, u32 ring_id,
 	return ret;
 }
 
-int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type, u64 cookie)
+int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type,
+				    struct htt_ext_stats_cfg_params *cfg_params,
+				    u64 cookie)
 {
 	struct ath11k_base *ab = ar->ab;
 	struct ath11k_dp *dp = &ab->dp;
@@ -878,6 +880,10 @@ int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type, u64 cookie)
 	cmd->hdr.pdev_mask = 1 << ar->pdev->pdev_id;
 
 	cmd->hdr.stats_type = type;
+	cmd->cfg_param0 = cfg_params->cfg0;
+	cmd->cfg_param1 = cfg_params->cfg1;
+	cmd->cfg_param2 = cfg_params->cfg2;
+	cmd->cfg_param3 = cfg_params->cfg3;
 	cmd->cookie_lsb = lower_32_bits(cookie);
 	cmd->cookie_msb = upper_32_bits(cookie);
 
drivers/net/wireless/ath/ath11k/dp_tx.h +1 -0
index 8dd8e2b..4082c2f 100644
@@ -27,5 +27,6 @@ int ath11k_dp_send_reo_cmd(struct ath11k_base *ab, struct dp_rx_tid *rx_tid,
 
 int ath11k_dp_htt_h2t_ppdu_stats_req(struct ath11k *ar, u32 mask);
 int ath11k_dp_htt_h2t_ext_stats_req(struct ath11k *ar, u8 type,
+				    struct htt_ext_stats_cfg_params *cfg_params,
 				    u64 cookie);
 #endif
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#3 lore raw

PATCH 3/3 ath11k: Add debugfs entry to support htt stats reset

In reply to Bhagavathi Perumal S

This adds debugfs entry htt_stats_reset to reset htt stats.

Example to reset pdev tx stats and it's output logs are,

$echo 1 >/sys/kernel/debug/ath11k/mac0/htt_stats_reset $cat /sys/kernel/debug/ath11k/mac0/htt_stats_reset 1

$echo 1 >/sys/kernel/debug/ath11k/mac0/htt_stats_type $cat /sys/kernel/debug/ath11k/mac0/htt_stats_type 1

$cat /sys/kernel/debug/ath11k/mac0/htt_stats
HTT_TX_PDEV_STATS_CMN_TLV:
mac_id = 0
hw_queued = 112
hw_reaped = 112
...

---
 drivers/net/wireless/ath/ath11k/core.h            |  1 +
 drivers/net/wireless/ath/ath11k/debug_htt_stats.c | 61 +++++++++++++++++++++++
 2 files changed, 62 insertions(+)
drivers/net/wireless/ath/ath11k/core.h +1 -0
index c5f0a71..c2068b5 100644
@@ -368,6 +368,7 @@ struct ath11k_fw_stats {
 
 struct ath11k_dbg_htt_stats {
 	u8 type;
+	u8 reset;
 	/* protects shared stats req buffer */
 	spinlock_t lock;
 };
drivers/net/wireless/ath/ath11k/debug_htt_stats.c +61 -0

77 lines not on this page · raw message

Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#4 lore raw
In reply to Bhagavathi Perumal S
Quoted 7 lines · Bhagavathi Perumal S

This fixes few coding bugs, And adds htt peer stats as a separate debugfs entry and htt stats reset.

Bhagavathi Perumal S (3):
ath11k: Fix few coding bugs in htt stats
ath11k: Add htt peer stats support
ath11k: Add debugfs entry to support htt stats reset

Does not compile on x86_64 with GCC 8.1.0:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:432:10: error: initialization of 'int (*)(struct inode *, struct file *)' from incompatible pointer type 'ssize_t (*)(struct inode *, struct file *)' {aka 'long int (*)(struct inode *, struct file *)'} [-Werror=incompatible-pointer-types]

Signature · 6 lines
Kalle Valo

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#5 lore raw
Quoted 10 lines · Kalle Valo
Quoted 7 lines · Bhagavathi Perumal S

This fixes few coding bugs, And adds htt peer stats as a separate debugfs entry and htt stats reset.

Bhagavathi Perumal S (3):
ath11k: Fix few coding bugs in htt stats
ath11k: Add htt peer stats support
ath11k: Add debugfs entry to support htt stats reset

Quoted 7 lines

Does not compile on x86_64 with GCC 8.1.0:

drivers/net/wireless/ath/ath11k/debugfs_sta.c:432:10: error:
initialization of 'int (*)(struct inode *, struct file *)' from incompatible pointer type 'ssize_t (*)(struct inode *, struct file *)' {aka 'long int (*)(struct inode *, struct file *)'} [-Werror=incompatible-pointer-types]

Fixed and sent v2 patch.

Thanks,
Bhagavathi.

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