Netdev List
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Longjun Tang <lange_tang@163.com>
Cc: kuba@kernel.org, eperezma@redhat.com, jasowangio@gmail.com,
	xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev,
	netdev@vger.kernel.org, tanglongjun@kylinos.cn
Subject: Re: [PATCH 3/3] virtio_net: add rx_timeouts per-queue statistic
Date: Thu, 12 Nov 2026 17:52:53 -0500	[thread overview]
Message-ID: <20261112175235-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20261109094310.103979-4-lange_tang@163.com>

On Mon, Nov 09, 2026 at 05:43:10PM +0800, Longjun Tang wrote:
> From: Longjun Tang <tanglongjun@kylinos.cn>
> 
> Add an rx_timeouts field to the per-queue RX statistics and expose it
> via ethtool. Whenever an RX queue gets stuck, the NAPI poll increments
> rx_timeouts, so it counts RX queue stuck events.
> 
> Signed-off-by: Longjun Tang <tanglongjun@kylinos.cn>
> ---
>  drivers/net/virtio_net.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index ec7c248080c5..feb6bfbb1c5a 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -135,6 +135,7 @@ struct virtnet_rq_stats {
>  	u64_stats_t xdp_redirects;
>  	u64_stats_t xdp_drops;
>  	u64_stats_t kicks;
> +	u64_stats_t rx_timeouts;
>  };
>  
>  #define VIRTNET_SQ_STAT(name, m) {name, offsetof(struct virtnet_sq_stats, m), -1}
> @@ -168,6 +169,7 @@ static const struct virtnet_stat_desc virtnet_rq_stats_desc[] = {
>  	VIRTNET_RQ_STAT("xdp_redirects", xdp_redirects),
>  	VIRTNET_RQ_STAT("xdp_drops",     xdp_drops),
>  	VIRTNET_RQ_STAT("kicks",         kicks),
> +	VIRTNET_RQ_STAT("rx_timeouts",   rx_timeouts),
>  };
>

Is this consistent with any other hardware?
  
>  static const struct virtnet_stat_desc virtnet_sq_stats_desc_qstat[] = {
> @@ -2983,6 +2985,12 @@ static int virtnet_receive(struct receive_queue *rq, int budget,
>  		u64_stats_add(item, u64_stats_read(src));
>  	}
>  
> +	/* Count a stall recovered by this poll. */
> +	if (rq->watchdog.stalled) {
> +		u64_stats_inc(&rq->stats.rx_timeouts);
> +		rq->watchdog.stalled = false;
> +	}
> +
>  	u64_stats_add(&rq->stats.packets, u64_stats_read(&stats.packets));
>  	u64_stats_add(&rq->stats.bytes, u64_stats_read(&stats.bytes));
>  	u64_stats_add(&rq->stats.alloc_fail, u64_stats_read(&stats.alloc_fail));
> -- 
> 2.51.0


      reply	other threads:[~2026-11-12 22:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  9:43 [PATCH 0/3] virtio_net: introduce an RX queue watchdog for stuck detection Longjun Tang
2026-11-09  9:43 ` [PATCH 1/3] virtio: add virtqueue_get_last_used_idx() helper Longjun Tang
2026-11-12 16:51   ` Jakub Kicinski
2026-11-12 22:50   ` Michael S. Tsirkin
2026-11-09  9:43 ` [PATCH 2/3] virtio_net: introduce an RX queue watchdog for stuck detection Longjun Tang
2026-11-12 16:53   ` Jakub Kicinski
2026-11-12 22:51   ` Michael S. Tsirkin
2026-11-09  9:43 ` [PATCH 3/3] virtio_net: add rx_timeouts per-queue statistic Longjun Tang
2026-11-12 22:52   ` Michael S. Tsirkin [this message]

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=20261112175235-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lange_tang@163.com \
    --cc=netdev@vger.kernel.org \
    --cc=tanglongjun@kylinos.cn \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.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