aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-03-28 23:34:56 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-03-29 00:23:57 +0000
commit96d4e533638f585feb606e04b837396be5c503ed (patch)
tree482e4d10c12c0bc22e4badc71e35c965e395d796 /src
parenta03d18238350f9941357caca28957395ad737810 (diff)
rdma: add option to specify inteface name
Change-Id: Ic6244511b88bdd42756f74e3163a70b8014e8547 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/rdma/cli.c7
-rw-r--r--src/plugins/rdma/device.c2
-rw-r--r--src/plugins/rdma/format.c3
-rw-r--r--src/plugins/rdma/rdma.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/rdma/cli.c b/src/plugins/rdma/cli.c
index 8919603e293..e1ccbb66c0b 100644
--- a/src/plugins/rdma/cli.c
+++ b/src/plugins/rdma/cli.c
@@ -41,7 +41,9 @@ rdma_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
{
- if (unformat (line_input, "name %s", &args.ifname))
+ if (unformat (line_input, "host-if %s", &args.ifname))
+ ;
+ else if (unformat (line_input, "name %s", &args.name))
;
else
return clib_error_return (0, "unknown input `%U'",
@@ -52,6 +54,7 @@ rdma_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
rdma_create_if (vm, &args);
vec_free (args.ifname);
+ vec_free (args.name);
return args.error;
}
@@ -59,7 +62,7 @@ rdma_create_command_fn (vlib_main_t * vm, unformat_input_t * input,
/* *INDENT-OFF* */
VLIB_CLI_COMMAND (rdma_create_command, static) = {
.path = "create interface rdma",
- .short_help = "create interface rdma <name ifname>",
+ .short_help = "create interface rdma <host-if ifname> [name <name>]",
.function = rdma_create_command_fn,
};
/* *INDENT-ON* */
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c
index 31112a923d0..4098d3c8bb2 100644
--- a/src/plugins/rdma/device.c
+++ b/src/plugins/rdma/device.c
@@ -248,6 +248,7 @@ rdma_dev_cleanup (rdma_device_t * rd)
vec_free (rd->rxqs);
vec_free (rd->txqs);
+ vec_free (rd->name);
pool_put (rm->devices, rd);
}
@@ -430,6 +431,7 @@ rdma_create_if (vlib_main_t * vm, rdma_create_if_args_t * args)
pool_get_zero (rm->devices, rd);
rd->dev_instance = rd - rm->devices;
rd->per_interface_next_index = ~0;
+ rd->name = vec_dup (args->name);
/* check if device exist and if it is bound to mlx5_core */
s = format (s, "/sys/class/net/%s/device/driver/module%c", args->ifname, 0);
diff --git a/src/plugins/rdma/format.c b/src/plugins/rdma/format.c
index 7ef65d43957..fbd40676639 100644
--- a/src/plugins/rdma/format.c
+++ b/src/plugins/rdma/format.c
@@ -29,6 +29,9 @@ format_rdma_device_name (u8 * s, va_list * args)
rdma_main_t *rm = &rdma_main;
rdma_device_t *rd = vec_elt_at_index (rm->devices, i);
+ if (rd->name)
+ return format (s, "%s", rd->name);
+
s = format (s, "rdma-%u", rd->dev_instance);
return s;
}
diff --git a/src/plugins/rdma/rdma.h b/src/plugins/rdma/rdma.h
index 860ddaba2b1..12901536897 100644
--- a/src/plugins/rdma/rdma.h
+++ b/src/plugins/rdma/rdma.h
@@ -73,6 +73,7 @@ typedef struct
u8 hwaddr[6];
vlib_pci_addr_t pci_addr;
+ u8 *name;
struct ibv_context *ctx;
struct ibv_pd *pd;
@@ -95,6 +96,7 @@ extern rdma_main_t rdma_main;
typedef struct
{
u8 *ifname;
+ u8 *name;
/* return */
int rv;