svn commit: r303636 - head/sys/ofed/drivers/infiniband/core
Mark Johnston
markj at FreeBSD.org
Mon Aug 1 20:29:10 UTC 2016
Author: markj
Date: Mon Aug 1 20:29:09 2016
New Revision: 303636
URL: https://svnweb.freebsd.org/changeset/base/303636
Log:
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
Modified:
head/sys/ofed/drivers/infiniband/core/cma.c
Modified: head/sys/ofed/drivers/infiniband/core/cma.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:27:11 2016 (r303635)
+++ head/sys/ofed/drivers/infiniband/core/cma.c Mon Aug 1 20:29:09 2016 (r303636)
@@ -479,7 +479,8 @@ err:
}
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_i
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_i
} else if (ret == 1)
break;
}
+ }
}
out:
@@ -1423,7 +1447,7 @@ static int cma_req_handler(struct ib_cm_
}
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
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, str
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
if (ret)
goto err1;
- ret = cma_acquire_dev(id_priv);
+ ret = cma_acquire_dev(id_priv, NULL);
if (ret)
goto err1;
}
More information about the svn-src-head
mailing list