[ofa-general] [PATCH] opensm: remove osm_log reference from osm_mad_pool object

Sasha Khapyorsky sashak at voltaire.com
Sat May 31 15:13:22 PDT 2008


This removes osm_log reference from osm_mad_pool object as well as some
noisy debug prints there. Recently osm_mad_pool was reworked to use
plain malloc allocator instead of complib's cl_qlock_pool so importance
of those messages was reduced.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_mad_pool.h |   12 +-------
 opensm/opensm/libopensm.ver          |    2 +-
 opensm/opensm/osm_mad_pool.c         |   50 +++------------------------------
 opensm/opensm/osm_opensm.c           |    2 +-
 4 files changed, 8 insertions(+), 58 deletions(-)

diff --git a/opensm/include/opensm/osm_mad_pool.h b/opensm/include/opensm/osm_mad_pool.h
index b8421b9..e3234f4 100644
--- a/opensm/include/opensm/osm_mad_pool.h
+++ b/opensm/include/opensm/osm_mad_pool.h
@@ -53,7 +53,6 @@
 #include <opensm/osm_base.h>
 #include <vendor/osm_vendor.h>
 #include <opensm/osm_madw.h>
-#include <opensm/osm_log.h>
 
 #ifdef __cplusplus
 #  define BEGIN_C_DECLS extern "C" {
@@ -95,14 +94,10 @@ BEGIN_C_DECLS
 * SYNOPSIS
 */
 typedef struct _osm_mad_pool {
-	osm_log_t *p_log;
 	atomic32_t mads_out;
 } osm_mad_pool_t;
 /*
 * FIELDS
-*	p_log
-*		Pointer to the log object.
-*
 *	mads_out
 *		Running total of the number of MADs outstanding.
 *
@@ -176,17 +171,12 @@ void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool);
 *
 * SYNOPSIS
 */
-ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool,
-				  IN osm_log_t * const p_log);
+ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool);
 /*
 * PARAMETERS
 *	p_pool
 *		[in] Pointer to an osm_mad_pool_t object to initialize.
 *
-*	p_log
-*		[in] Pointer to the log object.
-*
-*
 * RETURN VALUES
 *	CL_SUCCESS if the MAD Pool was initialized successfully.
 *
diff --git a/opensm/opensm/libopensm.ver b/opensm/opensm/libopensm.ver
index 3324b1a..0d5e9d4 100644
--- a/opensm/opensm/libopensm.ver
+++ b/opensm/opensm/libopensm.ver
@@ -6,4 +6,4 @@
 # API_REV - advance on any added API
 # RUNNING_REV - advance any change to the vendor files
 # AGE - number of backward versions the API still supports
-LIBVERSION=2:1:0
+LIBVERSION=2:2:0
diff --git a/opensm/opensm/osm_mad_pool.c b/opensm/opensm/osm_mad_pool.c
index 9b3812f..a7769d4 100644
--- a/opensm/opensm/osm_mad_pool.c
+++ b/opensm/opensm/osm_mad_pool.c
@@ -53,7 +53,6 @@
 #include <string.h>
 #include <opensm/osm_mad_pool.h>
 #include <opensm/osm_madw.h>
-#include <opensm/osm_log.h>
 #include <vendor/osm_vendor_api.h>
 
 /**********************************************************************
@@ -74,14 +73,10 @@ void osm_mad_pool_destroy(IN osm_mad_pool_t * const p_pool)
 
 /**********************************************************************
  **********************************************************************/
-ib_api_status_t
-osm_mad_pool_init(IN osm_mad_pool_t * const p_pool, IN osm_log_t * const p_log)
+ib_api_status_t osm_mad_pool_init(IN osm_mad_pool_t * const p_pool)
 {
-	OSM_LOG_ENTER(p_log);
+	p_pool->mads_out = 0;
 
-	p_pool->p_log = p_log;
-
-	OSM_LOG_EXIT(p_log);
 	return IB_SUCCESS;
 }
 
@@ -95,8 +90,6 @@ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
 	osm_madw_t *p_madw;
 	ib_mad_t *p_mad;
 
-	OSM_LOG_ENTER(p_pool->p_log);
-
 	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
 	CL_ASSERT(total_size);
 
@@ -104,11 +97,8 @@ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
 	   First, acquire a mad wrapper from the mad wrapper pool.
 	 */
 	p_madw = malloc(sizeof(*p_madw));
-	if (p_madw == NULL) {
-		OSM_LOG(p_pool->p_log, OSM_LOG_ERROR, "ERR 0703: "
-			"Unable to acquire MAD wrapper object\n");
+	if (p_madw == NULL)
 		goto Exit;
-	}
 
 	osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);
 
