[ofa-general] [PATCH] opensm/osm_vendor_ibumad.c: send error callback only when reponse is expected

Sasha Khapyorsky sashak at voltaire.com
Fri Aug 31 03:45:55 PDT 2007


In osm_vendor_send() when sending fails call send error callback only
MADs where response is expected. So outstanding mad counters are updated
properly.

Pointed out and
Acked-by: Hal Rosenstock <hal.rosenstock at gmail.com>

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/libvendor/osm_vendor_ibumad.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/opensm/libvendor/osm_vendor_ibumad.c b/opensm/libvendor/osm_vendor_ibumad.c
index 4618574..461c8bc 100644
--- a/opensm/libvendor/osm_vendor_ibumad.c
+++ b/opensm/libvendor/osm_vendor_ibumad.c
@@ -1120,16 +1120,18 @@ osm_vendor_send(IN osm_bind_handle_t h_bind,
 			     sent_mad_size,
 			     resp_expected ? p_vend->timeout : 0,
 			     p_vend->max_retries)) < 0) {
-		if (resp_expected)
-			get_madw(p_vend, &p_mad->trans_id);	/* remove from aging table */
 		osm_log(p_vend->p_log, OSM_LOG_ERROR,
 			"osm_vendor_send: ERR 5430: "
 			"Send p_madw = %p of size %d failed %d (%m)\n",
 			p_madw, sent_mad_size, ret);
-		p_madw->status = IB_ERROR;
-		pthread_mutex_lock(&p_vend->cb_mutex);
-		(*p_bind->send_err_callback) (p_bind->client_context, p_madw);	/* cb frees madw */
-		pthread_mutex_unlock(&p_vend->cb_mutex);
+		if (resp_expected) {
+			get_madw(p_vend, &p_mad->trans_id);	/* remove from aging table */
+			p_madw->status = IB_ERROR;
+			pthread_mutex_lock(&p_vend->cb_mutex);
+			(*p_bind->send_err_callback) (p_bind->client_context, p_madw);	/* cb frees madw */
+			pthread_mutex_unlock(&p_vend->cb_mutex);
+		} else
+			osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 		goto Exit;
 	}
 
-- 
1.5.3.rc2.38.g11308




More information about the general mailing list