net/smc: return active RoCE port only
authorUrsula Braun <ubraun@linux.vnet.ibm.com>
Mon, 10 Apr 2017 12:57:58 +0000 (14:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Apr 2017 03:01:14 +0000 (23:01 -0400)
SMC requires an active ib port on the RoCE device.
smc_pnet_find_roce_resource() determines the matching RoCE device port
according to the configured PNET table. Do not return the found
RoCE device port, if it is not flagged active.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_pnet.c

index f1cff01599805eaa4096b7f18bf7292869d07a43..78f7af28ae4f25d71469d54d44f98ef4e2df94eb 100644 (file)
@@ -523,8 +523,11 @@ void smc_pnet_find_roce_resource(struct sock *sk,
        read_lock(&smc_pnettable.lock);
        list_for_each_entry(pnetelem, &smc_pnettable.pnetlist, list) {
                if (dst->dev == pnetelem->ndev) {
-                       *smcibdev = pnetelem->smcibdev;
-                       *ibport = pnetelem->ib_port;
+                       if (smc_ib_port_active(pnetelem->smcibdev,
+                                              pnetelem->ib_port)) {
+                               *smcibdev = pnetelem->smcibdev;
+                               *ibport = pnetelem->ib_port;
+                       }
                        break;
                }
        }