This patch moves the virtqueues defines from PCI header
to the generic one.
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
---
drivers/net/virtio/virtio.h | 18 ++++++++++++++++++
drivers/net/virtio/virtio_ethdev.h | 4 +++-
drivers/net/virtio/virtio_pci.h | 17 -----------------
.../net/virtio/virtio_user/virtio_user_dev.h | 3 ++-
4 files changed, 23 insertions(+), 19 deletions(-)
@@ -88,6 +88,24 @@
#define VIRTIO_NET_S_LINK_UP 1 /* Link is up */
#define VIRTIO_NET_S_ANNOUNCE 2 /* Announcement is needed */
+/*
+ * Each virtqueue indirect descriptor list must be physically contiguous.
+ * To allow us to malloc(9) each list individually, limit the number
+ * supported to what will fit in one page. With 4KB pages, this is a limit
+ * of 256 descriptors. If there is ever a need for more, we can switch to
+ * contigmalloc(9) for the larger allocations, similar to what
+ * bus_dmamem_alloc(9) does.
+ *
+ * Note the sizeof(struct vring_desc) is 16 bytes.
+ */
+#define VIRTIO_MAX_INDIRECT ((int)(PAGE_SIZE / 16))
+
+/*
+ * Maximum number of virtqueues per device.
+ */
+#define VIRTIO_MAX_VIRTQUEUE_PAIRS 8
+#define VIRTIO_MAX_VIRTQUEUES (VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1)
+
struct virtio_hw {
struct virtqueue **vqs;
uint64_t guest_features;
@@ -7,7 +7,9 @@
#include <stdint.h>
-#include "virtio_pci.h"
+#include <rte_ethdev_driver.h>
+
+#include "virtio.h"
#ifndef PAGE_SIZE
#define PAGE_SIZE 4096
@@ -67,23 +67,6 @@ struct virtnet_ctl;
#define VIRTIO_CONFIG_STATUS_DEV_NEED_RESET 0x40
#define VIRTIO_CONFIG_STATUS_FAILED 0x80
-/*
- * Each virtqueue indirect descriptor list must be physically contiguous.
- * To allow us to malloc(9) each list individually, limit the number
- * supported to what will fit in one page. With 4KB pages, this is a limit
- * of 256 descriptors. If there is ever a need for more, we can switch to
- * contigmalloc(9) for the larger allocations, similar to what
- * bus_dmamem_alloc(9) does.
- *
- * Note the sizeof(struct vring_desc) is 16 bytes.
- */
-#define VIRTIO_MAX_INDIRECT ((int) (PAGE_SIZE / 16))
-
-/*
- * Maximum number of virtqueues per device.
- */
-#define VIRTIO_MAX_VIRTQUEUE_PAIRS 8
-#define VIRTIO_MAX_VIRTQUEUES (VIRTIO_MAX_VIRTQUEUE_PAIRS * 2 + 1)
/* Common configuration */
#define VIRTIO_PCI_CAP_COMMON_CFG 1
@@ -7,7 +7,8 @@
#include <limits.h>
#include <stdbool.h>
-#include "../virtio_pci.h"
+
+#include "../virtio.h"
#include "../virtio_ring.h"
enum virtio_user_backend_type {