diff mbox

[4/4] cma: use cached port state when bind loopback

Message ID CAMGffEkCsD1_jAEjrCSuBSnGRZksup=Mjv_A=Nte=wcDKVJT0Q@mail.gmail.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Jinpu Wang Dec. 12, 2016, 11:49 a.m. UTC
From f2083c81f7738841cc696feda5f0ff5a96beeb01 Mon Sep 17 00:00:00 2001
From: Jack Wang <jinpu.wang@profitbricks.com>
Date: Mon, 12 Dec 2016 10:29:00 +0100
Subject: [PATCH 4/4] cma: use cached port state when bind loopback

Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Michael Wang <yun.wang@profitbricks.com>
---
 drivers/infiniband/core/cma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

             }

Comments

Hefty, Sean Dec. 19, 2016, 5:30 p.m. UTC | #1
QWNrZWQtYnk6IFNlYW4gSGVmdHkgPHNlYW4uaGVmdHlAaW50ZWwuY29tPg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 3413aec..f57d017 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2613,8 +2613,8 @@  static void cma_set_loopback(struct sockaddr *addr)
 static int cma_bind_loopback(struct rdma_id_private *id_priv)
 {
     struct cma_device *cma_dev, *cur_dev;
-    struct ib_port_attr port_attr;
     union ib_gid gid;
+    enum ib_port_state port_state;
     u16 pkey;
     int ret;
     u8 p;
@@ -2630,8 +2630,8 @@  static int cma_bind_loopback(struct
rdma_id_private *id_priv)
             cma_dev = cur_dev;

         for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
-            if (!ib_query_port(cur_dev->device, p, &port_attr) &&
-                port_attr.state == IB_PORT_ACTIVE) {
+            if (!ib_get_cached_port_state(cur_dev->device, p, &port_state) &&
+                port_state == IB_PORT_ACTIVE) {
                 cma_dev = cur_dev;
                 goto port_found;