interface: add capabilities flags

Type: improvement

This patch adds flags to represent the modern NICs capabilities.

Change-Id: I96d38d9ab7eac55974d72795cd100d8337168e1e
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
diff --git a/src/vnet/bonding/cli.c b/src/vnet/bonding/cli.c
index 4ddee4a..a24d110 100644
--- a/src/vnet/bonding/cli.c
+++ b/src/vnet/bonding/cli.c
@@ -464,8 +464,9 @@
    */
   if (args->gso)
     {
-      hw->flags |= (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-		    VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+      hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+		   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
     }
   if (vlib_get_thread_main ()->n_vlib_mains > 1)
     clib_spinlock_init (&bif->lockp);
@@ -631,7 +632,7 @@
 	clib_error_return (0, "bond interface cannot be added as member");
       return;
     }
-  if (bif->gso && !(mif_hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO))
+  if (bif->gso && !(mif_hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO))
     {
       args->rv = VNET_API_ERROR_INVALID_INTERFACE;
       args->error =
diff --git a/src/vnet/devices/af_packet/af_packet.c b/src/vnet/devices/af_packet/af_packet.c
index 2cc0cc7..60a3ccc 100644
--- a/src/vnet/devices/af_packet/af_packet.c
+++ b/src/vnet/devices/af_packet/af_packet.c
@@ -404,7 +404,7 @@
   apif->queue_index = vnet_hw_if_register_rx_queue (vnm, apif->hw_if_index, 0,
 						    VNET_HW_IF_RXQ_THREAD_ANY);
 
-  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
   vnet_hw_interface_set_flags (vnm, apif->hw_if_index,
 			       VNET_HW_INTERFACE_FLAG_LINK_UP);
 
@@ -515,10 +515,15 @@
     return VNET_API_ERROR_INVALID_INTERFACE;
 
   if (set)
-    hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+    {
+      hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		    VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+    }
   else
-    hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
-
+    {
+      hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+    }
   return 0;
 }
 
diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c
index 7e7d3d5..5b15f92 100644
--- a/src/vnet/devices/tap/tap.c
+++ b/src/vnet/devices/tap/tap.c
@@ -724,15 +724,17 @@
   args->sw_if_index = vif->sw_if_index;
   args->rv = 0;
   hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
-  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
   if (args->tap_flags & TAP_FLAG_GSO)
     {
-      hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-	VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+      hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+		  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
     }
   else if (args->tap_flags & TAP_FLAG_CSUM_OFFLOAD)
     {
-      hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+      hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
     }
   if ((args->tap_flags & TAP_FLAG_GSO)
       && (args->tap_flags & TAP_FLAG_GRO_COALESCE))
@@ -834,26 +836,18 @@
   vif->packet_coalesce = 0;
   vif->csum_offload_enabled = enable_disable ? 1 : 0;
 
-  if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0)
+  if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0)
     {
-      hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+      hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
     }
 
   if (enable_disable)
     {
-      if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) ==
-	  0)
-	{
-	  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
-	}
+      hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
     }
   else
     {
-      if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD) !=
-	  0)
-	{
-	  hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
-	}
+      hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
     }
 
 error:
@@ -893,10 +887,10 @@
   vif->csum_offload_enabled = 0;
   if (enable_disable)
     {
-      if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0)
+      if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == 0)
 	{
-	  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-	    VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+	  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+		      VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM;
 	}
       if (is_packet_coalesce)
 	{
@@ -905,10 +899,10 @@
     }
   else
     {
-      if ((hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) != 0)
+      if ((hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) != 0)
 	{
-	  hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-			 VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+	  hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+			VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM);
 	}
       vif->packet_coalesce = 0;
     }
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index fb996d5..e71e16c 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -965,12 +965,12 @@
   vnet_main_t *vnm = vnet_get_main ();
   vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
 
-  if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO)
+  if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)
     return virtio_interface_tx_gso_inline (vm, node, vif, type, vring,
 					   buffers, n_left, packed,
 					   1 /* do_gso */ ,
 					   1 /* checksum offload */ );
-  else if (hw->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)
+  else if (hw->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM)
     return virtio_interface_tx_gso_inline (vm, node, vif, type, vring,
 					   buffers, n_left, packed,
 					   0 /* no do_gso */ ,
diff --git a/src/vnet/devices/virtio/pci.c b/src/vnet/devices/virtio/pci.c
index 79bd004..7ef4b2a 100644
--- a/src/vnet/devices/virtio/pci.c
+++ b/src/vnet/devices/virtio/pci.c
@@ -525,8 +525,9 @@
 	    {
 	      vif->gso_enabled = 1;
 	      vif->csum_offload_enabled = 0;
-	      hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-		VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+	      hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+			  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+			  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
 	    }
 	}
       else if (csum_offload_enabled
@@ -540,9 +541,9 @@
 	    {
 	      vif->csum_offload_enabled = 1;
 	      vif->gso_enabled = 0;
-	      hw->flags &= ~VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
-	      hw->flags |=
-		VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
+	      hw->caps &= ~VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
+	      hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+			  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM;
 	    }
 	}
       else
