Commit 102c5ce0 authored by Jack Wang's avatar Jack Wang Committed by Doug Ledford

RDMA/cma: use cached port state when bind loopback

Signed-off-by: default avatarJack Wang <jinpu.wang@profitbricks.com>
Reviewed-by: default avatarMichael Wang <yun.wang@profitbricks.com>
Acked-by: default avatarSean Hefty <sean.hefty@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 93b1f29d
...@@ -2656,8 +2656,8 @@ static void cma_set_loopback(struct sockaddr *addr) ...@@ -2656,8 +2656,8 @@ static void cma_set_loopback(struct sockaddr *addr)
static int cma_bind_loopback(struct rdma_id_private *id_priv) static int cma_bind_loopback(struct rdma_id_private *id_priv)
{ {
struct cma_device *cma_dev, *cur_dev; struct cma_device *cma_dev, *cur_dev;
struct ib_port_attr port_attr;
union ib_gid gid; union ib_gid gid;
enum ib_port_state port_state;
u16 pkey; u16 pkey;
int ret; int ret;
u8 p; u8 p;
...@@ -2673,8 +2673,8 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv) ...@@ -2673,8 +2673,8 @@ static int cma_bind_loopback(struct rdma_id_private *id_priv)
cma_dev = cur_dev; cma_dev = cur_dev;
for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) { for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
if (!ib_query_port(cur_dev->device, p, &port_attr) && if (!ib_get_cached_port_state(cur_dev->device, p, &port_state) &&
port_attr.state == IB_PORT_ACTIVE) { port_state == IB_PORT_ACTIVE) {
cma_dev = cur_dev; cma_dev = cur_dev;
goto port_found; goto port_found;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment