[dpdk-dev] [PATCH v5] vhost: support virtqueue interrupt/notification suppression

Wang, Xiao W xiao.w.wang at intel.com
Tue Dec 26 09:03:06 CET 2017


Hi,

> -----Original Message-----
> From: Chen, Junjie J
> Sent: Sunday, December 24, 2017 12:56 AM
> To: yliu at fridaylinux.org; maxime.coquelin at redhat.com; Bie, Tiwei
> <tiwei.bie at intel.com>; Wang, Xiao W <xiao.w.wang at intel.com>
> Cc: dev at dpdk.org; Chen, Junjie J <junjie.j.chen at intel.com>
> Subject: [PATCH v5] vhost: support virtqueue interrupt/notification
> suppression
> 
> The driver can suppress interrupt when VIRTIO_F_EVENT_IDX feature bit is
> negotiated. The driver set vring flags to 0, and MAY use used_event in
> available ring to advise device interrupt util reach an index specified
> by used_event. The device ignore the lower bit of vring flags, and send
> an interrupt when index reach used_event.
> 
> The device can suppress notification in a manner analogous to the ways
> driver suppress interrupt. The device manipulates flags or avail_event in
> the used ringin the same way the driver manipulates flags or used_event in
> available ring.
> 
> This patch is to enable this feature in vhost.
> 
> Signed-off-by: Junjie Chen <junjie.j.chen at intel.com>
> 
[...]
> +	/* Last used index we notify to front end. */
> +	uint16_t		signalled_used;
>  #define VIRTIO_INVALID_EVENTFD		(-1)
>  #define VIRTIO_UNINITIALIZED_EVENTFD	(-2)
> 
> @@ -211,6 +213,7 @@ struct vhost_msg {
>  				(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
>  				(1ULL << VIRTIO_NET_F_GUEST_TSO6) | \
>  				(1ULL << VIRTIO_RING_F_INDIRECT_DESC) | \
> +				(1ULL << VIRTIO_RING_F_EVENT_IDX) | \
>  				(1ULL << VIRTIO_NET_F_MTU) | \
>  				(1ULL << VIRTIO_F_IOMMU_PLATFORM))
> 
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 6fee16e..2badeda 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -52,6 +52,35 @@
> 
>  #define MAX_BATCH_LEN 256
> 
> +#define vhost_used_event(vr)  ((vr)->avail->ring[(vr)->size])
> +#define vhost_avail_event(vr) \
> +	(*(volatile uint16_t *)&(vr)->used->ring[(vr)->size])
> +

>From vhost side, vhost_used_event(vr) is volatile.

BRs,
Xiao



More information about the dev mailing list