[openib-general] [PATCH] [CM] 1/2 Fix CM redirection

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


I found that CM handling for SRP is broken when handling a REJ with 
reason 24 (Port and CM Redirection) with a RedirectLID supplied.  As 
stated in the spec, if RedirectLID is non-zero, it is the DLID a 
requester _shall_ use to access the class services.  I believe that 
without this support, CM does not comply with C13-28 with respect to 
RedirectLID.  

In my testing, the following patches seem to fix the problem.  If there 
is a better way to fix the problem, I would appreciate the input.  

Summary of patches:

Part 1/2

    include/rdma/ib_cm.h:
        A new field is added to struct ib_cm_id (redirect_qpn) to hold 
        the RedirectQP number returned in the reject message.

    core/cm.c: 
        Is modified to use redirect_qpn, if it is non-zero, when calling 
        ib_create_send_mad, instead of QP1.

Part 2/2

    ulp/srp/ib_srp.h:
        A new target status is added (SRP_DLID_REDIRECT).

    ulp/srp/ib_srp.c:
        Is modified to check for RedirectLID in ClassPortInfo when it 
        receives a reject with reason IB_CM_REJ_PORT_CM_REDIRECT (reason 
        24) and to save the redirect information (RedirectLID, 
        RedirectP_Key, and RedirectQP) and set SRP_DLID_REDIRECT target 
        status.  If target status on completion of srp_send_req is 
        SRP_DLID_REDIRECT, the send request is retried with the new
        redirect information.

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

Index: ib_cm.h
===================================================================
--- ib_cm.h	(revision 3328)
+++ ib_cm.h	(working copy)
@@ -290,6 +290,7 @@ struct ib_cm_id {
 	enum ib_cm_lap_state	lap_state;	/* internal CM/debug use */
 	__be32			local_id;
 	__be32			remote_id;
+	u32			redirect_qpn;
 };
 
 /**

Index: cm.c
===================================================================
--- cm.c	(revision 3328)
+++ cm.c	(working copy)
@@ -167,13 +167,14 @@ static int cm_alloc_msg(struct cm_id_pri
 	struct ib_mad_agent *mad_agent;
 	struct ib_mad_send_buf *m;
 	struct ib_ah *ah;
+	u32    qpn = cm_id_priv->id.redirect_qpn? cm_id_priv->id.redirect_qpn: 1;
 
 	mad_agent = cm_id_priv->av.port->mad_agent;
 	ah = ib_create_ah(mad_agent->qp->pd, &cm_id_priv->av.ah_attr);
 	if (IS_ERR(ah))
 		return PTR_ERR(ah);
 
-	m = ib_create_send_mad(mad_agent, 1, cm_id_priv->av.pkey_index,
+	m = ib_create_send_mad(mad_agent, qpn, cm_id_priv->av.pkey_index,
 			       ah, 0, sizeof(struct ib_mad_hdr),
 			       sizeof(struct ib_mad)-sizeof(struct ib_mad_hdr),
 			       GFP_ATOMIC);




More information about the general mailing list