[ofa-general] [PATCH 1/1][v2] dapl: calculate private data size based on transport type and cma_hdr overhead

Arlin Davis arlin.r.davis at intel.com
Tue Apr 1 11:17:22 PDT 2008


Need to adjust CM private date size based on different transport types.
Add hca_ptr to dapls_ib_private_data_size call for transport type
validation via verbs device. Add definitions to include iWARP size
of 512 and subtract 36 bytes for cma_hdr overhead.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_adapter_util.h         |    3 ++-
 dapl/common/dapl_cr_callback.c          |    3 ++-
 dapl/common/dapl_ep_connect.c           |    4 +++-
 dapl/common/dapl_evd_connection_callb.c |    4 +++-
 dapl/common/dapl_ia_query.c             |    5 +++--
 dapl/ibal-scm/dapl_ibal-scm_cm.c        |    4 +++-
 dapl/ibal/dapl_ibal_cm.c                |    2 ++
 dapl/openib/dapl_ib_cm.c                |    4 +++-
 dapl/openib_cma/dapl_ib_cm.c            |   10 ++++++++--
 dapl/openib_cma/dapl_ib_util.h          |   14 ++++++++------
 dapl/openib_scm/dapl_ib_cm.c            |    4 +++-
 11 files changed, 40 insertions(+), 17 deletions(-)

