ath11k: Rename soc_rx_stats to soc_dp_stats and add more dp stats
cover ath11k: Rename soc_rx_stats to soc_dp_stats and add more dp stats
Currently, the debugfs "soc_rx_stats" in location '/sys/kernel/debug/ath11k/ipq8074/' is used for getting only dp rx stats. This has been renamed to "soc_dp_stats" as tx stats and other ring specific info would also be useful for
debug purpose and it would be good to have all these stats under similar file.
This patchset adds support for tx error stats and ring backpressure stats. More ring specific stats could be added here in future.
Sriram R (2):
ath11k: Add dp tx err stats
ath11k: Add support for ring backpressure stats
drivers/net/wireless/ath/ath11k/core.h | 34 ++++++++- drivers/net/wireless/ath/ath11k/debug.c | 128 ++++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/dp.h | 42 +++++++++++ drivers/net/wireless/ath/ath11k/dp_rx.c | 28 ++++++- drivers/net/wireless/ath/ath11k/dp_tx.c | 7 +- 5 files changed, 229 insertions(+), 10 deletions(-)
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 2/2 ath11k: Add support for ring backpressure stats
Add support for collecting and dumping the ring backpressure stats via debugfs. Stats are dumped only if events are received for the specific ring.
Below command can be used to obtain these stats as part of soc dp stats. cat /sys/kernel/debug/ath11k/ipq8074/soc_dp_stats
Sample Output - When No stats available:
Backpressure Stats
==================
No Ring Backpressure stats received
Sample Output - When ring bp stats available for specific ring
Backpressure Stats
==================
Ring: REO2SW1_RING
count: 1
hp: 2
tp: 2
seen before: 4ms
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/core.h | 20 ++++++ drivers/net/wireless/ath/ath11k/debug.c | 105 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/dp.h | 42 +++++++++++++ drivers/net/wireless/ath/ath11k/dp_rx.c | 28 ++++++++- 4 files changed, 194 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/core.h +20 -0
@@ -582,6 +582,25 @@ struct ath11k_board_data {/* IPQ8074 HW channel counters frequency value in hertz */ #define IPQ8074_CC_FREQ_HERTZ 320000 +struct ath11k_bp_stats { +/* Head Pointer reported by the last HTT Backpressure event for the ring */ +u16 hp; + +/* Tail Pointer reported by the last HTT Backpressure event for the ring */ +u16 tp; + +/* Number of Backpressure events received for the ring */ +u32 count; + +/* Last recorded event timestamp */ +unsigned long jiffies; +}; + +struct ath11k_dp_ring_bp_stats { +struct ath11k_bp_stats umac_ring_bp_stats[HTT_SW_UMAC_RING_IDX_MAX ]; +struct ath11k_bp_stats lmac_ring_bp_stats[HTT_SW_LMAC_RING_IDX_MAX ][MAX_RADIOS ]; +}; +struct ath11k_soc_dp_tx_err_stats {/* TCL Ring Descriptor unavailable */ u32 desc_na[DP_TCL_NUM_RING_MAX ];
@@ -598,6 +617,7 @@ struct ath11k_soc_dp_stats {u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX ];u32 hal_reo_error[DP_REO_DST_RING_MAX ];struct ath11k_soc_dp_tx_err_stats tx_err; +struct ath11k_dp_ring_bp_stats bp_stats; };/* Master structure to hold the hw data which may be used in core module */
drivers/net/wireless/ath/ath11k/debug.c +105 -0
123 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/dp.h +42 -0
48 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/dp_rx.c +27 -1
@@ -1510,9 +1510,10 @@ static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab, struct sk_buff *skb) {u32 *data = (u32 *)skb->data; -u8 pdev_id, ring_type, ring_id; +u8 pdev_id, ring_type, ring_id, pdev_idx;u16 hp, tp;u32 backpressure_time; +struct ath11k_bp_stats *bp_stats; pdev_id =FIELD_GET (HTT_BACKPRESSURE_EVENT_PDEV_ID_M , *data); ring_type =FIELD_GET (HTT_BACKPRESSURE_EVENT_RING_TYPE_M , *data);
@@ -1527,6 +1528,31 @@ static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab,ath11k_dbg (ab,ATH11K_DBG_DP_HTT ,"htt backpressure event, pdev %d, ring type %d,ring id %d, hp %d tp %d, backpressure time %d\n" , pdev_id, ring_type, ring_id, hp, tp, backpressure_time); + +if (ring_type ==HTT_BACKPRESSURE_UMAC_RING_TYPE ) { +if (ring_id >=HTT_SW_UMAC_RING_IDX_MAX ) +return ; + + bp_stats = &ab->soc_stats.bp_stats.umac_ring_bp_stats[ring_id]; + }else if (ring_type ==HTT_BACKPRESSURE_LMAC_RING_TYPE ) { + pdev_idx =DP_HW2SW_MACID (pdev_id); + +if (ring_id >=HTT_SW_LMAC_RING_IDX_MAX || pdev_idx >=MAX_RADIOS ) +return ; + + bp_stats = &ab->soc_stats.bp_stats.lmac_ring_bp_stats[ring_id][pdev_idx]; + }else { +ath11k_warn (ab,"unknown ring type received in htt bp event %d\n" , + ring_type); +return ; + } + +spin_lock_bh (&ab->base_lock); + bp_stats->hp = hp; + bp_stats->tp = tp; + bp_stats->count++; + bp_stats->jiffies = jiffies; +spin_unlock_bh (&ab->base_lock); } void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
Signature · 7 lines
2.7.4 _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH 1/2 ath11k: Add dp tx err stats
In reply to Sriram RAdd support for dp tx error stats which logs tx failure reasons due to ring full condition, etc. This stats is added in soc_dp_stats which was earlier used as soc_rx_stats so that all dp related info are logged in same file.
Below is an example usage,
root@OpenWrt:/# cat /sys/kernel/debug/ath11k/ipq8074/soc_dp_stats SOC RX STATS:
err ring pkts: 0
Invalid RBM: 0
<snip>
SOC TX STATS:
Ring Full Failures:
ring0: 4
ring1: 3
ring2: 5
Misc Transmit Failures: 2
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/core.h | 14 ++++++++++++-- drivers/net/wireless/ath/ath11k/debug.c | 23 +++++++++++++++++------ drivers/net/wireless/ath/ath11k/dp_tx.c | 7 ++++++- 3 files changed, 35 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath11k/core.h +12 -2
@@ -582,12 +582,22 @@ struct ath11k_board_data {/* IPQ8074 HW channel counters frequency value in hertz */ #define IPQ8074_CC_FREQ_HERTZ 320000 -struct ath11k_soc_dp_rx_stats { +struct ath11k_soc_dp_tx_err_stats { +/* TCL Ring Descriptor unavailable */ +u32 desc_na[DP_TCL_NUM_RING_MAX ]; +/* Other failures during dp_tx due to mem allocation failure +* idr unavailable etc. +*/ +atomic_t misc_fail; +}; + +struct ath11k_soc_dp_stats {u32 err_ring_pkts;u32 invalid_rbm;u32 rxdma_error[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX ];u32 reo_error[HAL_REO_DEST_RING_ERROR_CODE_MAX ];u32 hal_reo_error[DP_REO_DST_RING_MAX ]; +struct ath11k_soc_dp_tx_err_stats tx_err; };/* Master structure to hold the hw data which may be used in core module */
@@ -656,7 +666,7 @@ struct ath11k_base {struct dentry *debugfs_soc;struct dentry *debugfs_ath11k;#endif -struct ath11k_soc_dp_rx_stats soc_stats; +struct ath11k_soc_dp_stats soc_stats;unsigned long dev_flags;struct completion driver_recovery;
drivers/net/wireless/ath/ath11k/debug.c +17 -6
@@ -739,12 +739,12 @@ static const struct file_operations fops_extd_rx_stats = { .open = simple_open, }; -static ssize_t ath11k_debug_dump_soc_rx_stats (struct file *file, +static ssize_t ath11k_debug_dump_soc_dp_stats (struct file *file,char __user *user_buf,size_t count,loff_t *ppos) {struct ath11k_base *ab = file->private_data; -struct ath11k_soc_dp_rx_stats *soc_stats = &ab->soc_stats; +struct ath11k_soc_dp_stats *soc_stats = &ab->soc_stats;int len =0 , i, retval;const int size =4096 ;static const char *rxdma_err[HAL_REO_ENTR_RING_RXDMA_ECODE_MAX ] = {
@@ -788,6 +788,17 @@ static ssize_t ath11k_debug_dump_soc_rx_stats(struct file *file, soc_stats->hal_reo_error[2 ], soc_stats->hal_reo_error[3]); + len +=scnprintf (buf + len, size - len,"\nSOC TX STATS:\n" ); + len +=scnprintf (buf + len, size - len,"\nTCL Ring Full Failures:\n" ); + +for (i =0 ; i <DP_TCL_NUM_RING_MAX ; i++) + len +=scnprintf (buf + len, size - len,"ring%d: %u\n" , + i, soc_stats->tx_err.desc_na[i]); + + len +=scnprintf (buf + len, size - len, +"\nMisc Transmit Failures: %d\n" , +atomic_read (&soc_stats->tx_err.misc_fail)); +if (len > size) len = size; retval =simple_read_from_buffer (user_buf, count, ppos, buf, len);
@@ -796,8 +807,8 @@ static ssize_t ath11k_debug_dump_soc_rx_stats(struct file *file,return retval; } -static const struct file_operations fops_soc_rx_stats = { - .read = ath11k_debug_dump_soc_rx_stats, +static const struct file_operations fops_soc_dp_stats = { + .read = ath11k_debug_dump_soc_dp_stats, .open = simple_open, .owner =THIS_MODULE , .llseek = default_llseek,
@@ -819,8 +830,8 @@ int ath11k_debug_pdev_create(struct ath11k_base *ab)debugfs_create_file ("simulate_fw_crash" ,0600 , ab->debugfs_soc, ab, &fops_simulate_fw_crash); -debugfs_create_file ("soc_rx_stats" ,0600 , ab->debugfs_soc, ab, - &fops_soc_rx_stats); +debugfs_create_file ("soc_dp_stats" ,0600 , ab->debugfs_soc, ab, + &fops_soc_dp_stats);return 0 ; }
drivers/net/wireless/ath/ath11k/dp_tx.c +6 -1
@@ -121,8 +121,10 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,spin_unlock_bh (&tx_ring->tx_idr_lock);if (ret <0 ) { -if (ring_map == (BIT (DP_TCL_NUM_RING_MAX ) -1 )) +if (ring_map == (BIT (DP_TCL_NUM_RING_MAX ) -1 )) { +atomic_inc (&ab->soc_stats.tx_err.misc_fail);return -ENOSPC ; + }/* Check if the next ring is available */ ring_selector++;
@@ -180,11 +182,13 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,default :/* TODO: Take care of other encap modes as well */ ret = -EINVAL ; +atomic_inc (&ab->soc_stats.tx_err.misc_fail); goto fail_remove_idr; } ti.paddr =dma_map_single (ab->dev, skb->data, skb->len,DMA_TO_DEVICE );if (dma_mapping_error (ab->dev, ti.paddr)) { +atomic_inc (&ab->soc_stats.tx_err.misc_fail);ath11k_warn (ab,"failed to DMA map data Tx buffer\n" ); ret = -ENOMEM ; goto fail_remove_idr;
@@ -208,6 +212,7 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif,* desc because the desc is directly enqueued onto hw queue. */ ath11k_hal_srng_access_end (ab, tcl_ring); + ab->soc_stats.tx_err.desc_na[ti.ring_id]++;spin_unlock_bh (&tcl_ring->lock); ret = -ENOMEM ;
Signature · 1 line
2.7.4
Re: [PATCH 1/2] ath11k: Add dp tx err stats
Quoted 21 lines · Sriram R
Add support for dp tx error stats which logs tx failure reasons due to ring full condition, etc. This stats is added in
soc_dp_statswhich was earlier used assoc_rx_statsso that all dp related info are logged in same file.Below is an example usage,
root@OpenWrt:/# cat /sys/kernel/debug/ath11k/ipq8074/soc_dp_stats SOC RX STATS:err ring pkts: 0
Invalid RBM: 0
<snip>SOC TX STATS:
Ring Full Failures:
ring0: 4
ring1: 3
ring2: 5
Quoted 6 lines
Misc Transmit Failures: 2
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1
Signed-off-by Sriram R <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
0dd6392ac2c0 ath11k: Add dp tx err stats 71fbc847978f ath11k: Add support for ring backpressure stats
Signature · 3 lines
https://patchwork.kernel.org/patch/11597089/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [PATCH 1/2] ath11k: Add dp tx err stats
In reply to Sriram RQuoted 21 lines · Sriram R
Add support for dp tx error stats which logs tx failure reasons due to ring full condition, etc. This stats is added in
soc_dp_statswhich was earlier used assoc_rx_statsso that all dp related info are logged in same file.Below is an example usage,
root@OpenWrt:/# cat /sys/kernel/debug/ath11k/ipq8074/soc_dp_stats SOC RX STATS:err ring pkts: 0
Invalid RBM: 0
<snip>SOC TX STATS:
Ring Full Failures:
ring0: 4
ring1: 3
ring2: 5
Quoted 6 lines
Misc Transmit Failures: 2
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01213-QCAHKSWPL_SILICONZ-1
Signed-off-by Sriram R <[email protected]>Signed-off-by Kalle Valo <[email protected]>
2 patches applied to ath-next branch of ath.git, thanks.
0dd6392ac2c0 ath11k: Add dp tx err stats 71fbc847978f ath11k: Add support for ring backpressure stats
Signature · 9 lines
https://patchwork.kernel.org/patch/11597089/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k