[ofw] [PATCH] Change how private data is cached in the CEP

Leonid Keller leonid at mellanox.co.il
Wed Jul 2 03:32:52 PDT 2008


I've removed debug prints after removed parts of code.
Applied in 1318. Thank you.

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Fab Tillier
> Sent: Tuesday, July 01, 2008 9:15 PM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] [PATCH] Change how private data is cached in the CEP
> 
> The NetworkDirect connection model (and WinVerbs too) uses an 
> asynchronous notification mechanism whereby the client is 
> notified of an event, and then retrieves the event data 
> (private data) in a separate call.
> 
> The current code is a bit convoluted, where the NetworkDirect 
> proxy upon getting a CEP callback will call into the CEP 
> manager to store the private data (for active side clients 
> where callbacks are used, as well as for disconnection for 
> all connections) that it was just handed, and internally to 
> the CEP manager when handling REQs for listen requests when a 
> UAL_CEP_GET_REQ_CID IRP is about to be completed.
> 
> This patch changes when the private data is stored to when 
> the CM MAD is received and processed.  This makes the code 
> more consistent and simpler.
> 
> Signed-off-by: Fab Tillier <ftillier at microsoft.com>
> 
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\al_cm_cep.h trunk\core\al\al_cm_cep.h
> --- old\core\al\al_cm_cep.h     Tue Jul 01 10:36:06 2008
> +++ trunk\core\al\al_cm_cep.h   Tue Jul 01 10:46:33 2008
> @@ -287,13 +287,6 @@ al_cep_get_pdata(
>         IN      OUT                     uint8_t               
>                           *p_psize,
>                 OUT                     uint8_t*              
>                           pdata );
> 
> -ib_api_status_t
> -al_cep_set_pdata(
> -       IN                              ib_al_handle_t 
> FUNC_PTR64                               h_al,
> -       IN                              net32_t               
>                           cid,
> -       IN                              uint8_t               
>                           psize,
> -       IN                              uint8_t*              
>                           pdata );
> -
>  #endif /* CL_KERNEL */
> 
> 
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\kernel\al_cm_cep.c trunk\core\al\kernel\al_cm_cep.c
> --- old\core\al\kernel\al_cm_cep.c      Tue Jul 01 10:46:50 2008
> +++ trunk\core\al\kernel\al_cm_cep.c    Tue Jul 01 10:46:33 2008
> @@ -847,6 +847,10 @@ __save_wire_req(
>         /* TODO: Do need to support CM handoff? */
>         //p_cep->mads.req = *p_req;
> 
> +    /* Cache the private data. */
> +       p_cep->psize = IB_REQ_PDATA_SIZE;
> +       memcpy( p_cep->pdata, p_req->pdata, IB_REQ_PDATA_SIZE );
> +
>         AL_EXIT( AL_DBG_CM );
>  }
> 
> @@ -978,6 +982,10 @@ __process_rej:
>                 return IB_NO_MATCH;
>         }
> 
> +    /* Cache the private data. */
> +       p_cep->psize = IB_REJ_PDATA_SIZE;
> +       memcpy( p_cep->pdata, p_rej->pdata, IB_REJ_PDATA_SIZE );
> +
>         status = __cep_queue_mad( p_cep, p_mad );
> 
>         AL_EXIT( AL_DBG_CM );
> @@ -1264,6 +1272,10 @@ __save_wire_rep(
> 
>         p_cep->sq_psn = conn_rep_get_starting_psn( p_rep );
> 
> +    /* Cache the private data. */
> +       p_cep->psize = IB_REP_PDATA_SIZE;
> +       memcpy( p_cep->pdata, p_rep->pdata, IB_REP_PDATA_SIZE );
> +
>         AL_EXIT( AL_DBG_CM );
>  }
> 
> @@ -3380,36 +3392,6 @@ __complete_ndi_irp(
>         ib_put_mad( p_mad );
>  }
> 
> -static ib_api_status_t
> -__cep_set_pdata(
> -       IN                              ib_al_handle_t 
> FUNC_PTR64                               h_al,
> -       IN                              net32_t               
>                           cid,
> -       IN                              uint8_t               
>                           psize,
> -       IN                              uint8_t*              
>                           pdata )
> -{
> -       kcep_t                          *p_cep;
> -
> -       AL_ENTER( AL_DBG_CM );
> -
> -       CL_ASSERT( h_al );
> -
> -       p_cep = __lookup_cep( h_al, cid );
> -       if( !p_cep )
> -       {
> -               AL_EXIT( AL_DBG_CM );
> -               return IB_INVALID_HANDLE;
> -       }
> -       cl_memclr( p_cep->pdata, sizeof(p_cep->pdata) );
> -       p_cep->psize = min( psize, sizeof(p_cep->pdata) );
> -       memcpy( p_cep->pdata, pdata, p_cep->psize );
> -       AL_PRINT(TRACE_LEVEL_INFORMATION ,AL_DBG_CM ,
> -               ("__cep_set_pdata: set %d of pdata for cid 
> %d, h_al %p, context %p \n",
> -               p_cep->psize, cid, h_al, p_cep->context ));
> -
> -       AL_EXIT( AL_DBG_CM );
> -       return IB_SUCCESS;
> -}
> -
>  /* Called with the CEP and CEP manager locks held */  static 
> ib_api_status_t  __cep_queue_mad( @@ -3454,11 +3436,7 @@ 
> __cep_queue_mad(
>                         // get IRP
>                         p_list_entry = RemoveHeadList( 
> &p_cep->irp_que );
>                         p_irp = (PIRP)CONTAINING_RECORD( 
> p_list_entry, IRP, Tail.Overlay.ListEntry );
> -
> -                       // store REQ private data
> -                       __cep_set_pdata(
> -                               (ib_al_handle_t 
> VOID_PTR64)p_irp->Tail.Overlay.DriverContext[1],
> -                               p_new_cep->cid, 
> sizeof(p_req->pdata), (uint8_t*)p_req->pdata );
> +
>                         AL_PRINT(TRACE_LEVEL_ERROR ,AL_DBG_ERROR ,
>                                 ("set %d of REQ pdata to CEP 
> with cid %d, h_al %p\n",
>                                 sizeof(p_req->pdata), 
> p_new_cep->cid, @@ -6385,8 +6363,7 @@ al_cep_get_cid(
>         /* store REQ private data */
>         p_req = (mad_cm_req_t*)ib_get_mad_buf( p_mad );
>         p_new_cep = (kcep_t*)p_mad->send_context1;
> -       __cep_set_pdata( h_al, p_new_cep->cid,
> -               sizeof(p_req->pdata), (uint8_t*)p_req->pdata );
> +
>         AL_PRINT(TRACE_LEVEL_ERROR ,AL_DBG_ERROR ,
>                 ("set %d of REQ pdata to CEP with cid %d, h_al %p\n",
>                 sizeof(p_req->pdata), p_new_cep->cid, h_al 
> )); @@ -6452,28 +6429,6 @@ al_cep_get_pdata(
>                 p_cep->psize, cid, h_al, p_cep->context ));
> 
>         KeReleaseInStackQueuedSpinLock( &hdl );
> -       AL_EXIT( AL_DBG_CM );
> -       return IB_SUCCESS;
> -}
> -
> -ib_api_status_t
> -al_cep_set_pdata(
> -       IN                              ib_al_handle_t 
> FUNC_PTR64                               h_al,
> -       IN                              net32_t               
>                           cid,
> -       IN                              uint8_t               
>                           psize,
> -       IN                              uint8_t*              
>                           pdata )
> -{
> -       ib_api_status_t         status;
> -       KLOCK_QUEUE_HANDLE      hdl;
> -
> -       AL_ENTER( AL_DBG_CM );
> -
> -       CL_ASSERT( h_al );
> -
> -       KeAcquireInStackQueuedSpinLock( &gp_cep_mgr->lock, &hdl );
> -       status = __cep_set_pdata( h_al, cid, psize, pdata );
> -       KeReleaseInStackQueuedSpinLock( &hdl );
> -
>         AL_EXIT( AL_DBG_CM );
>         return IB_SUCCESS;
>  }
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\kernel\al_ndi_cm.c trunk\core\al\kernel\al_ndi_cm.c
> --- old\core\al\kernel\al_ndi_cm.c      Tue Jul 01 10:46:50 2008
> +++ trunk\core\al\kernel\al_ndi_cm.c    Tue Jul 01 10:46:33 2008
> @@ -571,10 +571,6 @@ __ndi_proc_rej(
>         switch (p_ndi_csq->state)
>         {
>         case NDI_CM_CONNECTING_REQ_SENT:
> -               al_cep_set_pdata( p_cm->h_al, p_cm->cid, 
> IB_REJ_PDATA_SIZE, (uint8_t*)p_rej->pdata );
> -               AL_PRINT(TRACE_LEVEL_INFORMATION, AL_DBG_NDI ,
> -                       ("set %d of REQ pdata to CEP with cid 
> %d, h_al %p\n",
> -                       IB_REJ_PDATA_SIZE, p_cm->cid, p_cm->h_al ));
>                 status = (p_rej->reason == IB_REJ_TIMEOUT) ? 
> STATUS_TIMEOUT : STATUS_CONNECTION_REFUSED;
>                 __ndi_complete_irp_ex( h_qp, status, 
> NDI_CM_CONNECTING_REJ_RCVD );
>                 break;
> @@ -643,6 +639,8 @@ __ndi_proc_rep(
> 
>         AL_ENTER( AL_DBG_NDI );
> 
> +    UNREFERENCED_PARAMETER( p_rep );
> +
>         AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI ,("h_qp 
> = 0x%p\n", p_cm->h_qp));
> 
>         if ( p_ndi_csq->state  != NDI_CM_CONNECTING_REQ_SENT) 
> @@ -654,12 +652,6 @@ __ndi_proc_rep(
>                 goto exit;
>         }
> 
> -       /* fill the rej data */
> -       al_cep_set_pdata( p_cm->h_al, p_cm->cid, 
> IB_REJ_PDATA_SIZE, p_rep->pdata );
> -       AL_PRINT(TRACE_LEVEL_ERROR ,AL_DBG_ERROR ,
> -               ("set %d of REQ pdata to CEP with cid %d, h_al %p\n",
> -               IB_REJ_PDATA_SIZE, p_cm->cid, p_cm->h_al ));
> -
>         __ndi_complete_irp_ex( p_cm->h_qp, STATUS_SUCCESS, 
> NDI_CM_CONNECTING_REP_RCVD );
> 
>  exit:
> 



More information about the ofw mailing list