[ofw] DAPL v2 sync up with OFED 1.3 src

Smith, Stan stan.smith at intel.com
Thu Mar 20 15:44:03 PDT 2008


Signed off by Stan Smith (stan.smith at intel.com)

Subject: [PATCH 01/14] Fix memory leak.
Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 test/dapltest/cmd/dapl_netaddr.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/test/dapltest/cmd/dapl_netaddr.c
b/test/dapltest/cmd/dapl_netaddr.c
index 0b16303..a306335 100644
--- a/test/dapltest/cmd/dapl_netaddr.c
+++ b/test/dapltest/cmd/dapl_netaddr.c
@@ -137,6 +137,7 @@ DT_NetAddrLookupHostAddress (DAT_IA_ADDRESS_PTR
to_netaddr,
 		    inet_ntoa(((struct sockaddr_in
*)target->ai_addr)->sin_addr));
 
     *to_netaddr = * ((DAT_IA_ADDRESS_PTR) target->ai_addr);
+    freeaddrinfo(target);
 
     return ( DAT_TRUE );
 }


Subject: [PATCH 02/14] Fix memory leak
Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 test/dtest/dtest.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/test/dtest/dtest.c b/test/dtest/dtest.c
index 57b5790..fa3b9a8 100755
--- a/test/dtest/dtest.c
+++ b/test/dtest/dtest.c
@@ -909,6 +909,7 @@ connect_ep( char *hostname, DAT_CONN_QUAL conn_id )
                (rval >> 16) & 0xff, (rval >> 24) & 0xff, conn_id);
 
        remote_addr = *((DAT_IA_ADDRESS_PTR)target->ai_addr);