diff --git a/dapl/common/dapl_adapter_util.h b/dapl/common/dapl_adapter_util.h
index 6738d6a..d664bf6 100755
--- a/dapl/common/dapl_adapter_util.h
+++ b/dapl/common/dapl_adapter_util.h
@@ -239,7 +239,8 @@ DAT_RETURN dapls_ib_cm_remote_addr (
 
 int dapls_ib_private_data_size (
 	IN  DAPL_PRIVATE		*prd_ptr,
-	IN  DAPL_PDATA_OP		conn_op);
+	IN  DAPL_PDATA_OP		conn_op,
+	IN  DAPL_HCA			*hca_ptr);
 
 void 
 dapls_query_provider_specific_attr(
diff --git a/dapl/common/dapl_cr_callback.c b/dapl/common/dapl_cr_callback.c
index e8f58a4..46d2b4c 100644
--- a/dapl/common/dapl_cr_callback.c
+++ b/dapl/common/dapl_cr_callback.c
@@ -378,7 +378,8 @@ dapli_connection_request (
     else
     {
 	cr_ptr->param.private_data_size = 
-		dapls_ib_private_data_size (prd_ptr, DAPL_PDATA_CONN_REQ);
+		dapls_ib_private_data_size(prd_ptr, DAPL_PDATA_CONN_REQ,
+					   sp_ptr->header.owner_ia->hca_ptr);
     }
     if (cr_ptr->param.private_data_size > 0)
     {
diff --git a/dapl/common/dapl_ep_connect.c b/dapl/common/dapl_ep_connect.c
index 12d391f..f290ebe 100755
--- a/dapl/common/dapl_ep_connect.c
+++ b/dapl/common/dapl_ep_connect.c
@@ -258,7 +258,9 @@ dapl_ep_connect (
      */
     req_hdr_size = (sizeof (DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);
 
-    max_req_pdata_size = dapls_ib_private_data_size (NULL, DAPL_PDATA_CONN_REQ);
+    max_req_pdata_size = dapls_ib_private_data_size(
+				NULL, DAPL_PDATA_CONN_REQ,
+				ep_ptr->header.owner_ia->hca_ptr);
 
     if (private_data_size + req_hdr_size > (DAT_COUNT)max_req_pdata_size) 
     {
diff --git a/dapl/common/dapl_evd_connection_callb.c b/dapl/common/dapl_evd_connection_callb.c
index 3c4e0cb..d3a39a6 100644
--- a/dapl/common/dapl_evd_connection_callb.c
+++ b/dapl/common/dapl_evd_connection_callb.c
@@ -148,7 +148,9 @@ dapl_evd_connection_callback (
 	    else
 	    {
 		private_data_size  = 
-		    dapls_ib_private_data_size (prd_ptr, DAPL_PDATA_CONN_REP);
+		    dapls_ib_private_data_size(
+					prd_ptr, DAPL_PDATA_CONN_REP,
+		    			ep_ptr->header.owner_ia->hca_ptr);
 	    }
 
 	    if (private_data_size > 0)
diff --git a/dapl/common/dapl_ia_query.c b/dapl/common/dapl_ia_query.c
index 593f356..a8c39a3 100755
--- a/dapl/common/dapl_ia_query.c
+++ b/dapl/common/dapl_ia_query.c
@@ -156,8 +156,9 @@ dapl_ia_query (
 	 * 	to 0 unless IBHOSTS_NAMING is enabled.
 	 */
 	provider_attr->max_private_data_size 	  = 
-	    dapls_ib_private_data_size (NULL, DAPL_PDATA_CONN_REQ) -
-	    (sizeof (DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE);
+	    dapls_ib_private_data_size(NULL, DAPL_PDATA_CONN_REQ,
+			ia_ptr->hca_ptr) -
+			(sizeof(DAPL_PRIVATE) - DAPL_MAX_PRIVATE_DATA_SIZE); 
 	provider_attr->supports_multipath 	  = DAT_FALSE;
 	provider_attr->ep_creator 		  = DAT_PSP_CREATES_EP_NEVER;
 	provider_attr->optimal_buffer_alignment   = DAT_OPTIMAL_ALIGNMENT;
diff --git a/dapl/ibal-scm/dapl_ibal-scm_cm.c b/dapl/ibal-scm/dapl_ibal-scm_cm.c
index 692e5b9..fcf5215 100644
--- a/dapl/ibal-scm/dapl_ibal-scm_cm.c
+++ b/dapl/ibal-scm/dapl_ibal-scm_cm.c
@@ -1019,6 +1019,7 @@ dapls_ib_cm_remote_addr (
  * Input:
  *	prd_ptr		private data pointer
  *	conn_op		connection operation type
+ *      hca_ptr         hca pointer, needed for transport type
  *
  * If prd_ptr is NULL, this is a query for the max size supported by
  * the provider, otherwise it is the actual size of the private data
@@ -1034,7 +1035,8 @@ dapls_ib_cm_remote_addr (
  */
 int dapls_ib_private_data_size (
 	IN      DAPL_PRIVATE	*prd_ptr,
-	IN	DAPL_PDATA_OP	conn_op)
+	IN	DAPL_PDATA_OP	conn_op,
+	IN      DAPL_HCA	*hca_ptr)
 {
 	int  size;
 
diff --git a/dapl/ibal/dapl_ibal_cm.c b/dapl/ibal/dapl_ibal_cm.c
index 9f3ffc4..6cd652f 100644
--- a/dapl/ibal/dapl_ibal_cm.c
+++ b/dapl/ibal/dapl_ibal_cm.c
@@ -1679,6 +1679,7 @@ dapls_ib_cr_handoff (
  * Return the size of private data given a connection op type
  *
  * Input:
+ *	hca_ptr		hca pointer, needed for transport type
  *	prd_ptr		private data pointer
  *	conn_op		connection operation type
  *
@@ -1697,6 +1698,7 @@ dapls_ib_cr_handoff (
  */
 int
 dapls_ib_private_data_size (
+	IN	DAPL_HCA		*hca_ptr,
 	IN      DAPL_PRIVATE		*prd_ptr,
 	IN	DAPL_PDATA_OP		conn_op)
 {
diff --git a/dapl/openib/dapl_ib_cm.c b/dapl/openib/dapl_ib_cm.c
index 2ff2ba0..76d5968 100644
--- a/dapl/openib/dapl_ib_cm.c
+++ b/dapl/openib/dapl_ib_cm.c
@@ -1049,6 +1049,7 @@ dapls_ib_cm_remote_addr (
  * Input:
  *	prd_ptr		private data pointer
  *	conn_op		connection operation type
+ *      hca_ptr         hca pointer, needed for transport type
  *
  * If prd_ptr is NULL, this is a query for the max size supported by
  * the provider, otherwise it is the actual size of the private data
@@ -1064,7 +1065,8 @@ dapls_ib_cm_remote_addr (
  */
 int dapls_ib_private_data_size (
 	IN      DAPL_PRIVATE	*prd_ptr,
-	IN	DAPL_PDATA_OP	conn_op)
+	IN	DAPL_PDATA_OP	conn_op,
+	IN	DAPL_HCA	*hca_ptr)
 {
 	int  size;
 
diff --git a/dapl/openib_cma/dapl_ib_cm.c b/dapl/openib_cma/dapl_ib_cm.c
index 04b9e41..cf79142 100755
--- a/dapl/openib_cma/dapl_ib_cm.c
+++ b/dapl/openib_cma/dapl_ib_cm.c
@@ -972,6 +972,7 @@ dapls_ib_cm_remote_addr(IN DAT_HANDLE dat_handle, OUT DAT_SOCK_ADDR6 *raddr)
  * Input:
  *	prd_ptr		private data pointer
  *	conn_op		connection operation type
+ *      hca_ptr         hca pointer, needed for transport type
  *
  * If prd_ptr is NULL, this is a query for the max size supported by
  * the provider, otherwise it is the actual size of the private data
@@ -985,11 +986,16 @@ dapls_ib_cm_remote_addr(IN DAT_HANDLE dat_handle, OUT DAT_SOCK_ADDR6 *raddr)
  * 	length of private data
  *
  */
-int dapls_ib_private_data_size(IN DAPL_PRIVATE	*prd_ptr,
-			       IN DAPL_PDATA_OP conn_op)
+int dapls_ib_private_data_size(	IN DAPL_PRIVATE	*prd_ptr,
+				IN DAPL_PDATA_OP conn_op,
+				IN DAPL_HCA     *hca_ptr)
 {
 	int  size;
 
+        if (hca_ptr->ib_hca_handle->device->transport_type 
+					== IBV_TRANSPORT_IWARP)
+		return(IWARP_MAX_PDATA_SIZE);
+
 	switch(conn_op)	{
 
 	case DAPL_PDATA_CONN_REQ:
diff --git a/dapl/openib_cma/dapl_ib_util.h b/dapl/openib_cma/dapl_ib_util.h
index 2f01fc3..f35cb9d 100755
--- a/dapl/openib_cma/dapl_ib_util.h
+++ b/dapl/openib_cma/dapl_ib_util.h
@@ -113,12 +113,14 @@ typedef struct _ib_wait_obj_handle
 /* inline send rdma threshold */
 #define	INLINE_SEND_DEFAULT	64
 
-/* CM private data areas */
-#define	IB_MAX_REQ_PDATA_SIZE	48
-#define	IB_MAX_REP_PDATA_SIZE	196
-#define	IB_MAX_REJ_PDATA_SIZE	148
-#define	IB_MAX_DREQ_PDATA_SIZE	220
-#define	IB_MAX_DREP_PDATA_SIZE	224
+/* CMA private data areas */
+#define CMA_PDATA_HDR		36
+#define	IB_MAX_REQ_PDATA_SIZE	(92-CMA_PDATA_HDR)
+#define	IB_MAX_REP_PDATA_SIZE	(196-CMA_PDATA_HDR)
+#define	IB_MAX_REJ_PDATA_SIZE	(148-CMA_PDATA_HDR)
+#define	IB_MAX_DREQ_PDATA_SIZE	(220-CMA_PDATA_HDR)
+#define	IB_MAX_DREP_PDATA_SIZE	(224-CMA_PDATA_HDR)
+#define	IWARP_MAX_PDATA_SIZE	(512-CMA_PDATA_HDR)
 
 /* DTO OPs, ordered for DAPL ENUM definitions */
 #define OP_RDMA_WRITE           IBV_WR_RDMA_WRITE
diff --git a/dapl/openib_scm/dapl_ib_cm.c b/dapl/openib_scm/dapl_ib_cm.c
index f534e8d..485ab9b 100644
--- a/dapl/openib_scm/dapl_ib_cm.c
+++ b/dapl/openib_scm/dapl_ib_cm.c
@@ -827,6 +827,7 @@ dapls_ib_cm_remote_addr (
  * Input:
  *	prd_ptr		private data pointer
  *	conn_op		connection operation type
+ *      hca_ptr         hca pointer, needed for transport type
  *
  * If prd_ptr is NULL, this is a query for the max size supported by
  * the provider, otherwise it is the actual size of the private data
@@ -842,7 +843,8 @@ dapls_ib_cm_remote_addr (
  */
 int dapls_ib_private_data_size (
 	IN      DAPL_PRIVATE	*prd_ptr,
-	IN	DAPL_PDATA_OP	conn_op)
+	IN	DAPL_PDATA_OP	conn_op,
+        IN	DAPL_HCA	*hca_ptr)
 {
 	int  size;
 
-- 
1.5.2.5





More information about the general mailing list