dev: caps and rx/tx offload support

Type: improvement
Change-Id: I7972f595444eacdb020f3fa2a60331c40766fc0b
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/dev/port.c b/src/vnet/dev/port.c
index 0363ea4..8a6df54 100644
--- a/src/vnet/dev/port.c
+++ b/src/vnet/dev/port.c
@@ -573,6 +573,7 @@
       vnet_dev_driver_t *driver;
       vnet_sw_interface_t *sw;
       vnet_hw_interface_t *hw;
+      vnet_hw_if_caps_t caps = 0;
       u32 rx_node_index;
 
       driver = pool_elt_at_index (dm->drivers, dev->driver_index);
@@ -607,6 +608,14 @@
 
       port->intf.tx_node_index = hw->tx_node_index;
 
+      caps |= port->attr.caps.interrupt_mode ? VNET_HW_IF_CAP_INT_MODE : 0;
+      caps |= port->attr.caps.mac_filter ? VNET_HW_IF_CAP_MAC_FILTER : 0;
+      caps |= port->attr.tx_offloads.tcp_gso ? VNET_HW_IF_CAP_TCP_GSO : 0;
+      caps |= port->attr.tx_offloads.ip4_cksum ? VNET_HW_IF_CAP_TX_CKSUM : 0;
+
+      if (caps)
+	vnet_hw_if_set_caps (vnm, port->intf.hw_if_index, caps);
+
       /* create / reuse rx node */
       if (vec_len (dm->free_rx_node_indices))
 	{