[ofw] [PATCH] Remove ATS dependency from ND proxy

Leonid Keller leonid at mellanox.co.il
Wed Jul 9 05:17:38 PDT 2008


Aplied in 1357. Thank you. 

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Fab Tillier
> Sent: Wednesday, July 09, 2008 2:24 AM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] [PATCH] Remove ATS dependency from ND proxy
> 
> This patch removes ATS queries from the ND proxy, with the 
> anticipation that all address translation will be done by the 
> caller (via the IBAT library).
> 
> Signed-off-by: Fab Tillier <ftillier at microsoft.com>
> 
> 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 08 16:16:13 2008
> +++ trunk\core\al\kernel\al_ndi_cm.c    Tue Jul 08 16:20:42 2008
> @@ -103,7 +103,6 @@ static char * State2String(ndi_cm_state_
>         switch (state)
>         {
>                 case NDI_CM_IDLE                              
>           : return "NDI_CM_IDLE";
> -               case NDI_CM_CONNECTING_ATS_SENT         : 
> return "NDI_CM_CONNECTING_ATS_SENT";
>                 case NDI_CM_CONNECTING_QPR_SENT         : 
> return "NDI_CM_CONNECTING_QPR_SENT";
>                 case NDI_CM_CONNECTING_REQ_SENT         : 
> return "NDI_CM_CONNECTING_REQ_SENT";
>                 case NDI_CM_CONNECTING_REP_SENT         : 
> return "NDI_CM_CONNECTING_REP_SENT";
> @@ -280,10 +279,6 @@ static NTSTATUS __ndi_insert_irp_ex(
>         AL_ENTER( AL_DBG_NDI );
>         switch( (ULONG_PTR)Context )
>         {
> -       case NDI_CM_CONNECTING_ATS_SENT:
> -               status = __ndi_ats_query( pIrp );
> -               break;
> -
>         case NDI_CM_CONNECTING_QPR_SENT:
>                 status = __ndi_pr_query( pIrp );
>                 break;
> @@ -424,10 +419,10 @@ static VOID __ndi_complete_cancelled_irp
>         {
>         case UAL_NDI_REQ_CM:
>                 __ndi_acquire_lock( Csq, &irql );
> -                               /*
> +               /*
>                  * Note that al_cancel_sa_req is synchronized 
> with any potential
>                  * SA callback by the CSQ lock.
> -                                */
> +                */
>  #pragma warning( disable:4305 )
>                 h_query = InterlockedExchangePointer( 
> &h_qp->p_irp_queue->h_query, NULL );  #pragma warning( 
> default:4305 ) @@ -536,7 +531,7 @@ ndi_qp_destroy(
>                         __ndi_complete_cancelled_irp( 
> &h_qp->p_irp_queue->csq, Irp );
>                 }
>                 while( Irp = IoCsqRemoveNextIrp(
> -            &h_qp->p_irp_queue->csq, 
> (VOID*)(ULONG_PTR)UAL_NDI_NOTIFY_DREQ ) )
> +                       &h_qp->p_irp_queue->csq, 
> + (VOID*)(ULONG_PTR)UAL_NDI_NOTIFY_DREQ ) )
>                 {
>                         AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI,
>                                 ("h_qp %#I64x, uhdl %#I64x, 
> ref_cnt %d\n", @@ -901,13 +896,13 @@ __ndi_cm_handler(
>                                         cid, h_al, h_qp, new_cid ) );
>                                 __ndi_proc_drep( h_qp );
>                                 break;
> -
> +
>                         case CM_RTU_ATTR_ID:
>                                 AL_PRINT( 
> TRACE_LEVEL_INFORMATION, AL_DBG_NDI,
>                                         ("RTU received for 
> CEP with cid %d, h_al %p, context %p, new_cid %d.\n",
>                                         cid, h_al, h_qp, new_cid ) );
>                                 break;
> -
> +
>                         default:
>                                 AL_PRINT( TRACE_LEVEL_ERROR, 
> AL_DBG_ERROR,
>                                         ("Unhandled MAD attr 
> ID %d for CEP with cid %d, h_al %p, context %p, new_cid %d 
> .\n", @@ -985,7 +980,7 @@ __ndi_send_req(
> 
>         AL_ENTER( AL_DBG_NDI );
> 
> -    p_irp->Tail.Overlay.DriverContext[1] = NULL;
> +       p_irp->Tail.Overlay.DriverContext[1] = NULL;
> 
>         if( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_QPR_SENT )
>         {
> @@ -1107,9 +1102,9 @@ __ndi_pr_query_cb(
>                         case IB_MAD_STATUS_BUSY:
>                         case IB_SA_MAD_STATUS_NO_RESOURCES:
>                                 status = STATUS_TIMEOUT;
> -                       break;
> +                               break;
> 
> -               default:
> +                       default:
>                                 status = STATUS_INVALID_PARAMETER_1 +
>                                         
> (p_query_rec->p_result_mad->p_mad_buf->status & 0xFF);
>                                 break;
> @@ -1185,12 +1180,12 @@ __ndi_pr_query(
> 
>         AL_ENTER( AL_DBG_NDI );
> 
> -       if ( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_ATS_SENT )
> +       if ( h_qp->p_irp_queue->state != NDI_CM_IDLE )
>         {
>                 AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
>                         ("STATUS_CONNECTION_ACTIVE: h_qp 
> %#I64x, uhdl %#I64x, ref_cnt %d\n",
>                         (uint64_t)h_qp, h_qp->obj.hdl, 
> h_qp->obj.ref_cnt ) );
> -               return STATUS_CONNECTION_ABORTED;
> +               return STATUS_CONNECTION_ACTIVE;
>         }
> 
>         query_req.query_type = IB_QUERY_PATH_REC_BY_GIDS; @@ 
> -1221,199 +1216,29 @@ __ndi_pr_query(  }
> 
> 
> -static void AL_API
> -__ndi_ats_query_cb(
> -       IN                              ib_query_rec_t        
>                   *p_query_rec )
> -{
> -       cl_ioctl_handle_t p_irp;
> -       ib_service_record_t *service_record;
> -       ib_qp_handle_t h_qp = 
> (ib_qp_handle_t)p_query_rec->query_context;
> -       ual_ndi_req_cm_ioctl_in_t *p_req;
> -       KIRQL irql;
> -       NTSTATUS status;
> -
> -       AL_ENTER( AL_DBG_NDI );
> -
> -       AL_PRINT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
> -               ("status is %d, count is %d, context %p\n", 
> p_query_rec->status,
> -               p_query_rec->result_cnt, 
> p_query_rec->query_context) );
> -
> -       p_irp = IoCsqRemoveNextIrp( &h_qp->p_irp_queue->csq, 
> (VOID*)(ULONG_PTR)UAL_NDI_REQ_CM );
> -       if( p_irp == NULL )
> -       {
> -               goto exit;
> -       }
> -
> -#pragma warning( disable:4305 )
> -       InterlockedExchangePointer( 
> &h_qp->p_irp_queue->h_query, NULL );
> -#pragma warning( default:4305 )
> -
> -       if( p_query_rec->status != IB_SUCCESS || 
> !p_query_rec->result_cnt )
> -       {
> -               __ndi_acquire_lock( &h_qp->p_irp_queue->csq, &irql );
> -               if( h_qp->p_irp_queue->state != NDI_CM_INVALID )
> -                       h_qp->p_irp_queue->state = NDI_CM_IDLE;
> -               __ndi_release_lock( &h_qp->p_irp_queue->csq, irql );
> -
> -               if( p_query_rec->status == IB_TIMEOUT )
> -               {
> -                       __ndi_complete_irp( h_qp, p_irp, 
> STATUS_TIMEOUT );
> -               }
> -               else
> -               {
> -                       __ndi_complete_irp( h_qp, p_irp, 
> STATUS_HOST_UNREACHABLE );
> -               }
> -
> -               goto exit;              /* ATS request failed */
> -       }
> -
> -       /* send Path Request */
> -       service_record = ib_get_query_svc_rec( 
> p_query_rec->p_result_mad, 0 );
> -       p_req = (ual_ndi_req_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp );
> -       p_req->gids.src_gid.unicast.prefix = 
> service_record->service_gid.unicast.prefix;
> -       p_req->gids.src_gid.unicast.interface_id = p_req->guid;
> -       p_req->gids.dest_gid = service_record->service_gid;
> -       status = IoCsqInsertIrpEx(
> -               &h_qp->p_irp_queue->csq,
> -               p_irp,
> -               NULL,
> -               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT
> -               );
> -       if( status != STATUS_SUCCESS )
> -       {
> -               __ndi_complete_irp( h_qp, p_irp, status );
> -       }
> -       else
> -       {
> -               /*
> -                * Release the previous reference because 
> IoCsqInsertIrpEx
> -                * took a new one.
> -                */
> -               deref_al_obj( &h_qp->obj ); /* Release IRP 
> reference. */
> -       }
> -
> -exit:
> -       if( p_query_rec->p_result_mad )
> -               ib_put_mad( p_query_rec->p_result_mad );
> -
> -       deref_al_obj( &h_qp->obj );     /* release ATS query 
> reference */
> -       AL_EXIT( AL_DBG_NDI );
> -}
> -
> -/*
> - * Send asynchronous query to the SA for an ATS record.
> - *
> - * Called from the __ndi_insert_irp_ex function, so the CSQ 
> lock is held.
> - */
> -NTSTATUS
> -__ndi_ats_query(
> -       IN              IRP*                                  
>                           p_irp
> -       )
> -{
> -       ib_user_query_t user_query;
> -       ib_service_record_t service_record;
> -       ib_query_req_t query_req;
> -       ib_api_status_t status;
> -       ual_ndi_req_cm_ioctl_in_t *p_req =
> -               (ual_ndi_req_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp );
> -       ib_qp_handle_t h_qp = 
> (ib_qp_handle_t)p_irp->Tail.Overlay.DriverContext[0];
> -
> -       AL_ENTER( AL_DBG_NDI );
> -
> -       if ( h_qp->p_irp_queue->state != NDI_CM_IDLE )
> -       {
> -               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR,
> -                       ("STATUS_CONNECTION_ACTIVE: h_qp 
> %#I64x, uhdl %#I64x, ref_cnt %d\n",
> -                       (uint64_t)h_qp, h_qp->obj.hdl, 
> h_qp->obj.ref_cnt ) );
> -               return STATUS_CONNECTION_ACTIVE;
> -       }
> -
> -       query_req.query_type = IB_QUERY_USER_DEFINED;
> -       query_req.p_query_input = &user_query;
> -       query_req.port_guid = p_req->guid;
> -       query_req.timeout_ms = g_sa_timeout;
> -       query_req.retry_cnt = g_sa_retries;
> -       query_req.flags = 0;    /* IB_FLAGS_SYNC */
> -       query_req.query_context = h_qp;
> -       query_req.pfn_query_cb = __ndi_ats_query_cb;
> -
> -       /* TODO: which method one is correct? */
> -       user_query.method = IB_MAD_METHOD_GETTABLE;
> -       //user_query.method = IB_MAD_METHOD_GET;
> -       user_query.attr_id = IB_MAD_ATTR_SERVICE_RECORD;
> -       user_query.attr_size = sizeof(ib_service_record_t);
> -       user_query.comp_mask =
> -               IB_SR_COMPMASK_SPKEY |
> -               IB_SR_COMPMASK_SLEASE |
> -               IB_SR_COMPMASK_SNAME |
> -               IB_SR_COMPMASK_SDATA8_12 |
> -               IB_SR_COMPMASK_SDATA8_13 | 
> IB_SR_COMPMASK_SDATA8_14 | IB_SR_COMPMASK_SDATA8_15;
> -
> -       user_query.p_attr = &service_record;
> -
> -       memset( &service_record, 0, sizeof(service_record) );
> -       service_record.service_pkey = cl_hton16( IB_DEFAULT_PKEY );
> -       service_record.service_data8[12] = (uint8_t) 
> (p_req->pdata.dst_ip_addr[3] >> 0);
> -       service_record.service_data8[13] = (uint8_t) 
> (p_req->pdata.dst_ip_addr[3] >> 8);
> -       service_record.service_data8[14] = (uint8_t) 
> (p_req->pdata.dst_ip_addr[3] >> 16);
> -       service_record.service_data8[15] = (uint8_t) 
> (p_req->pdata.dst_ip_addr[3] >> 24);
> -       service_record.service_lease = 0xFFFFFFFF;
> -       strcpy( (void*)service_record.service_name, ATS_NAME );
> -
> -       AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI,
> -               ("ATS:: MAD: method %#x, attr_id %#hx, 
> Service: comp_mask %#I64x, IP %d.%d.%d.%d \n",
> -               user_query.method,
> -               CL_NTOH16(user_query.attr_id),
> -               user_query.comp_mask,
> -               service_record.service_data8[12],
> -               service_record.service_data8[13],
> -               service_record.service_data8[14],
> -               service_record.service_data8[15]
> -               ) );
> -
> -       AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI,
> -               ("h_qp %#I64x, uhdl %#I64x, ref_cnt %d\n",
> -               (uint64_t)h_qp, h_qp->obj.hdl, h_qp->obj.ref_cnt ) );
> -
> -       ref_al_obj( &h_qp->obj );               /* take ATS 
> query reference */
> -
> -       /* query SA */
> -       status = ib_query( qp_get_al( h_qp ), &query_req, 
> &h_qp->p_irp_queue->h_query );
> -       if( status != IB_SUCCESS )
> -       {
> -               AL_PRINT_EXIT( TRACE_LEVEL_ERROR, 
> AL_DBG_ERROR, ("ib_query failed (%d)\n", status) );
> -               deref_al_obj( &h_qp->obj );     /* release 
> ATS query reference */
> -               return STATUS_UNSUCCESSFUL;
> -       }
> -
> -       AL_EXIT( AL_DBG_NDI );
> -       return STATUS_SUCCESS;
> -}
> -
> -
>  NTSTATUS
>  ndi_req_cm(
>         IN              ib_qp_handle_t  const                 
>           h_qp,
> -       IN              IRP                                   
>                   *p_irp
> +       IN              IRP                                   
>                                   *p_irp
>         )
>  {
> -       NTSTATUS nt_status;
> +       NTSTATUS status;
> 
>         AL_ENTER( AL_DBG_NDI );
> 
>         p_irp->Tail.Overlay.DriverContext[0] = (ib_qp_t*)h_qp;
> 
> -       nt_status = IoCsqInsertIrpEx(
> +       status = IoCsqInsertIrpEx(
>                 &h_qp->p_irp_queue->csq,
>                 p_irp,
>                 NULL,
> -               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_ATS_SENT
> +               (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT
>                 );
> -       if( nt_status == STATUS_SUCCESS )
> -               nt_status = STATUS_PENDING;
> +       if( status == STATUS_SUCCESS )
> +               status = STATUS_PENDING;
> 
>         AL_EXIT( AL_DBG_NDI );
> -       return nt_status;
> +       return status;
>  }
> 
> 
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\kernel\al_ndi_cm.h trunk\core\al\kernel\al_ndi_cm.h
> --- old\core\al\kernel\al_ndi_cm.h      Tue Jul 08 16:16:13 2008
> +++ trunk\core\al\kernel\al_ndi_cm.h    Tue Jul 08 16:20:42 2008
> @@ -64,7 +64,6 @@
>  typedef enum _ndi_cm_state
>  {
>         NDI_CM_IDLE,
> -       NDI_CM_CONNECTING_ATS_SENT, // ATS = Address 
> Translation Service
>         NDI_CM_CONNECTING_QPR_SENT, // QPR = Query path record
>         NDI_CM_CONNECTING_REQ_SENT,
>         NDI_CM_CONNECTING_REP_SENT,
> diff -up -r -X trunk\docs\dontdiff.txt -I \$Id: 
> old\core\al\kernel\al_proxy_ndi.c trunk\core\al\kernel\al_proxy_ndi.c
> --- old\core\al\kernel\al_proxy_ndi.c   Tue Jul 08 16:16:13 2008
> +++ trunk\core\al\kernel\al_proxy_ndi.c Tue Jul 08 16:20:42 2008
> @@ -349,7 +349,7 @@ __ndi_req_cm(
>                 cl_status = CL_INVALID_PARAMETER;
>                 goto err;
>         }
> -
> +
>         /* perform the ioctl */
>         cl_status = ndi_req_cm( h_qp, h_ioctl );
> 
> 



More information about the ofw mailing list