Unify formatting QP INIT parameters in CEP manager.

Currently, the CEP manager has different logic for formatting the QP INIT 
parameters between al_cep_pre_rep and al_cep_get_init_attr.  This patch unifies 
the QP INIT parameters returned by the two functions.  The key difference is in 
the access_ctrl returned by al_cep_pre_rep, in that they will enable RDMA 
writes always, as well as enable RDMA reads and atomic operations if responder 
resources are being provided by the peer.

Signed-off-by: Fab Tillier <[email protected]>

diff -dwup3 -x *svn* -x *makefile.inc -x *sources -r 
c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm_cep.c 
.\core\al\kernel\al_cm_cep.c
--- c:\dev\openib\ofw\gen1\branches\mlx4_30\trunk\core\al\kernel\al_cm_cep.c    
Fri Aug 03 12:58:50 2012
+++ .\core\al\kernel\al_cm_cep.c        Mon Jul 30 22:23:51 2012
@@ -5021,6 +5112,27 @@ __format_rep(
 }
 
 
+static void
+__al_cep_fill_init_attr(
+       __in kcep_t *p_cep,
+       __out ib_qp_mod_t* p_init
+       )
+{
+       /* Format the INIT qp modify attributes. */
+       cl_memclr(p_init, sizeof(*p_init));
+       p_init->req_state = IB_QPS_INIT;
+       p_init->state.init.primary_port =
+               p_cep->av[p_cep->idx_primary].attr.port_num;
+       p_init->state.init.qkey = 0;
+       p_init->state.init.pkey_index =
+               p_cep->av[p_cep->idx_primary].pkey_index;
+       p_init->state.init.access_ctrl = IB_AC_LOCAL_WRITE | IB_AC_RDMA_WRITE;
+       if ( p_cep->resp_res )
+       {
+               p_init->state.init.access_ctrl |= IB_AC_RDMA_READ | 
IB_AC_ATOMIC;
+       }
+}
+
 
 static ib_api_status_t
 __al_cep_pre_rep(
@@ -5065,14 +5177,9 @@ __al_cep_pre_rep(
                /* Format the INIT qp modify attributes. */
                if( p_init )
                {
-                       p_init->req_state = IB_QPS_INIT;
-                       p_init->state.init.primary_port =
-                               p_cep->av[p_cep->idx_primary].attr.port_num;
-                       p_init->state.init.qkey = 0;
-                       p_init->state.init.pkey_index =
-                               p_cep->av[p_cep->idx_primary].pkey_index;
-                       p_init->state.init.access_ctrl = IB_AC_LOCAL_WRITE;
+                       __al_cep_fill_init_attr(p_cep, p_init);
                }
+
                /* Just OR in the PREP bit into the state. */
                p_cep->state |= CEP_STATE_PREP;
                break;
@@ -6222,7 +6329,7 @@ kal_cep_format_event(
                }
                break;
        case CM_APR_ATTR_ID:
-               p_event->type = iba_cm_apr_received;;
+               p_event->type = iba_cm_apr_received;
                // TODO: format apr event
                break;
        case CM_SIDR_REQ_ATTR_ID:
@@ -6278,17 +6385,7 @@ al_cep_get_init_attr(
        case CEP_STATE_REP_MRA_SENT:
        case CEP_STATE_ESTABLISHED:
                /* Format the INIT qp modify attributes. */
-               cl_memclr(p_init, sizeof(ib_qp_mod_t));
-               p_init->req_state = IB_QPS_INIT;
-               p_init->state.init.primary_port =
-                       p_cep->av[p_cep->idx_primary].attr.port_num;
-               p_init->state.init.pkey_index =
-                       p_cep->av[p_cep->idx_primary].pkey_index;
-               p_init->state.init.access_ctrl = IB_AC_LOCAL_WRITE | 
IB_AC_RDMA_WRITE;
-               if ( p_cep->resp_res )
-               {
-                       p_init->state.init.access_ctrl |= IB_AC_RDMA_READ | 
IB_AC_ATOMIC;
-               }
+               __al_cep_fill_init_attr(p_cep, p_init);
                status = IB_SUCCESS;
                break;
        default:
@@ -6617,8 +6714,6 @@ al_cep_queue_irp(
        return STATUS_PENDING;
 }
 
-//debug
-#include "bus_stat.h"
 
 void
 al_cep_cleanup_al(
@@ -6648,19 +6743,6 @@ al_cep_cleanup_al(
                 */
                cid = PARENT_STRUCT( p_item, kcep_t, al_item )->cid;
                cl_spinlock_release( &h_al->obj.lock );
-
-               // debug
-               // allow to IBAL to remove CEP Manager
-               if ( KeGetCurrentIrql() == PASSIVE_LEVEL )
-                       cl_thread_suspend(1000);
-               // if it is removed - assert
-               if ( !gp_cep_mgr ) {
-                       AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_CM, ("BUG!!! Trying 
to release CEPs after destroying CEP manager\n") );
-                       g_post_event("IBAL: al_cep_cleanup_al: BUG!!! Trying to 
release CEPs after destroying CEP manager.\n");
-                       ASSERT(0);
-                       break;
-               }
-               
                al_destroy_cep( h_al, &cid, FALSE );
                cl_spinlock_acquire( &h_al->obj.lock );
        }

Attachment: ndv2.20.patch
Description: ndv2.20.patch

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to