[1/4] vhost: introduce new API to get the active vring number
Checks
Commit Message
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(+)
Comments
Andy Pei <andy.pei@intel.com> writes:
> 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>
> ---
I think there's something wrong with this patch - I see the following
error after all the patches are applied:
drivers/a715181@@tmp_rte_pmd_ifc@sta/net_ifc_ifcvf_vdpa.c.o: In function `ifcvf_set_vring_state':
ifcvf_vdpa.c:(.text+0x1157): undefined reference to `rte_vhost_get_active_vring_num'
Looking at the linker line, I see that librte_vhost is being included.
Is it possible that you need to make an export for this?
Travis build:
https://travis-ci.com/ovsrobot/dpdk/jobs/231687745
Possibly, this is because the robot needs to call the right script to
apply to a -next tree. I'd be a little surprised, though.
> 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)
> {
Hi Aaron,
I try to solve this by avoiding exposing this new API.
Hope this works.
BRs,
-----Original Message-----
From: Aaron Conole [mailto:aconole@redhat.com]
Sent: Friday, September 6, 2019 9:26 PM
To: Pei, Andy <andy.pei@intel.com>
Cc: dev@dpdk.org; Xu, Rosen <rosen.xu@intel.com>; Ye, Xiaolong <xiaolong.ye@intel.com>; Bie, Tiwei <tiwei.bie@intel.com>; Wang, Xiao W <xiao.w.wang@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number
Andy Pei <andy.pei@intel.com> writes:
> 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>
> ---
I think there's something wrong with this patch - I see the following error after all the patches are applied:
drivers/a715181@@tmp_rte_pmd_ifc@sta/net_ifc_ifcvf_vdpa.c.o: In function `ifcvf_set_vring_state':
ifcvf_vdpa.c:(.text+0x1157): undefined reference to `rte_vhost_get_active_vring_num'
Looking at the linker line, I see that librte_vhost is being included.
Is it possible that you need to make an export for this?
Travis build:
https://travis-ci.com/ovsrobot/dpdk/jobs/231687745
Possibly, this is because the robot needs to call the right script to apply to a -next tree. I'd be a little surprised, though.
> 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) {
@@ -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.
*
@@ -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)
{