virtio: split gso and checksum offload functionality
[vpp.git] / src / vnet / devices / virtio / pci.h
index dcf9b14..8ec1360 100644 (file)
@@ -101,10 +101,22 @@ typedef enum
  * at the end of the used ring. Guest should ignore the used->flags field. */ \
   _ (VHOST_USER_F_PROTOCOL_FEATURES, 30)
 
+#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS 2
 #define VIRTIO_NET_F_MTU 3
 #define VIRTIO_NET_S_LINK_UP    1      /* Link is up */
 #define VIRTIO_NET_S_ANNOUNCE   2      /* Announcement is needed */
 
+/*
+ * Control network offloads
+ * Reconfigures the network offloads that Guest can handle.
+ * Available with the VIRTIO_NET_F_CTRL_GUEST_OFFLOADS feature bit.
+ * Command data format matches the feature bit mask exactly.
+ * See VIRTIO_NET_F_GUEST_* for the list of offloads
+ * that can be enabled/disabled.
+ */
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS 5
+#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET 0
+
 /* Common configuration */
 #define VIRTIO_PCI_CAP_COMMON_CFG       1
 /* Notifications */
@@ -120,27 +132,6 @@ typedef enum
 
 #define VIRTIO_PCI_VRING_ALIGN 4096
 
-#define virtio_log_debug(vim, vif, f, ...)                     \
-{                                                              \
-  vlib_log(VLIB_LOG_LEVEL_DEBUG, vim->log_default, "%U: " f,   \
-           format_vlib_pci_addr, &vif->pci_addr,               \
-           ##__VA_ARGS__);                                     \
-};
-
-#define virtio_log_warning(vim, vif, f, ...)                   \
-{                                                              \
-  vlib_log(VLIB_LOG_LEVEL_WARNING, vim->log_default, "%U: " f, \
-           format_vlib_pci_addr, &vif->pci_addr,               \
-           ##__VA_ARGS__);                                     \
-};
-
-#define virtio_log_error(vim, vif, f, ...)                     \
-{                                                              \
-  vlib_log(VLIB_LOG_LEVEL_ERR, vim->log_default, "%U: " f,     \
-           format_vlib_pci_addr, &vif->pci_addr,               \
-           ##__VA_ARGS__);                                     \
-};
-
 typedef enum
 {
   VIRTIO_MSIX_NONE = 0,
@@ -233,6 +224,8 @@ typedef struct
   u8 mac_addr_set;
   u8 mac_addr[6];
   u64 features;
+  u8 gso_enabled;
+  u8 checksum_offload_enabled;
   clib_error_t *error;
 } virtio_pci_create_if_args_t;
 
@@ -241,7 +234,10 @@ extern void device_status (vlib_main_t * vm, virtio_if_t * vif);
 void virtio_pci_create_if (vlib_main_t * vm,
                           virtio_pci_create_if_args_t * args);
 int virtio_pci_delete_if (vlib_main_t * vm, virtio_if_t * ad);
-
+int virtio_pci_enable_disable_offloads (vlib_main_t * vm, virtio_if_t * vif,
+                                       int gso_enabled,
+                                       int checksum_offload_enabled,
+                                       int offloads_disabled);
 #endif /* __included_virtio_pci_h__ */
 /*
  * fd.io coding-style-patch-verification: ON