/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
}
/*
/* Kick guest if required. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
return 0;
}
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
return count;
}
uint16_t vhost_hlen; /**< Vhost header length (varies depending on RX merge buffers. */
volatile uint16_t last_used_idx; /**< Last index used on the available ring */
volatile uint16_t last_used_idx_res; /**< Used for multiple devices reserving buffers. */
- eventfd_t callfd; /**< Used to notify the guest (trigger interrupt). */
- eventfd_t kickfd; /**< Currently unused as polling mode is enabled. */
+ int callfd; /**< Used to notify the guest (trigger interrupt). */
+ int kickfd; /**< Currently unused as polling mode is enabled. */
struct buf_vector buf_vec[BUF_VECTOR_MAX]; /**< for scatter RX. */
} __rte_cache_aligned;
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
return count;
}
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
}
return count;
vq->used->idx += entry_success;
/* Kick guest if required. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT))
- eventfd_write((int)vq->callfd, 1);
+ eventfd_write(vq->callfd, (eventfd_t)1);
return entry_success;
}
rvq = dev->virtqueue[VIRTIO_RXQ];
tvq = dev->virtqueue[VIRTIO_TXQ];
if (rvq && tvq && rvq->desc && tvq->desc &&
- (rvq->kickfd != (eventfd_t)-1) &&
- (rvq->callfd != (eventfd_t)-1) &&
- (tvq->kickfd != (eventfd_t)-1) &&
- (tvq->callfd != (eventfd_t)-1)) {
+ (rvq->kickfd != -1) &&
+ (rvq->callfd != -1) &&
+ (tvq->kickfd != -1) &&
+ (tvq->callfd != -1)) {
RTE_LOG(INFO, VHOST_CONFIG,
"virtio is now ready for processing.\n");
return 1;
* sent and only sent in vhost_vring_stop.
* TODO: cleanup the vring, it isn't usable since here.
*/
- if (((int)dev->virtqueue[VIRTIO_RXQ]->kickfd) >= 0) {
+ if ((dev->virtqueue[VIRTIO_RXQ]->kickfd) >= 0) {
close(dev->virtqueue[VIRTIO_RXQ]->kickfd);
- dev->virtqueue[VIRTIO_RXQ]->kickfd = (eventfd_t)-1;
+ dev->virtqueue[VIRTIO_RXQ]->kickfd = -1;
}
- if (((int)dev->virtqueue[VIRTIO_TXQ]->kickfd) >= 0) {
+ if ((dev->virtqueue[VIRTIO_TXQ]->kickfd) >= 0) {
close(dev->virtqueue[VIRTIO_TXQ]->kickfd);
- dev->virtqueue[VIRTIO_TXQ]->kickfd = (eventfd_t)-1;
+ dev->virtqueue[VIRTIO_TXQ]->kickfd = -1;
}
return 0;
}
/* Close any event notifiers opened by device. */
- if ((int)dev->virtqueue[VIRTIO_RXQ]->callfd >= 0)
- close((int)dev->virtqueue[VIRTIO_RXQ]->callfd);
- if ((int)dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0)
- close((int)dev->virtqueue[VIRTIO_RXQ]->kickfd);
- if ((int)dev->virtqueue[VIRTIO_TXQ]->callfd >= 0)
- close((int)dev->virtqueue[VIRTIO_TXQ]->callfd);
- if ((int)dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0)
- close((int)dev->virtqueue[VIRTIO_TXQ]->kickfd);
+ if (dev->virtqueue[VIRTIO_RXQ]->callfd >= 0)
+ close(dev->virtqueue[VIRTIO_RXQ]->callfd);
+ if (dev->virtqueue[VIRTIO_RXQ]->kickfd >= 0)
+ close(dev->virtqueue[VIRTIO_RXQ]->kickfd);
+ if (dev->virtqueue[VIRTIO_TXQ]->callfd >= 0)
+ close(dev->virtqueue[VIRTIO_TXQ]->callfd);
+ if (dev->virtqueue[VIRTIO_TXQ]->kickfd >= 0)
+ close(dev->virtqueue[VIRTIO_TXQ]->kickfd);
}
/*
memset(dev->virtqueue[VIRTIO_RXQ], 0, sizeof(struct vhost_virtqueue));
memset(dev->virtqueue[VIRTIO_TXQ], 0, sizeof(struct vhost_virtqueue));
- dev->virtqueue[VIRTIO_RXQ]->kickfd = (eventfd_t)-1;
- dev->virtqueue[VIRTIO_RXQ]->callfd = (eventfd_t)-1;
- dev->virtqueue[VIRTIO_TXQ]->kickfd = (eventfd_t)-1;
- dev->virtqueue[VIRTIO_TXQ]->callfd = (eventfd_t)-1;
+ dev->virtqueue[VIRTIO_RXQ]->kickfd = -1;
+ dev->virtqueue[VIRTIO_RXQ]->callfd = -1;
+ dev->virtqueue[VIRTIO_TXQ]->kickfd = -1;
+ dev->virtqueue[VIRTIO_TXQ]->callfd = -1;
/* Backends are set to -1 indicating an inactive device. */
dev->virtqueue[VIRTIO_RXQ]->backend = VIRTIO_DEV_STOPPED;
/* 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 (vq->callfd >= 0)
+ close(vq->callfd);
vq->callfd = file->fd;
/* 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 (vq->kickfd >= 0)
+ close(vq->kickfd);
vq->kickfd = file->fd;