X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=lib%2Flibrte_vhost%2Fvhost.c;fp=lib%2Flibrte_vhost%2Fvhost.c;h=70ac6bc9c4bee5c952e7ab5a43ec8398e4a18097;hb=8d01b9cd70a67cdafd5b965a70420c3bd7fb3f82;hp=3c9be10a0ffdaf93cc34eda5e71164fb96e43ed3;hpb=b63264c8342e6a1b6971c79550d2af2024b6a4de;p=deb_dpdk.git diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 3c9be10a..70ac6bc9 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -8,6 +8,7 @@ #include #include #ifdef RTE_LIBRTE_VHOST_NUMA +#include #include #endif @@ -343,6 +344,7 @@ vhost_new_device(void) dev->flags = VIRTIO_DEV_BUILTIN_VIRTIO_NET; dev->slave_req_fd = -1; dev->vdpa_dev_id = -1; + dev->postcopy_ufd = -1; rte_spinlock_init(&dev->slave_req_lock); return i; @@ -480,7 +482,7 @@ rte_vhost_get_numa_node(int vid) int numa_node; int ret; - if (dev == NULL) + if (dev == NULL || numa_available() != 0) return -1; ret = get_mempolicy(&numa_node, NULL, 0, dev, @@ -646,12 +648,18 @@ rte_vhost_avail_entries(int vid, uint16_t queue_id) } static inline void -vhost_enable_notify_split(struct vhost_virtqueue *vq, int enable) +vhost_enable_notify_split(struct virtio_net *dev, + struct vhost_virtqueue *vq, int enable) { - if (enable) - vq->used->flags &= ~VRING_USED_F_NO_NOTIFY; - else - vq->used->flags |= VRING_USED_F_NO_NOTIFY; + if (!(dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX))) { + if (enable) + vq->used->flags &= ~VRING_USED_F_NO_NOTIFY; + else + vq->used->flags |= VRING_USED_F_NO_NOTIFY; + } else { + if (enable) + vhost_avail_event(vq) = vq->last_avail_idx; + } } static inline void @@ -660,8 +668,10 @@ vhost_enable_notify_packed(struct virtio_net *dev, { uint16_t flags; - if (!enable) + if (!enable) { vq->device_event->flags = VRING_EVENT_F_DISABLE; + return; + } flags = VRING_EVENT_F_ENABLE; if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { @@ -689,7 +699,7 @@ rte_vhost_enable_guest_notification(int vid, uint16_t queue_id, int enable) if (vq_is_packed(dev)) vhost_enable_notify_packed(dev, vq, enable); else - vhost_enable_notify_split(vq, enable); + vhost_enable_notify_split(dev, vq, enable); return 0; }