From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Wang, Xiao W" Subject: Re: [PATCH v5] vhost: support virtqueue interrupt/notification suppression Date: Tue, 26 Dec 2017 08:03:06 +0000 Message-ID: References: <20171128110200.60032-1-junjie.j.chen@intel.com> <1514048153-82959-1-git-send-email-junjie.j.chen@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" To: "Chen, Junjie J" , "yliu@fridaylinux.org" , "maxime.coquelin@redhat.com" , "Bie, Tiwei" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 116531B365 for ; Tue, 26 Dec 2017 09:03:09 +0100 (CET) In-Reply-To: <1514048153-82959-1-git-send-email-junjie.j.chen@intel.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Chen, Junjie J > Sent: Sunday, December 24, 2017 12:56 AM > To: yliu@fridaylinux.org; maxime.coquelin@redhat.com; Bie, Tiwei > ; Wang, Xiao W > Cc: dev@dpdk.org; Chen, Junjie J > Subject: [PATCH v5] vhost: support virtqueue interrupt/notification > suppression >=20 > 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. >=20 > 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 i= n > available ring. >=20 > This patch is to enable this feature in vhost. >=20 > Signed-off-by: Junjie Chen >=20 [...] > + /* Last used index we notify to front end. */ > + uint16_t signalled_used; > #define VIRTIO_INVALID_EVENTFD (-1) > #define VIRTIO_UNINITIALIZED_EVENTFD (-2) >=20 > @@ -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)) >=20 > 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 @@ >=20 > #define MAX_BATCH_LEN 256 >=20 > +#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