[ofw] [PATCH 11/11] uDAPL scm: set TCP_NODELAY sockopt on the server side for sends.

Davis, Arlin R arlin.r.davis at intel.com
Mon Jul 6 12:52:32 PDT 2009


scm provider sends small messages from both server and client
sides. Set NODELAY on both sides to avoid send delays either
way.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 dapl/openib_scm/cm.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dapl/openib_scm/cm.c b/dapl/openib_scm/cm.c
index 9713641..32e50fc 100644
--- a/dapl/openib_scm/cm.c
+++ b/dapl/openib_scm/cm.c
@@ -427,7 +427,7 @@ DAT_RETURN dapli_socket_disconnect(dp_ib_cm_handle_t cm_ptr)
  */
 static void dapli_socket_connected(dp_ib_cm_handle_t cm_ptr, int err)
 {
-	int len, opt = 1;
+	int ret, len, opt = 1;
 	struct iovec iov[2];
 	struct dapl_ep *ep_ptr = cm_ptr->ep;
 
@@ -447,8 +447,12 @@ static void dapli_socket_connected(dp_ib_cm_handle_t cm_ptr, int err)
 		     " socket connected, write QP and private data\n");
 
 	/* no delay for small packets */
-	setsockopt(cm_ptr->socket, IPPROTO_TCP, TCP_NODELAY,
-		   (char *)&opt, sizeof(opt));
+	ret = setsockopt(cm_ptr->socket, IPPROTO_TCP, TCP_NODELAY,
+			 (char *)&opt, sizeof(opt));
+	if (ret)
+		dapl_log(DAPL_DBG_TYPE_WARN,
+			 " connected: NODELAY setsockopt: %s\n",
+			 strerror(errno));
 
 	/* send qp info and pdata to remote peer */
 	iov[0].iov_base = (void *)&cm_ptr->dst;
@@ -798,6 +802,7 @@ dapli_socket_listen(DAPL_IA * ia_ptr, DAT_CONN_QUAL serviceID, DAPL_SP * sp_ptr)
 
 	setsockopt(cm_ptr->socket, SOL_SOCKET, SO_REUSEADDR,
 		   (char *)&opt, sizeof(opt));
+
 	addr.sin_port = htons(serviceID);
 	addr.sin_family = AF_INET;
 	addr.sin_addr.s_addr = INADDR_ANY;
@@ -839,7 +844,7 @@ dapli_socket_listen(DAPL_IA * ia_ptr, DAT_CONN_QUAL serviceID, DAPL_SP * sp_ptr)
 static void dapli_socket_accept(ib_cm_srvc_handle_t cm_ptr)
 {
 	dp_ib_cm_handle_t acm_ptr;
-	int len;
+	int ret, len, opt = 1;
 
 	dapl_dbg_log(DAPL_DBG_TYPE_EP, " socket_accept\n");
 	
@@ -868,6 +873,14 @@ static void dapli_socket_accept(ib_cm_srvc_handle_t cm_ptr)
 			return;
 		}
 
+		/* no delay for small packets */
+		ret = setsockopt(acm_ptr->socket, IPPROTO_TCP, TCP_NODELAY,
+			   (char *)&opt, sizeof(opt));
+		if (ret)
+			dapl_log(DAPL_DBG_TYPE_WARN,
+				 " accept: NODELAY setsockopt: %s\n",
+				 strerror(errno));
+
 		acm_ptr->state = DCM_ACCEPTING;
 		dapli_cm_queue(acm_ptr);
 	
-- 
1.5.2.5




More information about the ofw mailing list