From a50892e1504401e243076f08d9077675eb0b030e Mon Sep 17 00:00:00 2001 From: Benoît Ganne Date: Wed, 6 Nov 2019 17:24:51 +0100 Subject: rdma: fix name auto-generation on create MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/plugins/rdma/device.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/rdma') 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; -- cgit 1.2.3-korg