MFV be9130cc9: "IB/cma: Check for GID on listening devices first"
This is an optimization that improves IB connection setup times. Discussed with: hselasky Obtained from: Linux MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
82f1d3ea2f
commit
4e071758a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=303636
@ -479,7 +479,8 @@ rdma_find_cmid_laddr(struct sockaddr_in *local_addr, unsigned short dev_type,
|
||||
}
|
||||
EXPORT_SYMBOL(rdma_find_cmid_laddr);
|
||||
|
||||
static int cma_acquire_dev(struct rdma_id_private *id_priv)
|
||||
static int cma_acquire_dev(struct rdma_id_private *id_priv,
|
||||
struct rdma_id_private *listen_id_priv)
|
||||
{
|
||||
struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
|
||||
struct cma_device *cma_dev;
|
||||
@ -499,8 +500,30 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv)
|
||||
|
||||
memcpy(&gid, dev_addr->src_dev_addr +
|
||||
rdma_addr_gid_offset(dev_addr), sizeof gid);
|
||||
if (listen_id_priv &&
|
||||
rdma_port_get_link_layer(listen_id_priv->id.device,
|
||||
listen_id_priv->id.port_num) == dev_ll) {
|
||||
cma_dev = listen_id_priv->cma_dev;
|
||||
port = listen_id_priv->id.port_num;
|
||||
if (rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
|
||||
rdma_port_get_link_layer(cma_dev->device, port) == IB_LINK_LAYER_ETHERNET)
|
||||
ret = ib_find_cached_gid(cma_dev->device, &iboe_gid,
|
||||
&found_port, NULL);
|
||||
else
|
||||
ret = ib_find_cached_gid(cma_dev->device, &gid,
|
||||
&found_port, NULL);
|
||||
|
||||
if (!ret && (port == found_port)) {
|
||||
id_priv->id.port_num = found_port;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
list_for_each_entry(cma_dev, &dev_list, list) {
|
||||
for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port)
|
||||
for (port = 1; port <= cma_dev->device->phys_port_cnt; ++port) {
|
||||
if (listen_id_priv &&
|
||||
listen_id_priv->cma_dev == cma_dev &&
|
||||
listen_id_priv->id.port_num == port)
|
||||
continue;
|
||||
if (rdma_port_get_link_layer(cma_dev->device, port) == dev_ll) {
|
||||
if (rdma_node_get_transport(cma_dev->device->node_type) == RDMA_TRANSPORT_IB &&
|
||||
rdma_port_get_link_layer(cma_dev->device, port) == IB_LINK_LAYER_ETHERNET)
|
||||
@ -514,6 +537,7 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv)
|
||||
} else if (ret == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
@ -1423,7 +1447,7 @@ static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
|
||||
}
|
||||
|
||||
mutex_lock_nested(&conn_id->handler_mutex, SINGLE_DEPTH_NESTING);
|
||||
ret = cma_acquire_dev(conn_id);
|
||||
ret = cma_acquire_dev(conn_id, listen_id);
|
||||
if (ret)
|
||||
goto err2;
|
||||
|
||||
@ -1656,7 +1680,7 @@ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = cma_acquire_dev(conn_id);
|
||||
ret = cma_acquire_dev(conn_id, listen_id);
|
||||
if (ret) {
|
||||
mutex_unlock(&conn_id->handler_mutex);
|
||||
rdma_destroy_id(new_cm_id);
|
||||
@ -2218,7 +2242,7 @@ static void addr_handler(int status, struct sockaddr *src_addr,
|
||||
memcpy(&id_priv->id.route.addr.src_addr, src_addr,
|
||||
ip_addr_size(src_addr));
|
||||
if (!status && !id_priv->cma_dev)
|
||||
status = cma_acquire_dev(id_priv);
|
||||
status = cma_acquire_dev(id_priv, NULL);
|
||||
|
||||
if (status) {
|
||||
if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED,
|
||||
@ -2744,7 +2768,7 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
|
||||
if (ret)
|
||||
goto err1;
|
||||
|
||||
ret = cma_acquire_dev(id_priv);
|
||||
ret = cma_acquire_dev(id_priv, NULL);
|
||||
if (ret)
|
||||
goto err1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user