virtio: add virtio 1.1 api flags
[vpp.git] / src / vnet / devices / virtio / pci.h
index dfc0711..47c74ab 100644 (file)
@@ -82,7 +82,8 @@ typedef enum
  * 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)
+  _ (VHOST_USER_F_PROTOCOL_FEATURES, 30)                                      \
+  _ (VIRTIO_F_VERSION_1, 32)                                                  \
 
 #define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2
 #define VIRTIO_NET_F_MTU 3
@@ -147,8 +148,8 @@ typedef struct
   /* About the whole device. */
   u32 device_feature_select;   /* read-write */
   u32 device_feature;          /* read-only */
-  u32 guest_feature_select;    /* read-write */
-  u32 guest_feature;           /* read-write */
+  u32 driver_feature_select;   /* read-write */
+  u32 driver_feature;          /* read-write */
   u16 msix_config;             /* read-write */
   u16 num_queues;              /* read-only */
   u8 device_status;            /* read-write */
@@ -160,12 +161,9 @@ typedef struct
   u16 queue_msix_vector;       /* read-write */
   u16 queue_enable;            /* read-write */
   u16 queue_notify_off;                /* read-only */
-  u32 queue_desc_lo;           /* read-write */
-  u32 queue_desc_hi;           /* read-write */
-  u32 queue_avail_lo;          /* read-write */
-  u32 queue_avail_hi;          /* read-write */
-  u32 queue_used_lo;           /* read-write */
-  u32 queue_used_hi;           /* read-write */
+  u64 queue_desc;              /* read-write */
+  u64 queue_driver;            /* read-write */
+  u64 queue_device;            /* read-write */
 } virtio_pci_common_cfg_t;
 
 typedef struct
@@ -244,6 +242,20 @@ typedef struct _virtio_pci_func
   void (*device_debug_config_space) (vlib_main_t * vm, virtio_if_t * vif);
 } virtio_pci_func_t;
 
+#define foreach_virtio_flags  \
+  _ (GSO, 0)                  \
+  _ (CSUM_OFFLOAD, 1)         \
+  _ (GRO_COALESCE, 2)         \
+  _ (PACKED, 3)               \
+  _ (IN_ORDER, 4)
+
+typedef enum
+{
+#define _(a, b) VIRTIO_FLAG_##a = (1 << b),
+  foreach_virtio_flags
+#undef _
+} virtio_flag_t;
+
 typedef struct
 {
   u32 addr;
@@ -255,10 +267,12 @@ typedef struct
   u64 features;
   u8 gso_enabled;
   u8 checksum_offload_enabled;
+  u32 virtio_flags;
   clib_error_t *error;
 } virtio_pci_create_if_args_t;
 
 extern const virtio_pci_func_t virtio_pci_legacy_func;
+extern const virtio_pci_func_t virtio_pci_modern_func;
 
 extern void device_status (vlib_main_t * vm, virtio_if_t * vif);
 void virtio_pci_create_if (vlib_main_t * vm,