[ofa-general] [PATCH] [dat2.0] dapl: fix post_ext_send, post_send, post_recv to handle 0 byte's and NULL iov handles

Davis, Arlin R arlin.r.davis at intel.com
Wed Apr 30 15:57:54 PDT 2008


and return errno with verbs post failures.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/openib_cma/dapl_ib_dto.h        |   20 ++++++++++++--------
 dapl/openib_cma/dapl_ib_extensions.c |    3 ---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dapl/openib_cma/dapl_ib_dto.h
b/dapl/openib_cma/dapl_ib_dto.h
index b111e5e..ffb5dca 100644
--- a/dapl/openib_cma/dapl_ib_dto.h
+++ b/dapl/openib_cma/dapl_ib_dto.h
@@ -124,7 +124,7 @@ dapls_ib_post_recv (
 	    dapl_os_free(ds_array_start_p, segments *
sizeof(ib_data_segment_t));
 
 	if (ret)
-		return( dapl_convert_errno(EFAULT,"ibv_recv") );
+		return( dapl_convert_errno(errno,"ibv_recv") );
 
 	return DAT_SUCCESS;
 }
@@ -202,7 +202,8 @@ dapls_ib_post_send (
 	if (cookie != NULL) 
 		cookie->val.dto.size = total_len;
 
-	if ((op_type == OP_RDMA_WRITE) || (op_type == OP_RDMA_READ)) {
+	if (wr.num_sge && 
+	    (op_type == OP_RDMA_WRITE || op_type == OP_RDMA_READ)) {
 		wr.wr.rdma.remote_addr = remote_iov->virtual_address;
 		wr.wr.rdma.rkey = remote_iov->rmr_context;
 		dapl_dbg_log(DAPL_DBG_TYPE_EP, 
@@ -234,7 +235,7 @@ dapls_ib_post_send (
 	    dapl_os_free(ds_array_start_p, segments *
sizeof(ib_data_segment_t));
 
 	if (ret)
-		return( dapl_convert_errno(EFAULT,"ibv_send") );
+		return( dapl_convert_errno(errno,"ibv_send") );
 
 	dapl_dbg_log(DAPL_DBG_TYPE_EP," post_snd: returned\n");
 	return DAT_SUCCESS;
@@ -357,12 +358,15 @@ dapls_ib_post_ext_send (
 		/* OP_RDMA_WRITE)IMMED has direct IB wr_type mapping */
 		dapl_dbg_log(DAPL_DBG_TYPE_EP, 
 			     " post_ext: rkey 0x%x va %#016Lx
immed=0x%x\n",
-			     remote_iov->rmr_context, 
-			     remote_iov->virtual_address, immed_data);
+			     remote_iov?remote_iov->rmr_context:0, 
+			     remote_iov?remote_iov->virtual_address:0,
+			     immed_data);
 
 		wr.imm_data = immed_data;
-		wr.wr.rdma.remote_addr = remote_iov->virtual_address;
-		wr.wr.rdma.rkey = remote_iov->rmr_context;
+	        if (wr.num_sge) {
+			wr.wr.rdma.remote_addr =
remote_iov->virtual_address;
+			wr.wr.rdma.rkey = remote_iov->rmr_context;
+		}
 		break;
 	case OP_COMP_AND_SWAP:
 		/* OP_COMP_AND_SWAP has direct IB wr_type mapping */
@@ -411,7 +415,7 @@ dapls_ib_post_ext_send (
 	    dapl_os_free(ds_array_start_p, segments *
sizeof(ib_data_segment_t));
 
 	if (ret)
-		return( dapl_convert_errno(EFAULT,"ibv_send") );
+		return( dapl_convert_errno(errno,"ibv_send") );
 	
 	dapl_dbg_log(DAPL_DBG_TYPE_EP," post_snd: returned\n");
 	return DAT_SUCCESS;
diff --git a/dapl/openib_cma/dapl_ib_extensions.c
b/dapl/openib_cma/dapl_ib_extensions.c
index 3132ffb..52b238f 100755
--- a/dapl/openib_cma/dapl_ib_extensions.c
+++ b/dapl/openib_cma/dapl_ib_extensions.c
@@ -185,9 +185,6 @@ dapli_post_ext( IN       DAT_EP_HANDLE
ep_handle,
 	if (DAPL_BAD_HANDLE(ep_handle, DAPL_MAGIC_EP))
 		return(DAT_ERROR(DAT_INVALID_HANDLE,
DAT_INVALID_HANDLE_EP));
 
-	if ((NULL == remote_iov) || (NULL == local_iov))
-		return DAT_INVALID_PARAMETER;
-
 	ep_ptr = (DAPL_EP *) ep_handle;
 	qp_ptr = ep_ptr->qp_handle;
 
-- 
1.5.2.5




More information about the general mailing list