net/smc: allow PCI IDs as ib device names in the pnet table
authorHans Wippel <hwippel@linux.ibm.com>
Thu, 21 Feb 2019 12:01:03 +0000 (13:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Feb 2019 18:34:37 +0000 (10:34 -0800)
SMC-D devices are identified by their PCI IDs in the pnet table. In
order to make usage of the pnet table more consistent for users, this
patch adds this form of identification for ib devices as well.

Signed-off-by: Hans Wippel <hwippel@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_pnet.c

index 878f5c08544414af56b5da98fee96c80abea11e2..25dfbe343e262c6fbc4fa58df0ff679d669d106e 100644 (file)
@@ -293,7 +293,9 @@ static struct smc_ib_device *smc_pnet_find_ib(char *ib_name)
        spin_lock(&smc_ib_devices.lock);
        list_for_each_entry(ibdev, &smc_ib_devices.list, list) {
                if (!strncmp(ibdev->ibdev->name, ib_name,
-                            sizeof(ibdev->ibdev->name))) {
+                            sizeof(ibdev->ibdev->name)) ||
+                   !strncmp(dev_name(ibdev->ibdev->dev.parent), ib_name,
+                            IB_DEVICE_NAME_MAX - 1)) {
                        goto out;
                }
        }
@@ -394,7 +396,7 @@ static int smc_pnet_set_nla(struct sk_buff *msg,
        }
        if (pnetelem->smcibdev) {
                if (nla_put_string(msg, SMC_PNETID_IBNAME,
-                                  pnetelem->smcibdev->ibdev->name) ||
+                       dev_name(pnetelem->smcibdev->ibdev->dev.parent)) ||
                    nla_put_u8(msg, SMC_PNETID_IBPORT, pnetelem->ib_port))
                        return -1;
        } else if (pnetelem->smcd_dev) {