diff options
author | Benoît Ganne <bganne@cisco.com> | 2019-11-06 17:24:51 +0100 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2019-11-18 13:32:59 +0000 |
commit | 061e8671a776c13c065a8bed77e300f96cd5d2c4 (patch) | |
tree | 8511de6d394103ea7032f59f34621913b31f7555 /src/plugins | |
parent | 4cf238b9d70ea3f662f7cc969966b41ae08c8283 (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>
(cherry picked from commit a50892e1504401e243076f08d9077675eb0b030e)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/rdma/device.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/rdma/device.c b/src/plugins/rdma/device.c index 23887eaf253..70720e4df74 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; |