+       freeaddrinfo(target);
 
        LOGPRINTF("%d Connecting to server\n",getpid());
        ret = dat_ep_connect(   h_ep,


Subject: [PATCH 04/14] Fix memory leak.
Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 dapl/common/dapl_ia_open.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/dapl/common/dapl_ia_open.c b/dapl/common/dapl_ia_open.c
index 7ca5dba..a780a98 100644
--- a/dapl/common/dapl_ia_open.c
+++ b/dapl/common/dapl_ia_open.c
@@ -420,6 +420,7 @@ dapli_assign_hca_ip_address (
     else
     {
 	hca_ptr->hca_address = * ((DAT_SOCK_ADDR6 *)addr->ai_addr);
+	dapls_osd_freeaddrinfo (addr);
     }
 }
 
-- 
1.5.2.5

Subject: [PATCH 05/14] Make sure we don't leak the hash table if
dapl_hca_alloc fails.
Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 dapl/common/dapl_hca_util.c |   54
++++++++++++++++++++++++++----------------
 1 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/dapl/common/dapl_hca_util.c b/dapl/common/dapl_hca_util.c
index 2cfef0e..f881a1e 100644
--- a/dapl/common/dapl_hca_util.c
+++ b/dapl/common/dapl_hca_util.c
@@ -65,33 +65,45 @@ dapl_hca_alloc (
     DAPL_HCA	*hca_ptr;
 
     hca_ptr = dapl_os_alloc (sizeof (DAPL_HCA));
-    if ( NULL != hca_ptr )
+    if ( NULL == hca_ptr )
     {
-	dapl_os_memzero (hca_ptr, sizeof (DAPL_HCA));
+	goto bail;
+    }
 
-        if ( DAT_SUCCESS == dapls_hash_create (
-                 DAPL_HASH_TABLE_DEFAULT_CAPACITY,
&hca_ptr->lmr_hash_table) )
-        {
-            dapl_os_lock_init(&hca_ptr->lock);
-            dapl_llist_init_head(&hca_ptr->ia_list_head);
+    dapl_os_memzero (hca_ptr, sizeof (DAPL_HCA));
+
+    if ( DAT_SUCCESS != dapls_hash_create (
+	DAPL_HASH_TABLE_DEFAULT_CAPACITY, &hca_ptr->lmr_hash_table) )
+    {
+	goto bail;
+    }
+
+    dapl_os_lock_init(&hca_ptr->lock);
+    dapl_llist_init_head(&hca_ptr->ia_list_head);
             
-            hca_ptr->name = dapl_os_strdup(name);
-            hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;
-            hca_ptr->port_num = dapl_os_strtol(port, NULL, 0);
-	    if (hca_ptr->name == NULL)
-	    {
-		dapl_os_free (hca_ptr, sizeof (DAPL_HCA));
-		hca_ptr = NULL;
-	    }
-        }
-        else
-        {
-            dapl_os_free (hca_ptr, sizeof (DAPL_HCA));
-            hca_ptr = NULL;
-        }
+    hca_ptr->name = dapl_os_strdup(name);
+    if ( NULL == hca_ptr->name )
+    {
+	goto bail;
     }
 
+    hca_ptr->ib_hca_handle = IB_INVALID_HANDLE;
+    hca_ptr->port_num = dapl_os_strtol(port, NULL, 0);
+
     return (hca_ptr);
+
+bail:
+    if ( NULL != hca_ptr )
+    {
+	if ( NULL != hca_ptr->lmr_hash_table )
+	{
+	    dapls_hash_free (hca_ptr->lmr_hash_table);
+	}
+
+	dapl_os_free (hca_ptr, sizeof (DAPL_HCA));
+    }
+
+    return NULL;
 }
 
 /*
-- 
1.5.2.5

Subject: [PATCH 06/14] Guarantee NUL termination if hostname gets
truncated.
Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 dapl/common/dapl_ia_open.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/dapl/common/dapl_ia_open.c b/dapl/common/dapl_ia_open.c
index a780a98..d85c1b6 100644
--- a/dapl/common/dapl_ia_open.c
+++ b/dapl/common/dapl_ia_open.c
@@ -395,6 +395,10 @@ dapli_assign_hca_ip_address (
      */
 
     rc = gethostname (hostname, NAMELEN);
+
+    /* guarantee NUL termination if hostname gets truncated */
+    hostname[NAMELEN-1] = '\0';
+
     /*
      * Strip off domain info if it exists (e.g. mynode.mydomain.com)
      */
-- 
1.5.2.5


Subject: [PATCH 09/14] Add hostname and process id to debug output to
aid
scale-up and out debug.
Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_debug.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dapl/common/dapl_debug.c b/dapl/common/dapl_debug.c
index 9f4fa04..7ddce52 100644
--- a/dapl/common/dapl_debug.c
+++ b/dapl/common/dapl_debug.c
@@ -36,15 +36,25 @@
 DAPL_DBG_TYPE g_dapl_dbg_type;		/* initialized in dapl_init.c */
 DAPL_DBG_DEST g_dapl_dbg_dest;		/* initialized in dapl_init.c */
 
+static char *_ptr_host_ = NULL;
+static char _hostname_[128];
+
 void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...)
 {
     va_list args;
 
+    if ( _ptr_host_ == NULL )
+    {
+       gethostname(_hostname_, sizeof(_hostname_));
+       _ptr_host_ = _hostname_;
+    }
+
     if ( type & g_dapl_dbg_type )
     {
 	if ( DAPL_DBG_DEST_STDOUT & g_dapl_dbg_dest )
 	{
 	    va_start (args, fmt);
+            fprintf(stdout, "%s:%d: ", _ptr_host_, getpid());
 	    dapl_os_vprintf (fmt, args);
 	    va_end (args);
 	}
-- 
1.5.2.5


Subject: [PATCH 10/14] uDAT: fix reuse of va_list in debugging mode

Make sure we reinitialize the va_list since va_list is undefined
if a function traverses the va_list with va_arg.

This patch fixes the uDAT debugging case when both stdout and
syslog output is wanted.

Signed-off-by: Patrick Marchand Latifi <patrick.latifi at qlogic.com>
---
 dat/udat/linux/dat_osd.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dat/udat/linux/dat_osd.c b/dat/udat/linux/dat_osd.c
index e49c489..bc66828 100644
--- a/dat/udat/linux/dat_osd.c
+++ b/dat/udat/linux/dat_osd.c
@@ -116,20 +116,20 @@ dat_os_dbg_print (
     {
 	va_list args;
 
-	va_start (args, fmt);
-
 	if ( DAT_OS_DBG_DEST_STDOUT & g_dbg_dest )
 	{
+	    va_start (args, fmt);
 	    vfprintf (stdout, fmt, args);
 	    fflush (stdout);
+	    va_end (args);
 	}
 
 	if ( DAT_OS_DBG_DEST_SYSLOG & g_dbg_dest )
 	{
+	    va_start (args, fmt);
 	    vsyslog (LOG_USER | LOG_DEBUG, fmt, args);
+	    va_end (args);
 	}
-
-	va_end (args);
     }
 }
 
-- 
1.5.2.5

Subject: [PATCH 14/14] remove unnecessary assert from dapl_ep_free.

dat_ep_free must handle the case where a consumer calls
free in CONNECTED or DISCONNECT_PENDING states. After
free calls disconnect, there may be a pending event,
in which case the providers dapls_ib_qp_free will block
accordingly and handle pending events.

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dapl/common/dapl_ep_free.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/dapl/common/dapl_ep_free.c b/dapl/common/dapl_ep_free.c
index e4e6944..62d9644 100644
--- a/dapl/common/dapl_ep_free.c
+++ b/dapl/common/dapl_ep_free.c
@@ -111,14 +111,22 @@ dapl_ep_free (
      * Invoke ep_disconnect to clean up outstanding connections
      */
     (void) dapl_ep_disconnect (ep_ptr, DAT_CLOSE_ABRUPT_FLAG);
-    dapl_os_assert (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECTED
||
-		    ep_ptr->param.ep_state == DAT_EP_STATE_UNCONNECTED);
 
     /*
      * Do verification of parameters and the state change atomically.
      */
     dapl_os_lock ( &ep_ptr->header.lock );
 
+#ifdef DAPL_DBG
+    /* check if event pending and warn, don't assert, state is valid */
+    if (ep_ptr->param.ep_state == DAT_EP_STATE_DISCONNECT_PENDING) {
+        dapl_dbg_log (DAPL_DBG_TYPE_WARN, " dat_ep_free WARNING: "
+                      "EVENT PENDING on ep %p, disconnect "
+                      "and wait before calling dat_ep_free\n",
+                      ep_ptr);
+    }
+#endif
+
     if (ep_ptr->cxn_timer != NULL)
     {
 	dapls_timer_cancel ( ep_ptr->cxn_timer );
-- 
1.5.2.5




More information about the ofw mailing list