[ofa-general] [PATCH][v2] dapl: add hooks in evd connection callback code to deliver private data with consumer reject.

Arlin Davis arlin.r.davis at intel.com
Tue Apr 8 16:51:27 PDT 2008


PEER rejects can include private data. The common code didn't support delivery
via the connect event data structure. Add the necessary hooks in
dapl_evd_connection_callback function and include checks in openib_cma
provider to check and deliver properly. Also, fix the private data size
check in dapls_ib_reject_connection function.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_evd_connection_callb.c |   22 ++++++++++++++++++++--
 dapl/openib_cma/dapl_ib_cm.c            |   16 ++++++++++------
 2 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/dapl/common/dapl_evd_connection_callb.c b/dapl/common/dapl_evd_connection_callb.c
index d3a39a6..7f994b0 100644
--- a/dapl/common/dapl_evd_connection_callb.c
+++ b/dapl/common/dapl_evd_connection_callb.c
@@ -164,8 +164,26 @@ dapl_evd_connection_callback (
 
 	    break;
 	}
-	case DAT_CONNECTION_EVENT_DISCONNECTED:
 	case DAT_CONNECTION_EVENT_PEER_REJECTED:
+	{
+	    /* peer reject may include private data */
+	    if (prd_ptr != NULL) 
+		private_data_size  = 
+		    dapls_ib_private_data_size(
+					prd_ptr, DAPL_PDATA_CONN_REJ,
+		    			ep_ptr->header.owner_ia->hca_ptr);
+
+	    if (private_data_size > 0) 
+		dapl_os_memcpy (ep_ptr->private.private_data,
+				prd_ptr->private_data,
+				DAPL_MIN (private_data_size, 
+                                 DAPL_MAX_PRIVATE_DATA_SIZE));
+
+            dapl_dbg_log(DAPL_DBG_TYPE_CM | DAPL_DBG_TYPE_CALLBACK,
+			 "dapl_evd_connection_callback PEER REJ pd=%p sz=%d\n",
+			 prd_ptr, private_data_size);
+	}
+	case DAT_CONNECTION_EVENT_DISCONNECTED:
 	case DAT_CONNECTION_EVENT_UNREACHABLE:
 	case DAT_CONNECTION_EVENT_NON_PEER_REJECTED:
 	{
@@ -205,7 +223,7 @@ dapl_evd_connection_callback (
 			evd_ptr,
 			dat_event_num,
 			(DAT_HANDLE) ep_ptr,
-			private_data_size, /* 0 except for CONNECTED */
+			private_data_size, /* CONNECTED or REJECT */
 			ep_ptr->private.private_data );
 
 	if (dat_status != DAT_SUCCESS && 
diff --git a/dapl/openib_cma/dapl_ib_cm.c b/dapl/openib_cma/dapl_ib_cm.c
index 9b2062b..d3835b3 100755
--- a/dapl/openib_cma/dapl_ib_cm.c
+++ b/dapl/openib_cma/dapl_ib_cm.c
@@ -336,6 +336,7 @@ static void dapli_cm_active_cb(struct dapl_cm_id *conn,
 	case RDMA_CM_EVENT_REJECTED:
 	{
 		ib_cm_events_t cm_event;
+		unsigned char  *pdata = NULL;
 
 		dapl_dbg_log(
 			DAPL_DBG_TYPE_CM,
@@ -344,9 +345,11 @@ static void dapli_cm_active_cb(struct dapl_cm_id *conn,
 
 		/* valid REJ from consumer will always contain private data */
 		if (event->status == 28 &&
-			event->param.conn.private_data_len) 
+		    event->param.conn.private_data_len) {
 			cm_event = IB_CME_DESTINATION_REJECT_PRIVATE_DATA;
-		else {
+			pdata = (unsigned char*)event->param.conn.private_data
+				+ sizeof(struct dapl_pdata_hdr);
+		} else {
 			cm_event = IB_CME_DESTINATION_REJECT;
 			dapl_log(DAPL_DBG_TYPE_WARN, 
 				"dapl_cma_active: non-consumer REJ,"
@@ -357,7 +360,7 @@ static void dapli_cm_active_cb(struct dapl_cm_id *conn,
 				ntohs(((struct sockaddr_in *)
 				&conn->cm_id->route.addr.dst_addr)->sin_port));
 		}		
-		dapl_evd_connection_callback(conn, cm_event, NULL, conn->ep);
+		dapl_evd_connection_callback(conn, cm_event, pdata, conn->ep);
 		break;
 	}
 	case RDMA_CM_EVENT_ESTABLISHED:
@@ -910,8 +913,9 @@ dapls_ib_reject_connection(
 	};
 
 	dapl_dbg_log(DAPL_DBG_TYPE_CM,
-		 " reject: cm_handle %p reason %x, ver=0x%x \n",
-		  cm_handle, reason, ntohl(pdata_hdr.version));
+		     " reject: handle %p reason %x, ver=%x, data %p, sz=%d\n",
+		     cm_handle, reason, ntohl(pdata_hdr.version),
+		     private_data, private_data_size);
 
 	if (cm_handle == IB_INVALID_HANDLE) {
 		dapl_dbg_log(DAPL_DBG_TYPE_ERR,
@@ -922,7 +926,7 @@ dapls_ib_reject_connection(
     
         if (private_data_size > 
 		dapls_ib_private_data_size(
-			NULL, IB_MAX_REJ_PDATA_SIZE, cm_handle->hca))
+			NULL, DAPL_PDATA_CONN_REJ, cm_handle->hca))
 		return DAT_ERROR(DAT_INVALID_PARAMETER, DAT_INVALID_ARG3);
 	
 	/* setup pdata_hdr and users data, in CR pdata buffer */
-- 
1.5.2.5






More information about the general mailing list