summaryrefslogtreecommitdiffstats
path: root/src/plugins/rdma
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-11-06 17:24:51 +0100
committerDamjan Marion <dmarion@me.com>2019-11-08 20:55:02 +0000
commita50892e1504401e243076f08d9077675eb0b030e (patch)
tree244cc87c44ddeaca1b4e64d834516b0aa22c501b /src/plugins/rdma
parent12989b538881f9681f078cf1485c51df1251877a (diff)
rdma: fix name auto-generation on create
When creating rdma interface without specifying a name, we need to generate one instead of NULL. Type: fix Change-Id: If41870691dec47e8e673d48ac4b4ddffd2385a03 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/rdma')
-rw-r--r--src/plugins/rdma/device.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c
index 6c48a97f5bf..422680df117 100644
--- a/src/plugins/rdma/device.c
+++ b/src/plugins/rdma/device.c
@@ -632,9 +632,13 @@ 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 = VNET_DEVICE_INPUT_NEXT_ETHERNET_INPUT;
- rd->name = format (0, "%s", args->name);
rd->linux_ifname = format (0, "%s", args->ifname);
+ if (!args->name || 0 == args->name[0])
+ rd->name = format (0, "%s/%d", args->ifname, rd->dev_instance);
+ else
+ rd->name = format (0, "%s", args->name);
+
rd->pci = vlib_pci_get_device_info (vm, &pci_addr, &args->error);
if (!rd->pci)
goto err2;