[ofa-general] [RFC] [PATCH 3/3] 2.6.22 or 23 rdma/cm: check cache for path records

Sean Hefty sean.hefty at intel.com
Thu Apr 19 17:06:46 PDT 2007


RDMA/cma: use local SA cache for path queries

From: Sean Hefty <sean.hefty at intel.com>

Have the rdma_cm check the local SA cache for path records before
querying the remote SA.  This improves path record lookup time and
scale-out connection rates.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---

 drivers/infiniband/core/cma.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index fde92ce..c8e2024 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -45,6 +45,7 @@
 #include <rdma/ib_cm.h>
 #include <rdma/ib_sa.h>
 #include <rdma/iw_cm.h>
+#include <rdma/ib_local_sa.h>
 
 MODULE_AUTHOR("Sean Hefty");
 MODULE_DESCRIPTION("Generic RDMA CM Agent");
@@ -1529,6 +1530,7 @@ out:
 static int cma_resolve_ib_route(struct rdma_id_private *id_priv, int timeout_ms)
 {
 	struct rdma_route *route = &id_priv->id.route;
+	struct rdma_dev_addr *addr = &id_priv->id.route.addr.dev_addr;
 	struct cma_work *work;
 	int ret;
 
@@ -1548,9 +1550,20 @@ static int cma_resolve_ib_route(struct rdma_id_private *id_priv,
int timeout_ms)
 		goto err1;
 	}
 
-	ret = cma_query_ib_route(id_priv, timeout_ms, work);
-	if (ret)
-		goto err2;
+	ib_addr_get_sgid(addr, &route->path_rec->sgid);
+	ib_addr_get_dgid(addr, &route->path_rec->dgid);
+	ret = ib_get_path_rec(id_priv->id.device, id_priv->id.port_num,
+			      &route->path_rec->sgid, &route->path_rec->dgid,
+			      ib_addr_get_pkey(addr), route->path_rec);
+	if (!ret) {
+		route->num_paths = 1;
+		queue_work(cma_wq, &work->work);
+	} else {
+		if (ret == -ENODATA)
+			ret = cma_query_ib_route(id_priv, timeout_ms, work);
+		if (ret)
+			goto err2;
+	}
 
 	return 0;
 err2:




More information about the general mailing list