RDMA/cma: use cached port state when bind loopback
authorJack Wang <jinpu.wang@profitbricks.com>
Mon, 2 Jan 2017 12:22:05 +0000 (13:22 +0100)
committerDoug Ledford <dledford@redhat.com>
Fri, 13 Jan 2017 04:00:04 +0000 (23:00 -0500)
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: Michael Wang <yun.wang@profitbricks.com>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/cma.c

index 40e2b726aa0268caf5b4dce62b65bdca36694797..a14a18cfc8f359ff3d50967271ee69fd17253011 100644 (file)
@@ -2656,8 +2656,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;
@@ -2673,8 +2673,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;
                        }