From: stansmith Date: Thu, 20 Mar 2008 23:12:57 +0000 (+0000) Subject: [DAPL2] synchronize Windows source with OFED 1.3 src X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=c213b0c59619117d55365372fc38b3d77181a6d6;p=~shefty%2Frdma-win.git [DAPL2] synchronize Windows source with OFED 1.3 src git-svn-id: svn://openib.tc.cornell.edu/gen1@1002 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/ulp/dapl2/dapl/common/dapl_debug.c b/trunk/ulp/dapl2/dapl/common/dapl_debug.c index 0f2e84a3..7c7c4bc2 100644 --- a/trunk/ulp/dapl2/dapl/common/dapl_debug.c +++ b/trunk/ulp/dapl2/dapl/common/dapl_debug.c @@ -51,19 +51,20 @@ void dapl_internal_dbg_log ( DAPL_DBG_TYPE type, const char *fmt, ...) if ( type & g_dapl_dbg_type ) { - va_start (args, fmt); - 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); } if ( DAPL_DBG_DEST_SYSLOG & g_dapl_dbg_dest ) { + va_start (args, fmt); dapl_os_syslog(fmt, args); + va_end (args); } - va_end (args); } } diff --git a/trunk/ulp/dapl2/dapl/common/dapl_ep_free.c b/trunk/ulp/dapl2/dapl/common/dapl_ep_free.c index 1b09d92e..aed50c97 100644 --- a/trunk/ulp/dapl2/dapl/common/dapl_ep_free.c +++ b/trunk/ulp/dapl2/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 ); diff --git a/trunk/ulp/dapl2/dapl/common/dapl_hca_util.c b/trunk/ulp/dapl2/dapl/common/dapl_hca_util.c index 1254286e..78c17622 100644 --- a/trunk/ulp/dapl2/dapl/common/dapl_hca_util.c +++ b/trunk/ulp/dapl2/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; } /* diff --git a/trunk/ulp/dapl2/dapl/common/dapl_ia_open.c b/trunk/ulp/dapl2/dapl/common/dapl_ia_open.c index 9eba640b..79fd5027 100644 --- a/trunk/ulp/dapl2/dapl/common/dapl_ia_open.c +++ b/trunk/ulp/dapl2/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) */ @@ -420,6 +424,7 @@ dapli_assign_hca_ip_address ( else { hca_ptr->hca_address = * ((DAT_SOCK_ADDR6 *)addr->ai_addr); + dapls_osd_freeaddrinfo (addr); } } diff --git a/trunk/ulp/dapl2/dat/udat/linux/dat_osd.c b/trunk/ulp/dapl2/dat/udat/linux/dat_osd.c index c3a18e60..8eee5e81 100644 --- a/trunk/ulp/dapl2/dat/udat/linux/dat_osd.c +++ b/trunk/ulp/dapl2/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); } } diff --git a/trunk/ulp/dapl2/dat/udat/windows/dat_osd.c b/trunk/ulp/dapl2/dat/udat/windows/dat_osd.c index 3b8d9d97..eccf1347 100644 --- a/trunk/ulp/dapl2/dat/udat/windows/dat_osd.c +++ b/trunk/ulp/dapl2/dat/udat/windows/dat_osd.c @@ -113,16 +113,14 @@ 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); } - - va_end(args); - - fflush(stdout); + /* no syslog() susport in Windows */ } }