From 75dbf6ff44fc7f499f401265703d4bca5aaf3a79 Mon Sep 17 00:00:00 2001 From: Timos Ampelikiotis Date: Fri, 17 Mar 2023 14:59:49 +0100 Subject: Update/Polish virtio-loopback-adapter Delta release: - Add new ioctl for sharing communication shared struct - Remove old ioctls and comments Signed-off-by: Timos Ampelikiotis --- vhost_user_loopback.c | 2 -- virtio_loopback.c | 4 ++-- virtio_loopback.h | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/vhost_user_loopback.c b/vhost_user_loopback.c index 91e2efb..bf5c8da 100644 --- a/vhost_user_loopback.c +++ b/vhost_user_loopback.c @@ -1273,8 +1273,6 @@ void find_add_new_reg(struct vhost_dev *dev) int sglist_elem_num; int i; - (void)ioctl(loopback_fd, BARRIER); - DBG("Total nvqs: %d\n", dev->nvqs); for (int i = 0; i < dev->nvqs; i++) { diff --git a/virtio_loopback.c b/virtio_loopback.c index 0eaac50..38b4209 100644 --- a/virtio_loopback.c +++ b/virtio_loopback.c @@ -2122,8 +2122,8 @@ int virtio_loopback_start(void) */ (void)ioctl(fd, EFD_INIT, &info); - /* Map notification mechanism */ - /* Multiple mmaps: /dev/loopback-0/vqs, /dev/loopback-0/ctlr */ + /* Map communication mechanism */ + (void)ioctl(fd, SHARE_COM_STRUCT); address = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (address == MAP_FAILED) { perror("mmap operation failed"); diff --git a/virtio_loopback.h b/virtio_loopback.h index e581d92..ae0a8b4 100644 --- a/virtio_loopback.h +++ b/virtio_loopback.h @@ -166,10 +166,8 @@ #define IRQ _IOC(_IOC_WRITE, 'k', 4, sizeof(int)) #define SHARE_VQS _IOC(_IOC_WRITE, 'k', 5, sizeof(uint32_t)) #define SHARE_BUF _IOC(_IOC_WRITE, 'k', 6, sizeof(uint64_t)) -#define USED_INFO _IOC(_IOC_WRITE, 'k', 7, 0) -#define DATA_INFO _IOC(_IOC_WRITE, 'k', 8, 0) +#define SHARE_COM_STRUCT _IOC(_IOC_WRITE, 'k', 7, 0) #define MAP_BLK _IOC(_IOC_WRITE, 'k', 9, 0) -#define BARRIER _IOC(_IOC_WRITE, 'k', 10, 0) #define VIRTIO_PCI_VRING_ALIGN 4096 -- cgit 1.2.3-korg