virtio: remove kernel virtio header dependencies
[vpp.git] / src / vnet / devices / virtio / virtio.h
index 7a5dcd8..f1eaa07 100644 (file)
 #ifndef _VNET_DEVICES_VIRTIO_VIRTIO_H_
 #define _VNET_DEVICES_VIRTIO_VIRTIO_H_
 
-#include <linux/virtio_config.h>
-#include <linux/virtio_net.h>
-#include <linux/virtio_pci.h>
-#include <linux/virtio_ring.h>
+#include <vnet/devices/virtio/virtio_std.h>
+#include <vnet/devices/virtio/vhost_std.h>
 #include <vnet/gso/gro.h>
 
-#define foreach_virtio_net_features      \
-  _ (VIRTIO_NET_F_CSUM, 0)     /* Host handles pkts w/ partial csum */ \
-  _ (VIRTIO_NET_F_GUEST_CSUM, 1) /* Guest handles pkts w/ partial csum */ \
-  _ (VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, 2) /* Dynamic offload configuration. */ \
-  _ (VIRTIO_NET_F_MTU, 3)       /* Initial MTU advice. */ \
-  _ (VIRTIO_NET_F_MAC, 5)      /* Host has given MAC address. */ \
-  _ (VIRTIO_NET_F_GSO, 6)      /* Host handles pkts w/ any GSO. */ \
-  _ (VIRTIO_NET_F_GUEST_TSO4, 7)       /* Guest can handle TSOv4 in. */ \
-  _ (VIRTIO_NET_F_GUEST_TSO6, 8)       /* Guest can handle TSOv6 in. */ \
-  _ (VIRTIO_NET_F_GUEST_ECN, 9)        /* Guest can handle TSO[6] w/ ECN in. */ \
-  _ (VIRTIO_NET_F_GUEST_UFO, 10)       /* Guest can handle UFO in. */ \
-  _ (VIRTIO_NET_F_HOST_TSO4, 11)       /* Host can handle TSOv4 in. */ \
-  _ (VIRTIO_NET_F_HOST_TSO6, 12)       /* Host can handle TSOv6 in. */ \
-  _ (VIRTIO_NET_F_HOST_ECN, 13)        /* Host can handle TSO[6] w/ ECN in. */ \
-  _ (VIRTIO_NET_F_HOST_UFO, 14)        /* Host can handle UFO in. */ \
-  _ (VIRTIO_NET_F_MRG_RXBUF, 15)       /* Host can merge receive buffers. */ \
-  _ (VIRTIO_NET_F_STATUS, 16)  /* virtio_net_config.status available */ \
-  _ (VIRTIO_NET_F_CTRL_VQ, 17) /* Control channel available */ \
-  _ (VIRTIO_NET_F_CTRL_RX, 18) /* Control channel RX mode support */ \
-  _ (VIRTIO_NET_F_CTRL_VLAN, 19)       /* Control channel VLAN filtering */ \
-  _ (VIRTIO_NET_F_CTRL_RX_EXTRA, 20)   /* Extra RX mode control support */ \
-  _ (VIRTIO_NET_F_GUEST_ANNOUNCE, 21)  /* Guest can announce device on the network */ \
-  _ (VIRTIO_NET_F_MQ, 22)              /* Device supports Receive Flow Steering */ \
-  _ (VIRTIO_NET_F_CTRL_MAC_ADDR, 23)   /* Set MAC address */ \
-  _ (VIRTIO_F_NOTIFY_ON_EMPTY, 24) \
-  _ (VHOST_F_LOG_ALL, 26)      /* Log all write descriptors */ \
-  _ (VIRTIO_F_ANY_LAYOUT, 27)  /* Can the device handle any descriptor layout */ \
-  _ (VIRTIO_RING_F_INDIRECT_DESC, 28)   /* Support indirect buffer descriptors */ \
-  _ (VIRTIO_RING_F_EVENT_IDX, 29)       /* The Guest publishes the used index for which it expects an interrupt \
- * at the end of the avail ring. Host should ignore the avail->flags field. */ \
-/* The Host publishes the avail index for which it expects a kick \
- * at the end of the used ring. Guest should ignore the used->flags field. */ \
-  _ (VHOST_USER_F_PROTOCOL_FEATURES, 30) \
-  _ (VIRTIO_F_VERSION_1, 32)  /* v1.0 compliant. */           \
-
 #define foreach_virtio_if_flag         \
   _(0, ADMIN_UP, "admin-up")           \
   _(1, DELETING, "deleting")
@@ -70,8 +33,6 @@ typedef enum
 #undef _
 } virtio_if_flag_t;
 
-#define VIRTIO_FEATURE(X) (1ULL << X)
-
 #define TX_QUEUE(X) ((X*2) + 1)
 #define RX_QUEUE(X) (X*2)
 #define TX_QUEUE_ACCESS(X) (X/2)
@@ -99,9 +60,9 @@ typedef struct
 {
   CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
   clib_spinlock_t lockp;
-  struct vring_desc *desc;
-  struct vring_used *used;
-  struct vring_avail *avail;
+  vring_desc_t *desc;
+  vring_used_t *used;
+  vring_avail_t *avail;
   u16 desc_in_use;
   u16 desc_next;
   int kick_fd;