From: Longjun Tang <lange_tang@163.com>
To: mst@redhat.com, kuba@kernel.org, eperezma@redhat.com,
jasowangio@gmail.com
Cc: xuanzhuo@linux.alibaba.com, virtualization@lists.linux.dev,
netdev@vger.kernel.org, tanglongjun@kylinos.cn
Subject: [PATCH v2 3/3] virtio_net: add stalls per-queue statistic
Date: Fri, 20 Nov 2026 15:18:26 +0800 [thread overview]
Message-ID: <20261120071826.198604-4-lange_tang@163.com> (raw)
In-Reply-To: <20261120071826.198604-1-lange_tang@163.com>
From: Longjun Tang <tanglongjun@kylinos.cn>
Add a stalls field to the per-queue RX statistics and expose it via
ethtool. Whenever an RX queue gets stuck, the NAPI poll increments
stalls, so it counts RX queue stall 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 15191b841a60..61d51c5a50ea 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -134,6 +134,7 @@ struct virtnet_rq_stats {
u64_stats_t xdp_redirects;
u64_stats_t xdp_drops;
u64_stats_t kicks;
+ u64_stats_t stalls;
};
#define VIRTNET_SQ_STAT(name, m) {name, offsetof(struct virtnet_sq_stats, m), -1}
@@ -167,6 +168,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("stalls", stalls),
};
static const struct virtnet_stat_desc virtnet_sq_stats_desc_qstat[] = {
@@ -2982,6 +2984,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.stalls);
+ 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.25.1
next prev parent reply other threads:[~2026-11-20 7:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 7:18 [PATCH v2 0/3] virtio_net: introduce an RX queue watchdog for stuck detection Longjun Tang
2026-11-20 7:18 ` [PATCH v2 1/3] virtio: add virtqueue_get_last_used_idx() helper Longjun Tang
2026-11-20 17:43 ` Michael S. Tsirkin
2026-11-20 7:18 ` [PATCH v2 2/3] virtio_net: introduce an RX queue watchdog for stuck detection Longjun Tang
2026-11-20 7:18 ` Longjun Tang [this message]
2026-11-20 17:45 ` [PATCH v2 0/3] " Michael S. Tsirkin
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=20261120071826.198604-4-lange_tang@163.com \
--to=lange_tang@163.com \
--cc=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=kuba@kernel.org \
--cc=mst@redhat.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