[ofa-general] [RFC] [PATCH 3/3] 2.6.23: RDMA/cma: Add support for routed paths

Sean Hefty sean.hefty at intel.com
Fri May 18 15:18:37 PDT 2007


In order to support IB-to-IB routers, we need to provide path 
information about the remote subnet to the ib_cm.  For now, we
simply copy our local path information, but use permissive LIDs
in place of the actual, remote LIDs.  This indicates to the
remote ib_cm that it should use the LIDs/SL data from the LRH
received with CM REQ in place of the actual data carried in the
REQ message when configuring the remote QP.

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

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

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index fde92ce..430f104 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2170,7 +2170,19 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
 		goto out;
 	req.private_data = private_data;
 
-	req.primary_path = &route->path_rec[0];
+	if (route->path_rec[0].hop_limit > 1) {
+		req.primary_path = kmalloc(sizeof *req.primary_path * 2,
+					   GFP_ATOMIC);
+		if (!req.primary_path) {
+			ret = -ENOMEM;
+			goto out;
+		}
+		req.primary_path[0] = route->path_rec[0];
+		req.primary_path[1] = route->path_rec[0];
+		req.primary_path[1].slid = IB_LID_PERMISSIVE;
+		req.primary_path[1].dlid = IB_LID_PERMISSIVE;
+	} else
+		req.primary_path = &route->path_rec[0];
 	if (route->num_paths == 2)
 		req.alternate_path = &route->path_rec[1];
 
@@ -2190,6 +2202,9 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
 	req.srq = id_priv->srq ? 1 : 0;
 
 	ret = ib_send_cm_req(id_priv->cm_id.ib, &req);
+
+	if (route->path_rec[0].hop_limit > 1)
+		kfree(req.primary_path);
 out:
 	if (ret && !IS_ERR(id_priv->cm_id.ib)) {
 		ib_destroy_cm_id(id_priv->cm_id.ib);




More information about the general mailing list