Commit ad1c9bd7 authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Jim Harris
Browse files

rte_virtio/user: use linux virtio includes



Removed internal copy of virtio
structures.

Change-Id: Ie66e6717e3313e089565189e5377491af793640a
Signed-off-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/385620


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 21f46353
Loading
Loading
Loading
Loading
+2 −38
Original line number Diff line number Diff line
@@ -36,41 +36,12 @@

#include "spdk/stdinc.h"

#include <linux/vhost.h>

#include "spdk_internal/log.h"

#include "../virtio_dev.h"

struct vhost_vring_state {
	unsigned int index;
	unsigned int num;
};

struct vhost_vring_file {
	unsigned int index;
	int fd;
};

struct vhost_vring_addr {
	unsigned int index;
	/* Option flags. */
	unsigned int flags;
	/* Flag values: */
	/* Whether log address is valid. If set enables logging. */
#define VHOST_VRING_F_LOG 0

	/* Start of array of descriptors (virtually contiguous) */
	uint64_t desc_user_addr;
	/* Used structure address. Must be 32 bit aligned */
	uint64_t used_user_addr;
	/* Available structure address. Must be 16 bit aligned */
	uint64_t avail_user_addr;
	/* Logging support. */
	/* Log writes to used structure, at offset calculated from specified
	 * address. Address must be 32 bit aligned.
	 */
	uint64_t log_guest_addr;
};

enum vhost_user_request {
	VHOST_USER_NONE = 0,
	VHOST_USER_GET_FEATURES = 1,
@@ -96,13 +67,6 @@ enum vhost_user_request {

extern const char *const vhost_msg_strings[VHOST_USER_MAX];

struct vhost_memory_region {
	uint64_t guest_phys_addr;
	uint64_t memory_size; /* bytes */
	uint64_t userspace_addr;
	uint64_t mmap_offset;
};

struct virtio_user_dev;

struct virtio_user_backend_ops {
+5 −3
Original line number Diff line number Diff line
@@ -42,7 +42,9 @@
#define VHOST_USER_VERSION    0x1

#define VHOST_MEMORY_MAX_NREGIONS 8
struct vhost_memory {

/** Fixed-size vhost_memory struct */
struct vhost_memory_padded {
	uint32_t nregions;
	uint32_t padding;
	struct vhost_memory_region regions[VHOST_MEMORY_MAX_NREGIONS];
@@ -61,7 +63,7 @@ struct vhost_user_msg {
		uint64_t u64;
		struct vhost_vring_state state;
		struct vhost_vring_addr addr;
		struct vhost_memory memory;
		struct vhost_memory_padded memory;
	} payload;
	int fds[VHOST_MEMORY_MAX_NREGIONS];
} __attribute((packed));
@@ -250,7 +252,7 @@ prepare_vhost_memory_user(struct vhost_user_msg *msg, int fds[])
		msg->payload.memory.regions[i].guest_phys_addr = huges[i].addr; /* use vaddr! */
		msg->payload.memory.regions[i].userspace_addr = huges[i].addr;
		msg->payload.memory.regions[i].memory_size = huges[i].size;
		msg->payload.memory.regions[i].mmap_offset = 0;
		msg->payload.memory.regions[i].flags_padding = 0;
		fds[i] = open(huges[i].path, O_RDWR);
	}

+0 −2
Original line number Diff line number Diff line
@@ -36,8 +36,6 @@

#include "spdk/stdinc.h"

#include <linux/virtio_ring.h>

#include "vhost.h"

#include "../virtio_dev.h"