summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-12-23 11:19:30 +0100
committerDamjan Marion <damarion@cisco.com>2018-12-23 11:45:49 +0100
commitc811663491262fdc01e8309b1f9ecde2a110a84d (patch)
tree2c9b343c9cc7765b6c67999ef4a8dfccc391e905
parentc227e4950d3bc791d2ec4a2131916f9b5c40f008 (diff)
avf: add option to specify interface name
Change-Id: I94591d5b103280f8df157819d423fef7ee89d4c8 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/plugins/avf/avf.h2
-rw-r--r--src/plugins/avf/cli.c4
-rw-r--r--src/plugins/avf/device.c2
-rw-r--r--src/plugins/avf/format.c3
4 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/avf/avf.h b/src/plugins/avf/avf.h
index 4fa19b11b73..467b5d7b651 100644
--- a/src/plugins/avf/avf.h
+++ b/src/plugins/avf/avf.h
@@ -111,6 +111,7 @@ typedef struct
u32 hw_if_index;
vlib_pci_dev_handle_t pci_dev_handle;
void *bar0;
+ u8 *name;
/* queues */
avf_rxq_t *rxqs;
@@ -200,6 +201,7 @@ extern avf_main_t avf_main;
typedef struct
{
vlib_pci_addr_t addr;
+ u8 *name;
int enable_elog;
u16 rxq_num;
u16 rxq_size;
diff --git a/src/plugins/avf/cli.c b/src/plugins/avf/cli.c
index 492494dcc79..f8fc05a9812 100644
--- a/src/plugins/avf/cli.c
+++ b/src/plugins/avf/cli.c
@@ -52,6 +52,8 @@ avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
args.txq_size = tmp;
else if (unformat (line_input, "num-rx-queues %u", &tmp))
args.rxq_num = tmp;
+ else if (unformat (line_input, "name %s", &args.name))
+ ;
else
return clib_error_return (0, "unknown input `%U'",
format_unformat_error, input);
@@ -60,6 +62,8 @@ avf_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
avf_create_if (vm, &args);
+ vec_free (args.name);
+
return args.error;
}
diff --git a/src/plugins/avf/device.c b/src/plugins/avf/device.c
index d95de2ec892..4f6c869a7f4 100644
--- a/src/plugins/avf/device.c
+++ b/src/plugins/avf/device.c
@@ -1169,6 +1169,7 @@ avf_delete_if (vlib_main_t * vm, avf_device_t * ad)
}
/* *INDENT-ON* */
vec_free (ad->txqs);
+ vec_free (ad->name);
clib_error_free (ad->error);
clib_memset (ad, 0, sizeof (*ad));
@@ -1201,6 +1202,7 @@ avf_create_if (vlib_main_t * vm, avf_create_if_args_t * args)
pool_get (am->devices, ad);
ad->dev_instance = ad - am->devices;
ad->per_interface_next_index = ~0;
+ ad->name = vec_dup (args->name);
if (args->enable_elog)
ad->flags |= AVF_DEVICE_F_ELOG;
diff --git a/src/plugins/avf/format.c b/src/plugins/avf/format.c
index 3a1e1ff7f44..ed99e5861c8 100644
--- a/src/plugins/avf/format.c
+++ b/src/plugins/avf/format.c
@@ -31,6 +31,9 @@ format_avf_device_name (u8 * s, va_list * args)
avf_device_t *ad = vec_elt_at_index (am->devices, i);
vlib_pci_addr_t *addr = vlib_pci_get_addr (vm, ad->pci_dev_handle);
+ if (ad->name)
+ return format (s, "%s", ad->name);
+
s = format (s, "avf-%x/%x/%x/%x",
addr->domain, addr->bus, addr->slot, addr->function);
return s;