DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, chenbo.xia@intel.com, david.marchand@redhat.com,
	i.maximets@ovn.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 5/5] vhost: add statistics for in-flight packets
Date: Tue, 10 May 2022 22:17:20 +0200	[thread overview]
Message-ID: <20220510201720.1262368-6-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20220510201720.1262368-1-maxime.coquelin@redhat.com>

This patch adds statistics for packets in-flight submission
and completion, when Vhost async mode is used.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/vhost/vhost.c      | 2 ++
 lib/vhost/vhost.h      | 2 ++
 lib/vhost/virtio_net.c | 6 ++++++
 3 files changed, 10 insertions(+)

diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 721b3a3247..d9d31b2d03 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -45,6 +45,8 @@ static const struct vhost_vq_stats_name_off vhost_vq_stat_strings[] = {
 	{"guest_notifications",    offsetof(struct vhost_virtqueue, stats.guest_notifications)},
 	{"iotlb_hits",             offsetof(struct vhost_virtqueue, stats.iotlb_hits)},
 	{"iotlb_misses",           offsetof(struct vhost_virtqueue, stats.iotlb_misses)},
+	{"inflight_submitted",     offsetof(struct vhost_virtqueue, stats.inflight_submitted)},
+	{"inflight_completed",     offsetof(struct vhost_virtqueue, stats.inflight_completed)},
 };
 
 #define VHOST_NB_VQ_STATS RTE_DIM(vhost_vq_stat_strings)
diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
index 872675207e..1573d0afe9 100644
--- a/lib/vhost/vhost.h
+++ b/lib/vhost/vhost.h
@@ -136,6 +136,8 @@ struct virtqueue_stats {
 	uint64_t guest_notifications;
 	uint64_t iotlb_hits;
 	uint64_t iotlb_misses;
+	uint64_t inflight_submitted;
+	uint64_t inflight_completed;
 };
 
 /**
diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c
index b1ea9fa4a5..c8905c770a 100644
--- a/lib/vhost/virtio_net.c
+++ b/lib/vhost/virtio_net.c
@@ -2115,6 +2115,7 @@ rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
 	n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts, count, dma_id, vchan_id);
 
 	vhost_queue_stats_update(dev, vq, pkts, n_pkts_cpl);
+	vq->stats.inflight_completed += n_pkts_cpl;
 
 out:
 	rte_spinlock_unlock(&vq->access_lock);
@@ -2158,6 +2159,9 @@ rte_vhost_clear_queue_thread_unsafe(int vid, uint16_t queue_id,
 
 	n_pkts_cpl = vhost_poll_enqueue_completed(dev, queue_id, pkts, count, dma_id, vchan_id);
 
+	vhost_queue_stats_update(dev, vq, pkts, n_pkts_cpl);
+	vq->stats.inflight_completed += n_pkts_cpl;
+
 	return n_pkts_cpl;
 }
 
@@ -2207,6 +2211,8 @@ virtio_dev_rx_async_submit(struct virtio_net *dev, uint16_t queue_id,
 		nb_tx = virtio_dev_rx_async_submit_split(dev, vq, queue_id,
 				pkts, count, dma_id, vchan_id);
 
+	vq->stats.inflight_submitted += nb_tx;
+
 out:
 	if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
 		vhost_user_iotlb_rd_unlock(vq);
-- 
2.35.1


  parent reply	other threads:[~2022-05-10 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 20:17 [PATCH 0/5] vhost: introduce per-virtqueue stats API Maxime Coquelin
2022-05-10 20:17 ` [PATCH 1/5] vhost: add per-virtqueue statistics support Maxime Coquelin
2022-05-11 13:56   ` Xia, Chenbo
2022-05-10 20:17 ` [PATCH 2/5] net/vhost: move to Vhost library stats API Maxime Coquelin
2022-05-10 20:17 ` [PATCH 3/5] vhost: add statistics for guest notifications Maxime Coquelin
2022-05-10 20:17 ` [PATCH 4/5] vhost: add statistics for IOTLB Maxime Coquelin
2022-05-11 13:56   ` Xia, Chenbo
2022-05-10 20:17 ` Maxime Coquelin [this message]
2022-05-11 13:57   ` [PATCH 5/5] vhost: add statistics for in-flight packets Xia, Chenbo
2022-05-11  7:24 ` [PATCH 0/5] vhost: introduce per-virtqueue stats API Maxime Coquelin
2022-05-17 13:23 ` Maxime Coquelin
2022-05-17 13:33   ` Maxime Coquelin

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=20220510201720.1262368-6-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@ovn.org \
    /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;
as well as URLs for NNTP newsgroup(s).