@@ -555,8 +556,8 @@
 	    {
 	      vif->csum_offload_enabled = 0;
 	      vif->gso_enabled = 0;
-	      hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-			     VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+	      hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM |
+			    VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO);
 	    }
 	}
     }
@@ -1500,7 +1501,7 @@
   args->sw_if_index = sw->sw_if_index;
 
   vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, vif->hw_if_index);
-  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
 
   if (args->virtio_flags & VIRTIO_FLAG_BUFFERING)
     {
diff --git a/src/vnet/devices/virtio/vhost_user.c b/src/vnet/devices/virtio/vhost_user.c
index 426f03c..5f04db0 100644
--- a/src/vnet/devices/virtio/vhost_user.c
+++ b/src/vnet/devices/virtio/vhost_user.c
@@ -515,12 +515,16 @@
       if (vui->enable_gso &&
 	  ((vui->features & FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS)
 	   == FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS))
-	hw->flags |=
-	  (VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-	   VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+	{
+	  hw->caps |= (VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+		       VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |
+		       VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM);
+	}
       else
-	hw->flags &= ~(VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO |
-		       VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD);
+	{
+	  hw->caps &= ~(VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO |
+			VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM);
+	}
       vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0);
       vui->is_ready = 0;
       vhost_user_update_iface_state (vui);
@@ -1619,7 +1623,7 @@
   for (q = 0; q < vec_len (vui->vrings); q++)
     vhost_user_vring_init (vui, q);
 
-  hw->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE;
+  hw->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE;
   vnet_hw_interface_set_flags (vnm, vui->hw_if_index, 0);
 
   if (sw_if_index)
diff --git a/src/vnet/ethernet/interface.c b/src/vnet/ethernet/interface.c
index b5c4819..f72b493 100644
--- a/src/vnet/ethernet/interface.c
+++ b/src/vnet/ethernet/interface.c
@@ -459,7 +459,7 @@
       switch (opn_flags)
 	{
 	case ETHERNET_INTERFACE_FLAG_DEFAULT_L3:
-	  if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER)
+	  if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER)
 	    {
 	      if (ei->flag_change (vnm, hi, opn_flags) != ~0)
 		{
diff --git a/src/vnet/gso/node.c b/src/vnet/gso/node.c
index ecbdc18..5814aad 100644
--- a/src/vnet/gso/node.c
+++ b/src/vnet/gso/node.c
@@ -523,28 +523,30 @@
 	    if (PREDICT_FALSE (hi->sw_if_index != swif0))
 	      {
 		hi0 = vnet_get_sup_hw_interface (vnm, swif0);
-		if ((hi0->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 &&
+		if ((hi0->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) ==
+		      0 &&
 		    (b[0]->flags & VNET_BUFFER_F_GSO))
 		  break;
 	      }
 	    if (PREDICT_FALSE (hi->sw_if_index != swif1))
 	      {
 		hi1 = vnet_get_sup_hw_interface (vnm, swif1);
-		if (!(hi1->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) &&
+		if (!(hi1->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) &&
 		    (b[1]->flags & VNET_BUFFER_F_GSO))
 		  break;
 	      }
 	    if (PREDICT_FALSE (hi->sw_if_index != swif2))
 	      {
 		hi2 = vnet_get_sup_hw_interface (vnm, swif2);
-		if ((hi2->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 &&
+		if ((hi2->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) ==
+		      0 &&
 		    (b[2]->flags & VNET_BUFFER_F_GSO))
 		  break;
 	      }
 	    if (PREDICT_FALSE (hi->sw_if_index != swif3))
 	      {
 		hi3 = vnet_get_sup_hw_interface (vnm, swif3);
-		if (!(hi3->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) &&
+		if (!(hi3->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) &&
 		    (b[3]->flags & VNET_BUFFER_F_GSO))
 		  break;
 	      }
@@ -615,7 +617,7 @@
 	  if (PREDICT_FALSE (hi->sw_if_index != swif0))
 	    {
 	      hi0 = vnet_get_sup_hw_interface (vnm, swif0);
-	      if ((hi0->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO) == 0 &&
+	      if ((hi0->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO) == 0 &&
 		  (b[0]->flags & VNET_BUFFER_F_GSO))
 		do_segmentation0 = 1;
 	    }
@@ -774,7 +776,7 @@
       hi = vnet_get_sup_hw_interface (vnm,
 				      vnet_buffer (b)->sw_if_index[VLIB_TX]);
 
-      if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO)
+      if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)
 	return vnet_gso_node_inline (vm, node, frame, vnm, hi,
 				     is_l2, is_ip4, is_ip6,
 				     /* do_segmentation */ 0);
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index 9c58442..8424b71 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -510,22 +510,65 @@
   VNET_HW_INTERFACE_FLAG_HALF_DUPLEX = (1 << 1),
   VNET_HW_INTERFACE_FLAG_FULL_DUPLEX = (1 << 2),
 
-  /* rx mode flags */
-  VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE = (1 << 16),
-
-  /* tx checksum offload */
-  VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD = (1 << 17),
-
-  /* gso */
-  VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO = (1 << 18),
-
   /* non-broadcast multiple access */
   VNET_HW_INTERFACE_FLAG_NBMA = (1 << 19),
-
-  /* hw/driver can switch between l2-promisc and l3-dmac-filter modes */
-  VNET_HW_INTERFACE_FLAG_SUPPORTS_MAC_FILTER = (1 << 20),
 } vnet_hw_interface_flags_t;
 
+typedef enum vnet_hw_interface_capabilities_t_
+{
+  VNET_HW_INTERFACE_CAP_NONE,
+
+  /* tx checksum offload */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM = (1 << 0),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM = (1 << 1),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM = (1 << 2),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_OUTER_CKSUM = (1 << 3),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_OUTER_CKSUM = (1 << 4),
+
+  /* rx checksum offload */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM = (1 << 5),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM = (1 << 6),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM = (1 << 7),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_OUTER_CKSUM = (1 << 8),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_OUTER_CKSUM = (1 << 9),
+
+  /* gso */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO = (1 << 10),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_GSO = (1 << 11),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_VXLAN_TNL_GSO = (1 << 12),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_IPIP_TNL_GSO = (1 << 13),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_GENEVE_TNL_GSO = (1 << 14),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_GRE_TNL_GSO = (1 << 15),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_UDP_TNL_GSO = (1 << 16),
+  VNET_HW_INTERFACE_CAP_SUPPORTS_IP_TNL_GSO = (1 << 17),
+
+  /* lro */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_LRO = (1 << 18),
+
+  /* rx mode */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE = (1 << 30),
+  /* hw/driver can switch between l2-promisc and l3-dmac-filter modes */
+  VNET_HW_INTERFACE_CAP_SUPPORTS_MAC_FILTER = (1 << 31),
+} vnet_hw_interface_capabilities_t;
+
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM                            \
+  (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM)
+
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM                               \
+  (VNET_HW_INTERFACE_CAP_SUPPORTS_TX_IP4_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM)
+
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_RX_CKSUM                            \
+  (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
+
+#define VNET_HW_INTERFACE_CAP_SUPPORTS_RX_CKSUM                               \
+  (VNET_HW_INTERFACE_CAP_SUPPORTS_RX_IP4_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_RX_TCP_CKSUM |                              \
+   VNET_HW_INTERFACE_CAP_SUPPORTS_RX_UDP_CKSUM)
+
 #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1
 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT  3
 #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK	\
@@ -566,6 +609,8 @@
   /* flags */
   vnet_hw_interface_flags_t flags;
 
+  /* capabilities flags */
+  vnet_hw_interface_capabilities_t caps;
 
   /* link speed in kbps */
   u32 link_speed;
@@ -592,6 +637,8 @@
   /* Software index for this hardware interface. */
   u32 sw_if_index;
 
+  CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
+
   /* Next index in interface-output node for this interface
      used by node function vnet_per_buffer_interface_output() */
   u32 output_node_next_index;
@@ -649,6 +696,9 @@
   u32 trace_classify_table_index;
 } vnet_hw_interface_t;
 
+STATIC_ASSERT_OFFSET_OF (vnet_hw_interface_t, cacheline1,
+			 CLIB_CACHE_LINE_BYTES);
+
 typedef struct
 {
   u32 dev_instance;
diff --git a/src/vnet/interface_output.c b/src/vnet/interface_output.c
index d244765..c46868e 100644
--- a/src/vnet/interface_output.c
+++ b/src/vnet/interface_output.c
@@ -491,7 +491,7 @@
   vnet_interface_pcap_tx_trace (vm, node, frame,
 				0 /* sw_if_index_from_buffer */ );
 
-  if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)
+  if (hi->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TX_CKSUM)
     return vnet_interface_output_node_inline (vm, node, frame, vnm, hi,
 					      /* do_tx_offloads */ 0);
   else
diff --git a/src/vnet/interface_output.h b/src/vnet/interface_output.h
index 27aadc6..6b766d3 100644
--- a/src/vnet/interface_output.h
+++ b/src/vnet/interface_output.h
@@ -41,7 +41,6 @@
 #define __INTERFACE_INLINES_H__
 
 #include <vnet/vnet.h>
-#include <vnet/gso/hdr_offset_parser.h>
 
 static_always_inline void
 vnet_calc_ip4_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip4_header_t *ip4,
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index 6ea8090..0ce640b 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -267,7 +267,7 @@
       hi = vnet_get_hw_interface (vnm, pi->hw_if_index);
       if (gso_enabled)
 	{
-	  hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+	  hi->caps |= VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO;
 	  pi->gso_enabled = 1;
 	  pi->gso_size = gso_size;
 	  if (coalesce_enabled)
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index f5d17ea..509732f 100644
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -1776,7 +1776,7 @@
     return;
 
   hw_if = vnet_get_sup_hw_interface (vnm, sw_if_idx);
-  if (hw_if->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO)
+  if (hw_if->caps & VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO)
     tc->cfg_flags |= TCP_CFG_F_TSO;
 }