tap: add initial support for tun
[vpp.git] / src / vnet / devices / virtio / virtio.h
index 2cf1653..3e8f941 100644 (file)
@@ -80,11 +80,17 @@ typedef enum
 #define TX_QUEUE_ACCESS(X) (X/2)
 #define RX_QUEUE_ACCESS(X) (X/2)
 
+#define foreach_virtio_if_types \
+  _ (TAP, 1)                    \
+  _ (TUN, 2)                    \
+  _ (PCI, 3)
+
 typedef enum
 {
-  VIRTIO_IF_TYPE_TAP = 1,
-  VIRTIO_IF_TYPE_PCI,
-  VIRTIO_IF_N_TYPES,
+#define _(a, b) VIRTIO_IF_TYPE_##a = (1 << b),
+  foreach_virtio_if_types
+#undef _
+    VIRTIO_IF_N_TYPES = (1 << 4),
 } virtio_if_type_t;
 
 
@@ -112,6 +118,7 @@ typedef struct
   u8 buffer_pool_index;
   u16 size;
   u16 queue_id;
+#define VRING_TX_OUT_OF_ORDER 1
   u16 flags;
   u32 call_file_index;
   u32 *buffers;
@@ -148,16 +155,10 @@ typedef struct
     pci_addr_t pci_addr;
   };
   u32 per_interface_next_index;
-  union
-  {
-    int fd;
-    u32 msix_enabled;
-  };
-  union
-  {
-    int tap_fd;
-    u32 pci_dev_handle;
-  };
+  int *vhost_fds;
+  int tap_fd;
+  u32 msix_enabled;
+  u32 pci_dev_handle;
   virtio_vring_t *rxq_vrings;
   virtio_vring_t *txq_vrings;
   u64 features, remote_features;
@@ -180,6 +181,7 @@ typedef struct
   u8 host_ip6_prefix_len;
   u32 host_mtu_size;
   int gso_enabled;
+  int csum_offload_enabled;
   int ifindex;
   virtio_vring_t *cxq_vring;
 } virtio_if_t;