summaryrefslogtreecommitdiffstats
path: root/src/vnet/dev/api.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2023-11-13 17:33:32 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2023-11-16 16:01:35 +0000
commit69768d99eed0f44f6955370cb1ad83b8b73e5368 (patch)
tree00c689be86b41fe36aae2a9e6e0d3422e1272d81 /src/vnet/dev/api.c
parentf3be34e4433bb86509044290fa3cced543697a31 (diff)
dev: device and port specific args
Type: improvement Change-Id: I26124a50d8e05d6f01a2e6dbc4bc8183fb5a09c4 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/dev/api.c')
-rw-r--r--src/vnet/dev/api.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/vnet/dev/api.c b/src/vnet/dev/api.c
index 73d315db519..260bc7b2e22 100644
--- a/src/vnet/dev/api.c
+++ b/src/vnet/dev/api.c
@@ -90,6 +90,17 @@ vnet_dev_api_attach (vlib_main_t *vm, vnet_dev_api_attach_args_t *args)
}
dev->description = dev_desc;
+ for (vnet_dev_arg_t *a = driver->registration->args;
+ a->type != VNET_DEV_ARG_END; a++)
+ vec_add1 (dev->args, *a);
+
+ if (args->args)
+ {
+ if ((rv = vnet_dev_arg_parse (vm, dev, dev->args, args->args)) !=
+ VNET_DEV_OK)
+ goto done;
+ }
+
if ((args->flags.e & VNET_DEV_F_NO_STATS) == 0)
dev->poll_stats = 1;
@@ -144,6 +155,7 @@ vnet_dev_api_create_port_if (vlib_main_t *vm,
vnet_dev_port_t *port = 0;
u16 n_threads = vlib_get_n_threads ();
int default_is_intr_mode;
+ vnet_dev_rv_t rv;
log_debug (dev,
"create_port_if: device '%s' port %u intf_name '%s' num_rx_q %u "
@@ -169,6 +181,13 @@ vnet_dev_api_create_port_if (vlib_main_t *vm,
if (port->interface_created)
return VNET_DEV_ERR_ALREADY_EXISTS;
+ if (args->args)
+ {
+ rv = vnet_dev_arg_parse (vm, dev, port->args, args->args);
+ if (rv != VNET_DEV_OK)
+ return rv;
+ }
+
default_is_intr_mode = (args->flags.e & VNET_DEV_PORT_F_INTERRUPT_MODE) != 0;
if (default_is_intr_mode && port->attr.caps.interrupt_mode == 0)
{