dev: device and port specific args

Type: improvement
Change-Id: I26124a50d8e05d6f01a2e6dbc4bc8183fb5a09c4
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/vnet/dev/port.c b/src/vnet/dev/port.c
index 350c1d8..b3f4035 100644
--- a/src/vnet/dev/port.c
+++ b/src/vnet/dev/port.c
@@ -93,6 +93,7 @@
   pool_free (port->secondary_hw_addr);
   pool_free (port->rx_queues);
   pool_free (port->tx_queues);
+  vnet_dev_arg_free (&port->args);
   pool_put_index (dev->ports, port->index);
   clib_mem_free (port);
 }
@@ -266,6 +267,9 @@
   port->rx_node = *args->rx_node;
   port->tx_node = *args->tx_node;
 
+  for (vnet_dev_arg_t *a = args->port.args; a->type != VNET_DEV_ARG_END; a++)
+    vec_add1 (port->args, *a);
+
   /* defaults out of port attributes */
   port->max_rx_frame_size = args->port.attr.max_supported_rx_frame_size;
   port->primary_hw_addr = args->port.attr.hw_addr;
@@ -711,6 +715,9 @@
 
   vnet_dev_port_free_counters (vm, port);
 
+  foreach_vnet_dev_port_args (v, port)
+    vnet_dev_arg_clear_value (v);
+
   return VNET_DEV_OK;
 }
 void