Linux wireless drivers development
 help / color / mirror / Atom feed
From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>, ath12k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org,
	Hariharan Ramanathan <hariharan.ramanathan@oss.qualcomm.com>
Subject: Re: [PATCH ath-next 3/8] wifi: ath12k: add TCL ring TX buffer allocation failure counter
Date: Sun, 26 Jul 2026 08:42:05 -0700	[thread overview]
Message-ID: <88f7d41f-43e2-4dd3-9479-8d45f2da668f@oss.qualcomm.com> (raw)
In-Reply-To: <20260723125448.922361-4-pardeep.kaur@oss.qualcomm.com>

On 7/23/2026 5:54 AM, Pardeep Kaur wrote:
> From: Hariharan Ramanathan <hariharan.ramanathan@oss.qualcomm.com>
> 
> When ath12k_dp_tx_assign_buffer() fails, the TX path returns -ENOMEM
> silently with no per-ring visibility into how often this occurs.
> Without a counter, buffer pool exhaustion on a specific TCL ring is
> invisible during debugging.
> 
> Add txbuf_na[] to ath12k_device_dp_tx_err_stats to track per-ring TX
> buffer allocation failures and increment it on assign failure in the
> TX path. Expose the per-ring counts in debugfs under a new 'TCL Ring
> Buffer Alloc Failures' section.

Is this counting the right thing?

One of my review agents has the observation:
The txbuf_na counter is indexed by ring_id but the exhaustion it measures is
from tx_desc[pool_id]

So I drilled down with another agent and got:
The commit message intent is to answer "why was this frame dropped", which is
valid. The practical question is whether ring_id or pool_id is more useful for
diagnosis:
  - pool_id = skb_get_queue_mapping(skb) & 3 — a property of the traffic
class/queue
  - ring_id = smp_processor_id() % max_tx_ring — a property of which CPU
processed it

If a pool is exhausted, pool_id tells you which traffic class is
backpressured. ring_id tells you which CPU happened to observe it — less
actionable. So the other finding is a genuine semantic improvement, not just
pedantry. The fix (txbuf_na[pool_id]++) would make the stat correctly answer
"which traffic class ran out of TX descriptors."

So does tracking by ring_id or pool_id make the most sense?

> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6.r1-00402-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Hariharan Ramanathan <hariharan.ramanathan@oss.qualcomm.com>
> Co-developed-by: Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>
> Signed-off-by: Pardeep Kaur <pardeep.kaur@oss.qualcomm.com>
> ---
>  drivers/net/wireless/ath/ath12k/debugfs.c     | 5 +++++
>  drivers/net/wireless/ath/ath12k/dp.h          | 2 ++
>  drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c | 4 +++-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/debugfs.c b/drivers/net/wireless/ath/ath12k/debugfs.c
> index d54995b7adb2..0f8b458200a8 100644
> --- a/drivers/net/wireless/ath/ath12k/debugfs.c
> +++ b/drivers/net/wireless/ath/ath12k/debugfs.c
> @@ -1117,6 +1117,11 @@ static ssize_t ath12k_debugfs_dump_device_dp_stats(struct file *file,
>  		len += scnprintf(buf + len, size - len, "ring%d: %u\n",
>  				 i, device_stats->tx_err.desc_na[i]);
>  
> +	len += scnprintf(buf + len, size - len, "\nTCL Ring Buffer Alloc Failures:\n");
> +	for (i = 0; i < DP_TCL_NUM_RING_MAX; i++)
> +		len += scnprintf(buf + len, size - len, "ring%d: %u\n",
> +				 i, device_stats->tx_err.txbuf_na[i]);
> +
>  	len += scnprintf(buf + len, size - len,
>  			 "\nMisc Transmit Failures: %d\n",
>  			 atomic_read(&device_stats->tx_err.misc_fail));
> diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h
> index a94bbc337df4..ac125adde258 100644
> --- a/drivers/net/wireless/ath/ath12k/dp.h
> +++ b/drivers/net/wireless/ath/ath12k/dp.h
> @@ -428,6 +428,8 @@ struct ath12k_dp_arch_ops {
>  struct ath12k_device_dp_tx_err_stats {
>  	/* TCL Ring Descriptor unavailable */
>  	u32 desc_na[DP_TCL_NUM_RING_MAX];
> +	/* TCL Ring Buffers unavailable */
> +	u32 txbuf_na[DP_TCL_NUM_RING_MAX];
>  	/* Other failures during dp_tx due to mem allocation failure
>  	 * idr unavailable etc.
>  	 */
> diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c b/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c
> index a0e409452a19..ca0e1369af21 100644
> --- a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c
> +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c
> @@ -123,8 +123,10 @@ int ath12k_wifi7_dp_tx(struct ath12k_pdev_dp *dp_pdev, struct ath12k_link_vif *a
>  	tx_ring = &dp->tx_ring[ti.ring_id];
>  
>  	tx_desc = ath12k_dp_tx_assign_buffer(dp, pool_id);
> -	if (!tx_desc)
> +	if (!tx_desc) {
> +		dp->device_stats.tx_err.txbuf_na[ti.ring_id]++;
>  		return -ENOMEM;
> +	}
>  
>  	dp_link_vif = ath12k_dp_vif_to_dp_link_vif(&ahvif->dp_vif, arvif->link_id);
>  


  reply	other threads:[~2026-07-26 15:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 12:54 [PATCH ath-next 0/8] wifi: ath12k: extend device DP stats for TX and RX observability Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 1/8] wifi: ath12k: fix out-of-bounds access on TX stats arrays Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 2/8] wifi: ath12k: rename wbm_status to htt_status in HTT TX completion Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 3/8] wifi: ath12k: add TCL ring TX buffer allocation failure counter Pardeep Kaur
2026-07-26 15:42   ` Jeff Johnson [this message]
2026-07-23 12:54 ` [PATCH ath-next 4/8] wifi: ath12k: add device DP stats reset support via debugfs Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 5/8] wifi: ath12k: add WBM RX error drop statistics Pardeep Kaur
2026-07-26 16:00   ` Jeff Johnson
2026-07-28 12:22     ` Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 6/8] wifi: ath12k: track per-ring RX sent-to-stack count Pardeep Kaur
2026-07-26 16:11   ` Jeff Johnson
2026-07-28 12:24     ` Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 7/8] wifi: ath12k: fix 1-based ring index in REO Rx Received debugfs output Pardeep Kaur
2026-07-23 12:54 ` [PATCH ath-next 8/8] wifi: ath12k: add WBM SW desc fallback counter Pardeep Kaur
  -- strict thread matches above, loose matches on Subject: below --
2026-08-06 10:06 [PATCH ath-next 0/8] wifi: ath12k: extend device DP stats for TX and RX observability Pardeep Kaur
2026-08-06 10:06 ` [PATCH ath-next 3/8] wifi: ath12k: add TCL ring TX buffer allocation failure counter Pardeep Kaur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88f7d41f-43e2-4dd3-9479-8d45f2da668f@oss.qualcomm.com \
    --to=jeff.johnson@oss.qualcomm.com \
    --cc=ath12k@lists.infradead.org \
    --cc=hariharan.ramanathan@oss.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=pardeep.kaur@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox