[dpdk-dev] [PATCH 1/4] vhost: introduce new API to get the active vring number

Aaron Conole aconole at redhat.com
Fri Sep 6 15:25:45 CEST 2019


Andy Pei <andy.pei at 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 at intel.com>
> Signed-off-by: Andy Pei <andy.pei at 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 at 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)
>  {


More information about the dev mailing list