Skip to contentSkip to conversation

vhost: support virtqueue interrupt/notification suppression

PATCH Superseded [email protected] 1 participant 1 message Nov 28, 2017

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 vhost: support virtqueue interrupt/notification suppression

From: Junjie Chen <[email protected]>

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.

---
 lib/librte_vhost/Makefile     |  1 +
 lib/librte_vhost/vhost.h      |  7 ++++++
 lib/librte_vhost/virtio_net.c | 56 +++++++++++++++++++++++++++++++------------
 3 files changed, 49 insertions(+), 15 deletions(-)
lib/librte_vhost/Makefile +1 -0
index be182798a..85695d443 100644
@@ -40,6 +40,7 @@ LIBABIVER := 4
 
 CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
 CFLAGS += -I vhost_user
+CFLAGS += -fno-strict-aliasing
 LDLIBS += -lpthread
 
 ifeq ($(CONFIG_RTE_LIBRTE_VHOST_NUMA),y)
lib/librte_vhost/vhost.h +7 -0
index 1cc81c17c..0741a2399 100644
@@ -103,6 +103,8 @@ struct vhost_virtqueue {
 
 	uint16_t		last_avail_idx;
 	uint16_t		last_used_idx;
+	/* Last used index we notify to front end. */
+	uint16_t		signalled_used;
 #define VIRTIO_INVALID_EVENTFD		(-1)
 #define VIRTIO_UNINITIALIZED_EVENTFD	(-2)
 
@@ -195,6 +197,10 @@ struct vhost_msg {
 
 #define VHOST_USER_F_PROTOCOL_FEATURES	30
 
+#ifndef VIRTIO_F_EVENT_IDX
+ #define VIRTIO_F_EVENT_IDX 29
+#endif
+
 /* Features supported by this builtin vhost-user net driver. */
 #define VIRTIO_NET_SUPPORTED_FEATURES ((1ULL << VIRTIO_NET_F_MRG_RXBUF) | \
 				(1ULL << VIRTIO_NET_F_CTRL_VQ) | \
@@ -211,6 +217,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))
 
lib/librte_vhost/virtio_net.c +41 -15

86 lines not on this page · raw message

Signature · 1 line
2.15.0