X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_vhost%2Fvirtio-net.c;h=4672e67cb4e89d90df9edf87aeac245924e6bbbe;hb=66e1591687ac;hp=20567ff5844ac92fb942ca0af5e946c6a82b9f07;hpb=54292e9520e0141b691579868c6e29a7a0628915;p=dpdk.git diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c index 20567ff584..4672e67cb4 100644 --- a/lib/librte_vhost/virtio-net.c +++ b/lib/librte_vhost/virtio-net.c @@ -185,13 +185,13 @@ cleanup_device(struct virtio_net *dev) } /* Close any event notifiers opened by device. */ - if (dev->virtqueue[VIRTIO_RXQ]->callfd) + if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0) close((int)dev->virtqueue[VIRTIO_RXQ]->callfd); - if (dev->virtqueue[VIRTIO_RXQ]->kickfd) + if ((int)dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0) close((int)dev->virtqueue[VIRTIO_RXQ]->kickfd); - if (dev->virtqueue[VIRTIO_TXQ]->callfd) + if ((int)dev->virtqueue[VIRTIO_TXQ]->callfd >= 0) close((int)dev->virtqueue[VIRTIO_TXQ]->callfd); - if (dev->virtqueue[VIRTIO_TXQ]->kickfd) + if ((int)dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0) close((int)dev->virtqueue[VIRTIO_TXQ]->kickfd); } @@ -595,10 +595,10 @@ set_vring_call(struct vhost_device_ctx ctx, struct vhost_vring_file *file) /* file->index refers to the queue index. The txq is 1, rxq is 0. */ vq = dev->virtqueue[file->index]; - if ((int)vq->kickfd >= 0) - close((int)vq->kickfd); + if ((int)vq->callfd >= 0) + close((int)vq->callfd); - vq->kickfd = file->fd; + vq->callfd = file->fd; return 0; } @@ -621,10 +621,10 @@ set_vring_kick(struct vhost_device_ctx ctx, struct vhost_vring_file *file) /* file->index refers to the queue index. The txq is 1, rxq is 0. */ vq = dev->virtqueue[file->index]; - if ((int)vq->callfd >= 0) - close((int)vq->callfd); + if ((int)vq->kickfd >= 0) + close((int)vq->kickfd); - vq->callfd = file->fd; + vq->kickfd = file->fd; return 0; }