[openib-general] [PATCH] [SRP] Fix CM redirection in SRP

John Kingman kingman at storagegear.com
Sat Sep 10 15:16:47 PDT 2005


On Fri, 9 Sep 2005, Roland Dreier wrote:
<snip>
>Once I get that done (should happen today), please respin your patch,
>test with your target and resend.

Here is the updated and tested patch.  I believe all of the other 
changes have been committed.

Signed-off-by: John Kingman <kingman <at> storagegear.com>

Index: ib_srp.h
===================================================================
--- ib_srp.h	(revision 3359)
+++ ib_srp.h	(working copy)
@@ -52,6 +52,7 @@ enum {
 	SRP_ABORT_TIMEOUT_MS	= 5000,
 
 	SRP_PORT_REDIRECT	= 1,
+	SRP_DLID_REDIRECT	= 2,
 
 	SRP_MAX_IU_LEN		= 256,
 
Index: ib_srp.c
===================================================================
--- ib_srp.c	(revision 3359)
+++ ib_srp.c	(working copy)
@@ -1028,11 +1028,18 @@ static int srp_cm_handler(struct ib_cm_i
 	case IB_CM_REJ_RECEIVED:
 		printk(KERN_DEBUG PFX "REJ received\n");
 		comp = 1;
+		cpi = event->param.rej_rcvd.ari;
 
 		if (event->param.rej_rcvd.reason == IB_CM_REJ_PORT_CM_REDIRECT) {
-			cpi = event->param.rej_rcvd.ari;
-			memcpy(target->path.dgid.raw, cpi->redirect_gid, 16);
-			target->status = SRP_PORT_REDIRECT;
+			target->path.dlid = cpi->redirect_lid;
+			target->path.pkey = cpi->redirect_pkey;
+			cm_id->remote_cm_qpn = be32_to_cpu(cpi->redirect_qp) & 0x00ffffff;
+			if (target->path.dlid) {
+				target->status = SRP_DLID_REDIRECT;
+			} else {
+				memcpy(target->path.dgid.raw, cpi->redirect_gid, 16);
+				target->status = SRP_PORT_REDIRECT;
+			}
 		} else if (topspin_workarounds &&
 			   !memcmp(&target->ioc_guid, topspin_oui, 3) &&
 			   event->param.rej_rcvd.reason == IB_CM_REJ_PORT_REDIRECT) {
@@ -1041,8 +1048,7 @@ static int srp_cm_handler(struct ib_cm_i
 			 * reject reason code 25 when they mean 24
 			 * (port redirect).
 			 */
-			memcpy(target->path.dgid.raw,
-			       event->param.rej_rcvd.ari + 0, 16);
+			memcpy(target->path.dgid.raw, cpi->redirect_gid, 16);
 
 			printk(KERN_DEBUG PFX "Topspin/Cisco redirect to target port GID %016llx%016llx\n",
 			       (unsigned long long) be64_to_cpu(target->path.dgid.global.subnet_prefix),
@@ -1393,6 +1399,7 @@ retry_path:
 		goto err;
 	}
 
+retry_send:
 	init_completion(&target->done);
 	ret = srp_send_req(target);
 	if (ret)
@@ -1401,10 +1408,13 @@ retry_path:
 
 	/*
 	 * The CM event handling code will set status to
-	 * SRP_PORT_REDIRECT if we get a port redirect REJ back.
+	 * SRP_PORT_REDIRECT if we get a port redirect REJ back,
+	 * or SRP_DLID_REDIRECT if we get a lid/qp redirect REJ back.
 	 */
 	if (target->status == SRP_PORT_REDIRECT)
 		goto retry_path;
+	else if (target->status == SRP_DLID_REDIRECT)
+		goto retry_send;
 	else if (target->status < 0) {
 		printk(KERN_ERR PFX "Connection failed\n");
 		ret = target->status;



More information about the general mailing list