@@ -117,9 +107,6 @@ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
 	 */
 	p_mad = osm_vendor_get(h_bind, total_size, &p_madw->vend_wrap);
 	if (p_mad == NULL) {
-		OSM_LOG(p_pool->p_log, OSM_LOG_ERROR, "ERR 0704: "
-			"Unable to acquire wire MAD\n");
-
 		/* Don't leak wrappers! */
 		free(p_madw);
 		p_madw = NULL;
@@ -132,13 +119,8 @@ osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
 	 */
 	osm_madw_set_mad(p_madw, p_mad);
 
-	OSM_LOG(p_pool->p_log, OSM_LOG_DEBUG,
-		"Acquired p_madw = %p, p_mad = %p, size = %u\n",
-		p_madw, p_madw->p_mad, total_size);
-
 Exit:
-	OSM_LOG_EXIT(p_pool->p_log);
-	return (p_madw);
+	return p_madw;
 }
 
 /**********************************************************************
@@ -151,8 +133,6 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
 {
 	osm_madw_t *p_madw;
 
-	OSM_LOG_ENTER(p_pool->p_log);
-
 	CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
 	CL_ASSERT(total_size);
 	CL_ASSERT(p_mad);
@@ -161,11 +141,8 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
 	   First, acquire a mad wrapper from the mad wrapper pool.
 	 */
 	p_madw = malloc(sizeof(*p_madw));
-	if (p_madw == NULL) {
-		OSM_LOG(p_pool->p_log, OSM_LOG_ERROR, "ERR 0705: "
-			"Unable to acquire MAD wrapper object\n");
+	if (p_madw == NULL)
 		goto Exit;
-	}
 
 	/*
 	   Finally, initialize the wrapper object.
@@ -174,12 +151,7 @@ osm_madw_t *osm_mad_pool_get_wrapper(IN osm_mad_pool_t * const p_pool,
 	osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);
 	osm_madw_set_mad(p_madw, p_mad);
 
-	OSM_LOG(p_pool->p_log, OSM_LOG_DEBUG,
-		"Acquired p_madw = %p, p_mad = %p size = %u\n",
-		p_madw, p_madw->p_mad, total_size);
-
 Exit:
-	OSM_LOG_EXIT(p_pool->p_log);
 	return (p_madw);
 }
 
@@ -189,19 +161,14 @@ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool)
 {
 	osm_madw_t *p_madw;
 
-	OSM_LOG_ENTER(p_pool->p_log);
-
 	p_madw = malloc(sizeof(*p_madw));
 	if (!p_madw)
 		return NULL;
 
-	OSM_LOG(p_pool->p_log, OSM_LOG_DEBUG, "Getting p_madw = %p\n", p_madw);
-
 	osm_madw_init(p_madw, 0, 0, 0);
 	osm_madw_set_mad(p_madw, 0);
 	cl_atomic_inc(&p_pool->mads_out);
 
-	OSM_LOG_EXIT(p_pool->p_log);
 	return (p_madw);
 }
 
@@ -210,13 +177,8 @@ osm_madw_t *osm_mad_pool_get_wrapper_raw(IN osm_mad_pool_t * const p_pool)
 void
 osm_mad_pool_put(IN osm_mad_pool_t * const p_pool, IN osm_madw_t * const p_madw)
 {
-	OSM_LOG_ENTER(p_pool->p_log);
-
 	CL_ASSERT(p_madw);
 
-	OSM_LOG(p_pool->p_log, OSM_LOG_DEBUG,
-		"Releasing p_madw = %p, p_mad = %p\n", p_madw, p_madw->p_mad);
-
 	/*
 	   First, return the wire mad to the pool
 	 */
@@ -228,6 +190,4 @@ osm_mad_pool_put(IN osm_mad_pool_t * const p_pool, IN osm_madw_t * const p_madw)
 	 */
 	free(p_madw);
 	cl_atomic_dec(&p_pool->mads_out);
-
-	OSM_LOG_EXIT(p_pool->p_log);
 }
diff --git a/opensm/opensm/osm_opensm.c b/opensm/opensm/osm_opensm.c
index aa7ded3..abe55b5 100644
--- a/opensm/opensm/osm_opensm.c
+++ b/opensm/opensm/osm_opensm.c
@@ -314,7 +314,7 @@ osm_opensm_init(IN osm_opensm_t * const p_osm,
 		goto Exit;
 	}
 
-	status = osm_mad_pool_init(&p_osm->mad_pool, &p_osm->log);
+	status = osm_mad_pool_init(&p_osm->mad_pool);
 	if (status != IB_SUCCESS)
 		goto Exit;
 
-- 
1.5.5.1.178.g1f811




More information about the general mailing list