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

John Kingman kingman at storagegear.com
Wed Sep 7 10:09:36 PDT 2005


SRP changes to handle IB_CM_REJ_PORT_CM_REDIRECT with RedirectLID.

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

Index: ib_srp.h
===================================================================
--- ib_srp.h	(revision 3328)
+++ ib_srp.h	(working copy)
@@ -49,6 +49,7 @@
 
 enum {
 	SRP_PORT_REDIRECT	= 1,
+	SRP_DLID_REDIRECT	= 2,
 
 	SRP_MAX_IU_LEN		= 256,
 
Index: ib_srp.c
===================================================================
--- ib_srp.c	(revision 3328)
+++ ib_srp.c	(working copy)
@@ -738,15 +738,38 @@ static int srp_cm_handler(struct ib_cm_i
 		comp = 1;
 
 		if (event->param.rej_rcvd.reason == IB_CM_REJ_PORT_CM_REDIRECT) {
-			/*
-			 * Additional Reject Info contains
-			 * ClassPortInfo, which has the RedirectGID
-			 * field at an offset of 8 bytes.
-			 */
-			memcpy(target->path.dgid.raw,
-			       event->param.rej_rcvd.ari + 8, 16);
+			/* 
+			 * Additional Reject Info contains ClassPortInfo, which has
+			 * the RedirectGID field at an offset of 8 bytes,
+			 * the RedirectLID field at an offset of 28 bytes, 
+			 * the RedirectP_Key field at an offset of 30 bytes, and
+			 * the RedirectQP field at an offset of 33 bytes.
+			 */
+			target->path.dlid = *(__be16 *)(event->param.rej_rcvd.ari + 28);
+			target->path.pkey = *(__be16 *)(event->param.rej_rcvd.ari + 30);
+			cm_id->redirect_qpn = 
+				be32_to_cpu(*(u32 *)(event->param.rej_rcvd.ari + 32)) 
+				& 0x00ffffff;
+			if (target->path.dlid) {
+				/* 
+				 * If RedirectLID is non-zero, it is the DLID a 
+				 * requester shall use to access the class services.
+				 */
+				target->status = SRP_DLID_REDIRECT;
+			} else {
+				/*
+				 * If the RedirectLID value is zero, the redirect 
+				 * requires the requester to use the supplied 
+				 * RedirectGID to request further path resolution 
+				 * from subnet administration.  
+				 */
+				memcpy(target->path.dgid.raw,
+				       event->param.rej_rcvd.ari + 8, 16);
 
-			target->status = SRP_PORT_REDIRECT;
+				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) {
@@ -1230,6 +1253,7 @@ retry_path:
 		goto err;
 	}
 
+retry_send:
 	init_completion(&target->done);
 	ret = srp_send_req(target);
 	if (ret)
@@ -1240,9 +1264,12 @@ retry_path:
 	/*
 	 * The CM event handling code will set status to
 	 * 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