[dpdk-dev] [PATCH 07/17] vhost: export vhost vring info

Maxime Coquelin maxime.coquelin at redhat.com
Thu Mar 16 10:20:03 CET 2017



On 03/16/2017 08:24 AM, Yuanhan Liu wrote:
> On Tue, Mar 14, 2017 at 01:11:24PM +0100, Maxime Coquelin wrote:
>>> +int
>>> +rte_vhost_get_vhost_vring(int vid, uint16_t vring_idx,
>>> +			  struct rte_vhost_vring *vring)
>>> +{
>>> +	struct virtio_net *dev;
>>> +	struct vhost_virtqueue *vq;
>>> +
>>> +	dev = get_device(vid);
>>> +	if (!dev)
>>> +		return -1;
>>> +
>>> +	if (vring_idx > VHOST_MAX_VRING)
>> Shouldn't be ">=" ?
>
> Nice catch!
>
>>> +#define VHOST_MAX_VRING			0x100
>> Looking at the code, I'm not clear where this limitation comes from.
>> It seems that it can be up to 0x10000, no?
>
> It comes from the vhost-user spec:
>
> 	--yliu
>
> ---
>  * VHOST_USER_SET_VRING_KICK
>
>       Id: 12
>       Equivalent ioctl: VHOST_SET_VRING_KICK
>       Master payload: u64
>
>       Set the event file descriptor for adding buffers to the vring. It
>       is passed in the ancillary data.
>       Bits (0-7) of the payload contain the vring index. Bit 8 is the
>       invalid FD flag. This flag is set when there is no file descriptor
>       in the ancillary data. This signals that polling should be used
>       instead of waiting for a kick.

Thanks for the pointer.

With the vring_idx check fixed you can add my:
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>

Cheers,
Maxime


More information about the dev mailing list