DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number
@ 2019-09-06  3:20 Andy Pei
  2019-09-06  3:20 ` [dpdk-dev] [PATCH 2/4] net/ifcvf: add multiqueue configuration Andy Pei
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Andy Pei @ 2019-09-06  3:20 UTC (permalink / raw)
  To: dev; +Cc: rosen.xu, xiaolong.ye, tiwei.bie, xiao.w.wang

It's useful for hardware vhost backend (like vDPA devices) to set
multiqueue configuration accordingly.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Andy Pei <andy.pei@intel.com>
---
 lib/librte_vhost/rte_vhost.h | 12 ++++++++++++
 lib/librte_vhost/vhost.c     | 19 +++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/lib/librte_vhost/rte_vhost.h b/lib/librte_vhost/rte_vhost.h
index 7fb1729..28811b0 100644
--- a/lib/librte_vhost/rte_vhost.h
+++ b/lib/librte_vhost/rte_vhost.h
@@ -525,6 +525,18 @@ int rte_vhost_driver_callback_register(const char *path,
 uint16_t rte_vhost_get_vring_num(int vid);
 
 /**
+ * Get the number of active vrings of the device.
+ *
+ * @param vid
+ *  vhost device ID
+ *
+ * @return
+ *  The number of active vrings, 0 on failure
+ */
+uint16_t
+rte_vhost_get_active_vring_num(int vid);
+
+/**
  * Get the virtio net device's ifname, which is the vhost-user socket
  * file path.
  *
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 981837b..c714818 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -674,6 +674,25 @@
 	return dev->nr_vring;
 }
 
+uint16_t
+rte_vhost_get_active_vring_num(int vid)
+{
+	struct virtio_net *dev = get_device(vid);
+	struct vhost_virtqueue *vq;
+	uint16_t qid;
+
+	if (dev == NULL)
+		return 0;
+
+	for (qid = 0; qid < dev->nr_vring; qid++) {
+		vq = dev->virtqueue[qid];
+		if (!vq->enabled)
+			break;
+	}
+
+	return qid;
+}
+
 int
 rte_vhost_get_ifname(int vid, char *buf, size_t len)
 {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-09-17  9:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06  3:20 [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number Andy Pei
2019-09-06  3:20 ` [dpdk-dev] [PATCH 2/4] net/ifcvf: add multiqueue configuration Andy Pei
2019-09-06  3:20 ` [dpdk-dev] [PATCH 3/4] vhost: call vDPA callback at the end of vring enable handler Andy Pei
2019-09-12  7:41   ` Wang, Xiao W
2019-09-17  7:29     ` Pei, Andy
2019-09-06  3:20 ` [dpdk-dev] [PATCH 4/4] net/ifcvf: enable mutliqueue support Andy Pei
2019-09-12  7:41   ` Wang, Xiao W
2019-09-06 13:25 ` [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number Aaron Conole
2019-09-17  9:25   ` Pei, Andy

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).