From ba97d06e0478b315966806d9159d1f55e5b3beaa Mon Sep 17 00:00:00 2001 From: leonidk Date: Wed, 24 Sep 2008 19:25:07 +0000 Subject: [PATCH] [IPoIB] Avoid the SM (3/4) This patch changes the NetworkDirect CM proxy to take a path as input for the REQ IOCTL rather than a GID pair. The IOCTL handler checks if the DLID in the path is zero and if so performs a path query using the SGID and DGID from the path (same code path as it used to take when the IOCTL provided a GID pair.) Signed-off-by: Fab Tillier git-svn-id: svn://openib.tc.cornell.edu/gen1@1612 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/WOF2-0/trunk/core/al/al_dev.h | 2 +- .../WOF2-0/trunk/core/al/kernel/al_ndi_cm.c | 48 +++++++++++++++---- branches/WOF2-0/trunk/inc/iba/ib_al_ioctl.h | 7 ++- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/branches/WOF2-0/trunk/core/al/al_dev.h b/branches/WOF2-0/trunk/core/al/al_dev.h index ea3c7908..c67630f8 100644 --- a/branches/WOF2-0/trunk/core/al/al_dev.h +++ b/branches/WOF2-0/trunk/core/al/al_dev.h @@ -55,7 +55,7 @@ #define AL_DEVICE_NAME L"\\Device\\ibal" #define ALDEV_KEY (0x3B) /* Matches FILE_DEVICE_INFINIBAND from wdm.h */ -#define AL_IOCTL_VERSION (10) +#define AL_IOCTL_VERSION (11) /* max number of devices with non-default pkey */ #define MAX_NUM_PKEY 16 diff --git a/branches/WOF2-0/trunk/core/al/kernel/al_ndi_cm.c b/branches/WOF2-0/trunk/core/al/kernel/al_ndi_cm.c index 948b8152..47e11ea2 100644 --- a/branches/WOF2-0/trunk/core/al/kernel/al_ndi_cm.c +++ b/branches/WOF2-0/trunk/core/al/kernel/al_ndi_cm.c @@ -986,11 +986,12 @@ __ndi_send_req( p_irp->Tail.Overlay.DriverContext[1] = NULL; - if( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_QPR_SENT ) + if( h_qp->p_irp_queue->state != NDI_CM_CONNECTING_QPR_SENT && + h_qp->p_irp_queue->state != NDI_CM_IDLE ) { AL_PRINT_EXIT( TRACE_LEVEL_ERROR, AL_DBG_ERROR, ("Unexpected state: %d\n", h_qp->p_irp_queue->state) ); - return STATUS_CONNECTION_ABORTED; + return STATUS_CONNECTION_ACTIVE; } /* Get a CEP and bind it to the QP. */ @@ -1181,6 +1182,7 @@ __ndi_pr_query( 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]; + ib_gid_pair_t gids; AL_ENTER( AL_DBG_NDI ); @@ -1192,8 +1194,11 @@ __ndi_pr_query( return STATUS_CONNECTION_ACTIVE; } + gids.src_gid = p_req->path.sgid; + gids.dest_gid = p_req->path.dgid; + query_req.query_type = IB_QUERY_PATH_REC_BY_GIDS; - query_req.p_query_input = &p_req->gids; + query_req.p_query_input = &gids; query_req.port_guid = p_req->guid; query_req.timeout_ms = g_sa_timeout; query_req.retry_cnt = g_sa_retries; @@ -1203,7 +1208,7 @@ __ndi_pr_query( AL_PRINT( TRACE_LEVEL_INFORMATION, AL_DBG_NDI, ("Query for path from %I64x to %I64x\n", - p_req->guid, ib_gid_get_guid( &p_req->gids.dest_gid )) ); + p_req->guid, ib_gid_get_guid( &p_req->path.dgid )) ); ref_al_obj( &h_qp->obj ); /* take path query reference */ status = ib_query( qp_get_al( h_qp ), &query_req, &h_qp->p_irp_queue->h_query ); @@ -1227,17 +1232,40 @@ ndi_req_cm( ) { NTSTATUS status; + ual_ndi_req_cm_ioctl_in_t *p_req = + (ual_ndi_req_cm_ioctl_in_t*)cl_ioctl_in_buf( p_irp ); AL_ENTER( AL_DBG_NDI ); p_irp->Tail.Overlay.DriverContext[0] = (ib_qp_t*)h_qp; - status = IoCsqInsertIrpEx( - &h_qp->p_irp_queue->csq, - p_irp, - NULL, - (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT - ); + if( p_req->path.dlid != 0 ) + { + /* fix packet life */ + uint8_t pkt_life = ib_path_rec_pkt_life( &p_req->path ) + g_pkt_life_modifier; + if( pkt_life > 0x1F ) + pkt_life = 0x1F; + + p_req->path.pkt_life &= IB_PATH_REC_SELECTOR_MASK; + p_req->path.pkt_life |= pkt_life; + + p_irp->Tail.Overlay.DriverContext[1] = &p_req->path; + status = IoCsqInsertIrpEx( + &h_qp->p_irp_queue->csq, + p_irp, + NULL, + (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_REQ_SENT + ); + } + else + { + status = IoCsqInsertIrpEx( + &h_qp->p_irp_queue->csq, + p_irp, + NULL, + (VOID*)(ULONG_PTR)NDI_CM_CONNECTING_QPR_SENT + ); + } if( status == STATUS_SUCCESS ) status = STATUS_PENDING; diff --git a/branches/WOF2-0/trunk/inc/iba/ib_al_ioctl.h b/branches/WOF2-0/trunk/inc/iba/ib_al_ioctl.h index 0a67f0c3..0b425c1f 100644 --- a/branches/WOF2-0/trunk/inc/iba/ib_al_ioctl.h +++ b/branches/WOF2-0/trunk/inc/iba/ib_al_ioctl.h @@ -3480,11 +3480,10 @@ typedef struct _ual_ndi_notify_cq_ioctl_in */ typedef struct _ual_ndi_req_cm_ioctl_in { - ib_gid_pair_t gids; + ib_path_rec_t path; uint64_t h_qp; net64_t guid; uint16_t dst_port; - uint16_t pkey; uint8_t resp_res; uint8_t init_depth; uint8_t prot; @@ -3506,8 +3505,8 @@ typedef struct _ual_ndi_req_cm_ioctl_in * dst_port * Destination port number. * -* pkey -* Partition key. +* path +* Path record for the connection. * * resp_res * Responder resources for the QP. -- 2.41.0