[ofa-general] [PATCH] opensm: sweep component processors return status value

Sasha Khapyorsky sashak at voltaire.com
Thu Jun 18 12:12:59 PDT 2009


All sweep component processors (aka managers) will return its status
value instead of OSM_SIGNAL_DONE|OSM_SIGNAL_DONE_PENDING status -
waiting for outstanding MAD responses are automated now in
wait_for_pending_transaction() function.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_base.h    |    4 --
 opensm/include/opensm/osm_lid_mgr.h |   18 ++------
 opensm/opensm/osm_lid_mgr.c         |   77 +++++++++++++----------------------
 opensm/opensm/osm_link_mgr.c        |   56 ++++++++++++-------------
 opensm/opensm/osm_mcast_mgr.c       |   36 ++++++----------
 opensm/opensm/osm_pkey_mgr.c        |   74 ++++++++++++++++------------------
 opensm/opensm/osm_qos.c             |   33 ++++++++-------
 opensm/opensm/osm_state_mgr.c       |   10 ++--
 8 files changed, 130 insertions(+), 178 deletions(-)

diff --git a/opensm/include/opensm/osm_base.h b/opensm/include/opensm/osm_base.h
index bca1133..03eed79 100644
--- a/opensm/include/opensm/osm_base.h
+++ b/opensm/include/opensm/osm_base.h
@@ -793,10 +793,6 @@ typedef enum _osm_thread_state {
 #define OSM_SIGNAL_PERFMGR_SWEEP		3
 #define OSM_SIGNAL_MAX				3
 
-/* status values for sweep managers - can be removed later */
-#define OSM_SIGNAL_DONE		16
-#define OSM_SIGNAL_DONE_PENDING	17
-
 typedef unsigned int osm_signal_t;
 /***********/
 
diff --git a/opensm/include/opensm/osm_lid_mgr.h b/opensm/include/opensm/osm_lid_mgr.h
index d6d1ab8..7e41c0c 100644
--- a/opensm/include/opensm/osm_lid_mgr.h
+++ b/opensm/include/opensm/osm_lid_mgr.h
@@ -96,7 +96,6 @@ typedef struct osm_lid_mgr {
 	osm_db_t *p_db;
 	osm_log_t *p_log;
 	cl_plock_t *p_lock;
-	boolean_t send_set_reqs;
 	osm_db_domain_t *p_g2l;
 	cl_qlist_t free_ranges;
 	uint8_t used_lids[IB_LID_UCAST_END_HO + 1];
@@ -118,9 +117,6 @@ typedef struct osm_lid_mgr {
 *	p_lock
 *		Pointer to the serializing lock.
 *
-*	send_set_reqs
-*		Boolean to indicate whether any set requests sent.
-*
 *	p_g2l
 *		Pointer to the database domain storing guid to lid mapping.
 *
@@ -239,17 +235,14 @@ osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN struct osm_sm * sm);
 *
 * SYNOPSIS
 */
-osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
+int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_lid_mgr_t object.
 *
 * RETURN VALUES
-*	Returns the appropriate signal to the caller:
-*		OSM_SIGNAL_DONE - operation is complete
-*		OSM_SIGNAL_DONE_PENDING - local operations are complete, but
-*			transactions are still pending on the wire.
+*	Returns 0 on success and non-zero value otherwise.
 *
 * NOTES
 *
@@ -267,17 +260,14 @@ osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
 *
 * SYNOPSIS
 */
-osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr);
+int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr);
 /*
 * PARAMETERS
 *	p_mgr
 *		[in] Pointer to an osm_lid_mgr_t object.
 *
 * RETURN VALUES
-*	Returns the appropriate signal to the caller:
-*		OSM_SIGNAL_DONE - operation is complete
-*		OSM_SIGNAL_DONE_PENDING - local operations are complete, but
-*			transactions are still pending on the wire.
+*	Returns 0 on success and non-zero value otherwise.
 *
 * NOTES
 *
diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index e1d5106..34625ba 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -821,10 +821,10 @@ static void lid_mgr_set_remote_pi_state_to_init(IN osm_lid_mgr_t * p_mgr,
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
-				      IN osm_port_t * p_port,
-				      IN osm_physp_t * p_physp,
-				      IN ib_net16_t const lid)
+static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
+				IN osm_port_t * p_port,
+				IN osm_physp_t * p_physp,
+				IN ib_net16_t const lid)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_port_info_t *p_pi = (ib_port_info_t *) payload;
@@ -836,6 +836,7 @@ static boolean_t lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 	uint8_t op_vls;
 	uint8_t port_num;
 	boolean_t send_set = FALSE;
+	int ret = 0;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -1068,31 +1069,31 @@ static boolean_t lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
 	if (p_mgr->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
-	if (send_set) {
-		p_mgr->send_set_reqs = TRUE;
-		status = osm_req_set(p_mgr->sm,
-				     osm_physp_get_dr_path_ptr(p_physp),
-				     payload, sizeof(payload),
-				     IB_MAD_ATTR_PORT_INFO,
-				     cl_hton32(osm_physp_get_port_num(p_physp)),
-				     CL_DISP_MSGID_NONE, &context);
-	}
+	if (!send_set)
+		goto Exit;
+
+	status = osm_req_set(p_mgr->sm, osm_physp_get_dr_path_ptr(p_physp),
+			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
+			     cl_hton32(osm_physp_get_port_num(p_physp)),
+			     CL_DISP_MSGID_NONE, &context);
+	if (status != IB_SUCCESS)
+		ret = -1;
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return send_set;
+	return ret;
 }
 
 /**********************************************************************
  Processes our own node
  Lock must already be held.
 **********************************************************************/
-static boolean_t lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)
+static int lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)
 {
 	osm_port_t *p_port;
 	uint16_t min_lid_ho;
 	uint16_t max_lid_ho;
-	boolean_t res = TRUE;
+	int ret;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -1105,7 +1106,7 @@ static boolean_t lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)
 		OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR, "ERR 0308: "
 			"Can't acquire SM's port object, GUID 0x%016" PRIx64
 			"\n", cl_ntoh64(p_mgr->p_subn->sm_port_guid));
-		res = FALSE;
+		ret = -1;
 		goto Exit;
 	}
 
@@ -1134,19 +1135,19 @@ static boolean_t lid_mgr_process_our_sm_node(IN osm_lid_mgr_t * p_mgr)
 	/*
 	   Set the PortInfo the Physical Port associated with this Port.
 	 */
-	lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
-			     cl_hton16(min_lid_ho));
+	ret = lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
+				   cl_hton16(min_lid_ho));
 
 Exit:
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return res;
+	return ret;
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
+int osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
 {
-	osm_signal_t signal = OSM_SIGNAL_DONE_PENDING;
+	int ret;
 
 	OSM_LOG_ENTER(p_mgr->p_log);
 
@@ -1158,21 +1159,12 @@ osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
 	   persistent db */
 	lid_mgr_init_sweep(p_mgr);
 
-	/* Set the send_set_reqs of the p_mgr to FALSE, and
-	   we'll see if any set requests were sent. If not -
-	   can signal OSM_SIGNAL_DONE */
-	p_mgr->send_set_reqs = FALSE;
-	if (lid_mgr_process_our_sm_node(p_mgr) == FALSE)
-		/* The initialization failed */
-		signal = OSM_SIGNAL_DONE;
-
-	if (p_mgr->send_set_reqs == FALSE)
-		signal = OSM_SIGNAL_DONE;
+	ret = lid_mgr_process_our_sm_node(p_mgr);
 
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (signal);
+	return ret;
 }
 
 /**********************************************************************
@@ -1181,14 +1173,13 @@ osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * p_mgr)
  1.2 if a change is required send the port info
  2 if any change send the signal PENDING...
 **********************************************************************/
-osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
+int osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
 {
-	osm_signal_t signal;
 	cl_qmap_t *p_port_guid_tbl;
 	osm_port_t *p_port;
 	ib_net64_t port_guid;
+	int lid_changed, ret = 0;
 	uint16_t min_lid_ho, max_lid_ho;
-	int lid_changed;
 
 	CL_ASSERT(p_mgr);
 
@@ -1198,11 +1189,6 @@ osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
 
 	CL_ASSERT(p_mgr->p_subn->sm_port_guid);
 
-	/* Set the send_set_reqs of the p_mgr to FALSE, and
-	   we'll see if any set requests were sent. If not -
-	   can signal OSM_SIGNAL_DONE */
-	p_mgr->send_set_reqs = FALSE;
-
 	p_port_guid_tbl = &p_mgr->p_subn->port_guid_tbl;
 
 	for (p_port = (osm_port_t *) cl_qmap_head(p_port_guid_tbl);
@@ -1244,19 +1230,14 @@ osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * p_mgr)
 		/* the proc returns the fact it sent a set port info */
 		if (lid_mgr_set_physp_pi(p_mgr, p_port, p_port->p_physp,
 					 cl_hton16(min_lid_ho)))
-			p_mgr->send_set_reqs = TRUE;
+			ret = -1;
 	}			/* all ports */
 
 	/* store the guid to lid table in persistent db */
 	osm_db_store(p_mgr->p_g2l);
 
-	if (p_mgr->send_set_reqs == FALSE)
-		signal = OSM_SIGNAL_DONE;
-	else
-		signal = OSM_SIGNAL_DONE_PENDING;
-
 	CL_PLOCK_RELEASE(p_mgr->p_lock);
 
 	OSM_LOG_EXIT(p_mgr->p_log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index d189471..285096c 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -93,8 +93,8 @@ static uint8_t link_mgr_get_smsl(IN osm_sm_t * sm, IN osm_physp_t * p_physp)
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
-				       IN uint8_t port_state)
+static int link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
+				 IN uint8_t port_state)
 {
 	uint8_t payload[IB_SMP_DATA_SIZE];
 	ib_port_info_t *p_pi = (ib_port_info_t *) payload;
@@ -102,13 +102,10 @@ static boolean_t link_mgr_set_physp_pi(osm_sm_t * sm, IN osm_physp_t * p_physp,
 	osm_madw_context_t context;
 	osm_node_t *p_node;
 	ib_api_status_t status;
-	uint8_t port_num;
-	uint8_t mtu;
-	uint8_t smsl = OSM_DEFAULT_SL;
-	uint8_t op_vls;
-	boolean_t esp0 = FALSE;
-	boolean_t send_set = FALSE;
+	uint8_t port_num, mtu, op_vls, smsl = OSM_DEFAULT_SL;
+	boolean_t esp0 = FALSE, send_set = FALSE;
 	osm_physp_t *p_remote_physp;
+	int ret = 0;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -391,28 +388,29 @@ Send:
 	    && sm->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
-	if (send_set)
-		status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
-				     payload, sizeof(payload),
-				     IB_MAD_ATTR_PORT_INFO,
-				     cl_hton32(port_num),
-				     CL_DISP_MSGID_NONE, &context);
+	if (!send_set)
+		goto Exit;
+
+	status = osm_req_set(sm, osm_physp_get_dr_path_ptr(p_physp),
+			     payload, sizeof(payload), IB_MAD_ATTR_PORT_INFO,
+			     cl_hton32(port_num), CL_DISP_MSGID_NONE, &context);
+	if (status)
+		ret = -1;
 
 Exit:
 	OSM_LOG_EXIT(sm->p_log);
-	return send_set;
+	return ret;
 }
 
 /**********************************************************************
  **********************************************************************/
-static osm_signal_t link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
-					  IN const uint8_t link_state)
+static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
+				 IN const uint8_t link_state)
 {
-	uint32_t i;
-	uint32_t num_physp;
 	osm_physp_t *p_physp;
+	uint32_t i, num_physp;
+	int ret = 0;
 	uint8_t current_state;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -453,20 +451,20 @@ static osm_signal_t link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
 				p_physp->port_num,
 				ib_get_port_state_str(current_state));
 		else if (link_mgr_set_physp_pi(sm, p_physp, link_state))
-			signal = OSM_SIGNAL_DONE_PENDING;
+			ret = -1;
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (signal);
+	return ret;
 }
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
+int osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
 {
 	cl_qmap_t *p_node_guid_tbl;
 	osm_node_t *p_node;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	int ret = 0;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -476,14 +474,12 @@ osm_signal_t osm_link_mgr_process(osm_sm_t * sm, IN const uint8_t link_state)
 
 	for (p_node = (osm_node_t *) cl_qmap_head(p_node_guid_tbl);
 	     p_node != (osm_node_t *) cl_qmap_end(p_node_guid_tbl);
-	     p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item)) {
-		if (link_mgr_process_node(sm, p_node, link_state) ==
-		    OSM_SIGNAL_DONE_PENDING)
-			signal = OSM_SIGNAL_DONE_PENDING;
-	}
+	     p_node = (osm_node_t *) cl_qmap_next(&p_node->map_item))
+		if (link_mgr_process_node(sm, p_node, link_state))
+			ret = -1;
 
 	CL_PLOCK_RELEASE(sm->p_lock);
 
 	OSM_LOG_EXIT(sm->p_log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index de0a8a5..ea49588 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -321,7 +321,7 @@ static osm_switch_t *mcast_mgr_find_root_switch(osm_sm_t * sm,
 
 /**********************************************************************
  **********************************************************************/
-static osm_signal_t mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * p_sw)
+static int mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * p_sw)
 {
 	osm_node_t *p_node;
 	osm_dr_path_t *p_path;
@@ -333,7 +333,7 @@ static osm_signal_t mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * p_sw)
 	uint32_t max_position;
 	osm_mcast_tbl_t *p_tbl;
 	ib_net16_t block[IB_MCAST_BLOCK_SIZE];
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	int ret = 0;
 
 	CL_ASSERT(sm);
 
@@ -375,10 +375,9 @@ static osm_signal_t mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * p_sw)
 			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0A02: "
 				"Sending multicast fwd. tbl. block failed (%s)\n",
 				ib_get_err_str(status));
+			ret = -1;
 		}
 
-		signal = OSM_SIGNAL_DONE_PENDING;
-
 		if (++position > max_position) {
 			position = 0;
 			block_num++;
@@ -386,7 +385,7 @@ static osm_signal_t mcast_mgr_set_tbl(osm_sm_t * sm, IN osm_switch_t * p_sw)
 	}
 
 	OSM_LOG_EXIT(sm->p_log);
-	return signal;
+	return ret;
 }
 
 /**********************************************************************
@@ -1104,15 +1103,13 @@ Exit:
 
 /**********************************************************************
  **********************************************************************/
-osm_signal_t osm_mcast_mgr_process(osm_sm_t * sm)
+int osm_mcast_mgr_process(osm_sm_t * sm)
 {
-	osm_signal_t signal;
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
 	cl_qlist_t *p_list = &sm->mgrp_list;
 	osm_mgrp_t *p_mgrp;
-	boolean_t pending_transactions = FALSE;
-	int i;
+	int i, ret = 0;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -1142,9 +1139,8 @@ osm_signal_t osm_mcast_mgr_process(osm_sm_t * sm)
 	 */
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		signal = mcast_mgr_set_tbl(sm, p_sw);
-		if (signal == OSM_SIGNAL_DONE_PENDING)
-			pending_transactions = TRUE;
+		if (mcast_mgr_set_tbl(sm, p_sw))
+			ret = -1;
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
@@ -1157,25 +1153,22 @@ osm_signal_t osm_mcast_mgr_process(osm_sm_t * sm)
 
 	OSM_LOG_EXIT(sm->p_log);
 
-	if (pending_transactions == TRUE)
-		return (OSM_SIGNAL_DONE_PENDING);
-	else
-		return (OSM_SIGNAL_DONE);
+	return ret;
 }
 
 /**********************************************************************
   This is the function that is invoked during idle time to handle the
   process request for mcast groups where join/leave/delete was required.
  **********************************************************************/
-osm_signal_t osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
+int osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
 {
 	cl_qlist_t *p_list = &sm->mgrp_list;
 	osm_switch_t *p_sw;
 	cl_qmap_t *p_sw_tbl;
 	osm_mgrp_t *p_mgrp;
 	ib_net16_t mlid;
-	osm_signal_t ret, signal = OSM_SIGNAL_DONE;
 	osm_mcast_mgr_ctxt_t *ctx;
+	int ret = 0;
 
 	OSM_LOG_ENTER(sm->p_log);
 
@@ -1219,9 +1212,8 @@ osm_signal_t osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
 	p_sw_tbl = &sm->p_subn->sw_guid_tbl;
 	p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
 	while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-		ret = mcast_mgr_set_tbl(sm, p_sw);
-		if (ret == OSM_SIGNAL_DONE_PENDING)
-			signal = ret;
+		if (mcast_mgr_set_tbl(sm, p_sw))
+			ret = -1;
 		p_sw = (osm_switch_t *) cl_qmap_next(&p_sw->map_item);
 	}
 
@@ -1229,5 +1221,5 @@ osm_signal_t osm_mcast_mgr_process_mgroups(osm_sm_t * sm)
 
 	CL_PLOCK_RELEASE(sm->p_lock);
 	OSM_LOG_EXIT(sm->p_log);
-	return signal;
+	return ret;
 }
diff --git a/opensm/opensm/osm_pkey_mgr.c b/opensm/opensm/osm_pkey_mgr.c
index 9b76ed7..6b23b27 100644
--- a/opensm/opensm/osm_pkey_mgr.c
+++ b/opensm/opensm/osm_pkey_mgr.c
@@ -189,7 +189,7 @@ pkey_mgr_update_pkey_entry(IN osm_sm_t * sm,
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t
+static ib_api_status_t
 pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 			   IN osm_physp_t * p_physp, IN const boolean_t enforce)
 {
@@ -207,7 +207,7 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
 			osm_physp_get_port_num(p_physp));
-		return FALSE;
+		return IB_SUCCESS;
 	}
 
 	memset(payload, 0, IB_SMP_DATA_SIZE);
@@ -233,28 +233,26 @@ pkey_mgr_enforce_partition(IN osm_log_t * p_log, osm_sm_t * sm,
 			     IB_MAD_ATTR_PORT_INFO,
 			     cl_hton32(osm_physp_get_port_num(p_physp)),
 			     CL_DISP_MSGID_NONE, &context);
-	if (status != IB_SUCCESS) {
+	if (status != IB_SUCCESS)
 		OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0511: "
 			"Failed to set PortInfo for "
 			"node 0x%016" PRIx64 " port %u\n",
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
 			osm_physp_get_port_num(p_physp));
-		return FALSE;
-	} else {
+	else
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"Set PortInfo for node 0x%016" PRIx64 " port %u\n",
 			cl_ntoh64(osm_node_get_node_guid
 				  (osm_physp_get_node_ptr(p_physp))),
 			osm_physp_get_port_num(p_physp));
-		return TRUE;
-	}
+	return status;
 }
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
-				      const osm_port_t * const p_port)
+static int pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
+				const osm_port_t * const p_port)
 {
 	osm_physp_t *p_physp;
 	osm_node_t *p_node;
@@ -267,10 +265,10 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 	uint16_t num_of_blocks;
 	uint16_t max_num_of_blocks;
 	ib_api_status_t status;
-	boolean_t ret_val = FALSE;
 	osm_pending_pkey_t *p_pending;
 	boolean_t found;
 	ib_pkey_table_t empty_block;
+	int ret = 0;
 
 	memset(&empty_block, 0, sizeof(ib_pkey_table_t));
 
@@ -360,32 +358,32 @@ static boolean_t pkey_mgr_update_port(osm_log_t * p_log, osm_sm_t * sm,
 		status =
 		    pkey_mgr_update_pkey_entry(sm, p_physp, new_block,
 					       block_index);
-		if (status == IB_SUCCESS) {
+		if (status == IB_SUCCESS)
 			OSM_LOG(p_log, OSM_LOG_DEBUG,
 				"Updated pkey table block %d for node 0x%016"
 				PRIx64 " port %u\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				osm_physp_get_port_num(p_physp));
-			ret_val = TRUE;
-		} else {
+		else {
 			OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0506: "
 				"pkey_mgr_update_pkey_entry() failed to update "
 				"pkey table block %d for node 0x%016" PRIx64
 				" port %u\n", block_index,
 				cl_ntoh64(osm_node_get_node_guid(p_node)),
 				osm_physp_get_port_num(p_physp));
+			ret = -1;
 		}
 	}
 
-	return ret_val;
+	return ret;
 }
 
 /**********************************************************************
  **********************************************************************/
-static boolean_t
-pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
-			  const osm_subn_t * p_subn,
-			  const osm_port_t * const p_port, boolean_t enforce)
+static int pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
+				     const osm_subn_t * p_subn,
+				     const osm_port_t * const p_port,
+				     boolean_t enforce)
 {
 	osm_physp_t *p_physp, *peer;
 	osm_node_t *p_node;
@@ -396,21 +394,20 @@ pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
 	uint16_t num_of_blocks;
 	uint16_t peer_max_blocks;
 	ib_api_status_t status = IB_SUCCESS;
-	boolean_t ret_val = FALSE;
-	boolean_t port_info_set = FALSE;
 	ib_pkey_table_t empty_block;
+	int ret = 0;
 
 	memset(&empty_block, 0, sizeof(ib_pkey_table_t));
 
 	p_physp = p_port->p_physp;
 	if (!p_physp)
-		return FALSE;
+		return -1;
 	peer = osm_physp_get_remote(p_physp);
 	if (!peer)
-		return FALSE;
+		return -1;
 	p_node = osm_physp_get_node_ptr(peer);
 	if (!p_node->sw || !p_node->sw->switch_info.enforce_cap)
-		return FALSE;
+		return 0;
 
 	p_pkey_tbl = osm_physp_get_pkey_tbl(p_physp);
 	p_peer_pkey_tbl = &peer->pkeys;
@@ -424,13 +421,14 @@ pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
 			osm_physp_get_port_num(peer));
 		enforce = FALSE;
+		ret = -1;
 	}
 
 	if (pkey_mgr_enforce_partition(p_log, sm, peer, enforce))
-		port_info_set = TRUE;
+		ret = -1;
 
 	if (enforce == FALSE)
-		return port_info_set;
+		return ret;
 
 	p_peer_pkey_tbl->used_blocks = p_pkey_tbl->used_blocks;
 	for (block_index = 0; block_index < p_pkey_tbl->used_blocks;
@@ -443,12 +441,9 @@ pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
 		    osm_pkey_tbl_block_get(p_peer_pkey_tbl, block_index);
 		if (!peer_block
 		    || memcmp(peer_block, block, sizeof(*peer_block))) {
-			status =
-			    pkey_mgr_update_pkey_entry(sm, peer, block,
-						       block_index);
-			if (status == IB_SUCCESS)
-				ret_val = TRUE;
-			else
+			status = pkey_mgr_update_pkey_entry(sm, peer, block,
+							    block_index);
+			if (status != IB_SUCCESS) {
 				OSM_LOG(p_log, OSM_LOG_ERROR, "ERR 0509: "
 					"pkey_mgr_update_pkey_entry() failed to update "
 					"pkey table block %d for node 0x%016"
@@ -456,19 +451,19 @@ pkey_mgr_update_peer_port(osm_log_t * p_log, osm_sm_t * sm,
 					cl_ntoh64(osm_node_get_node_guid
 						  (p_node)),
 					osm_physp_get_port_num(peer));
+				ret = -1;
+			}
 		}
 	}
 
-	if (ret_val)
+	if (!ret)
 		OSM_LOG(p_log, OSM_LOG_DEBUG,
 			"Pkey table was updated for node 0x%016" PRIx64
 			" port %u\n",
 			cl_ntoh64(osm_node_get_node_guid(p_node)),
 			osm_physp_get_port_num(peer));
 
-	if (port_info_set)
-		return TRUE;
-	return ret_val;
+	return ret;
 }
 
 /**********************************************************************
@@ -479,7 +474,7 @@ osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 	cl_map_item_t *p_next;
 	osm_prtn_t *p_prtn;
 	osm_port_t *p_port;
-	osm_signal_t signal = OSM_SIGNAL_DONE;
+	int ret = 0;
 
 	CL_ASSERT(p_osm);
 
@@ -490,6 +485,7 @@ osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 	if (osm_prtn_make_partitions(&p_osm->log, &p_osm->subn) != IB_SUCCESS) {
 		OSM_LOG(&p_osm->log, OSM_LOG_ERROR, "ERR 0510: "
 			"osm_prtn_make_partitions() failed\n");
+		ret = -1;
 		goto _err;
 	}
 
@@ -512,17 +508,17 @@ osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm)
 		p_port = (osm_port_t *) p_next;
 		p_next = cl_qmap_next(p_next);
 		if (pkey_mgr_update_port(&p_osm->log, &p_osm->sm, p_port))
-			signal = OSM_SIGNAL_DONE_PENDING;
+			ret = -1;
 		if ((osm_node_get_type(p_port->p_node) != IB_NODE_TYPE_SWITCH)
 		    && pkey_mgr_update_peer_port(&p_osm->log, &p_osm->sm,
 						 &p_osm->subn, p_port,
 						 !p_osm->subn.opt.
 						 no_partition_enforcement))
-			signal = OSM_SIGNAL_DONE_PENDING;
+			ret = -1;
 	}
 
 _err:
 	CL_PLOCK_RELEASE(&p_osm->lock);
 	OSM_LOG_EXIT(&p_osm->log);
-	return (signal);
+	return ret;
 }
diff --git a/opensm/opensm/osm_qos.c b/opensm/opensm/osm_qos.c
index d0aa866..e3dfb58 100644
--- a/opensm/opensm/osm_qos.c
+++ b/opensm/opensm/osm_qos.c
@@ -222,10 +222,10 @@ static ib_api_status_t sl2vl_update(osm_sm_t * sm, osm_port_t * p_port,
 	return IB_SUCCESS;
 }
 
-static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm,
-				       osm_port_t * p_port, osm_physp_t * p,
-				       uint8_t port_num, unsigned force_update,
-				       const struct qos_config *qcfg)
+static int qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm,
+			   osm_port_t * p_port, osm_physp_t * p,
+			   uint8_t port_num, unsigned force_update,
+			   const struct qos_config *qcfg)
 {
 	ib_api_status_t status;
 
@@ -241,7 +241,7 @@ static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm,
 			"failed to update VLArbitration tables "
 			"for port %" PRIx64 " #%d\n",
 			cl_ntoh64(p->port_guid), port_num);
-		return status;
+		return -1;
 	}
 
 	/* setup SL2VL tables */
@@ -251,13 +251,13 @@ static ib_api_status_t qos_physp_setup(osm_log_t * p_log, osm_sm_t * sm,
 			"failed to update SL2VLMapping tables "
 			"for port %" PRIx64 " #%d\n",
 			cl_ntoh64(p->port_guid), port_num);
-		return status;
+		return -1;
 	}
 
-	return IB_SUCCESS;
+	return 0;
 }
 
-osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
+int osm_qos_setup(osm_opensm_t * p_osm)
 {
 	struct qos_config ca_config, sw0_config, swe_config, rtr_config;
 	struct qos_config *cfg;
@@ -267,12 +267,12 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 	uint32_t num_physp;
 	osm_physp_t *p_physp;
 	osm_node_t *p_node;
-	ib_api_status_t status;
 	unsigned force_update;
+	int ret = 0;
 	uint8_t i;
 
 	if (!p_osm->subn.opt.qos)
-		return OSM_SIGNAL_DONE;
+		return 0;
 
 	OSM_LOG_ENTER(&p_osm->log);
 
@@ -305,10 +305,10 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 					continue;
 				force_update = p_physp->need_update ||
 				    p_osm->subn.need_update;
-				status =
-				    qos_physp_setup(&p_osm->log, &p_osm->sm,
+				if (qos_physp_setup(&p_osm->log, &p_osm->sm,
 						    p_port, p_physp, i,
-						    force_update, &swe_config);
+						    force_update, &swe_config))
+					ret = -1;
 			}
 			/* skip base port 0 */
 			if (!ib_switch_info_is_enhanced_port0
@@ -326,14 +326,15 @@ osm_signal_t osm_qos_setup(osm_opensm_t * p_osm)
 			continue;
 
 		force_update = p_physp->need_update || p_osm->subn.need_update;
-		status = qos_physp_setup(&p_osm->log, &p_osm->sm, p_port,
-					 p_physp, 0, force_update, cfg);
+		if (qos_physp_setup(&p_osm->log, &p_osm->sm, p_port, p_physp,
+				    0, force_update, cfg))
+			ret = -1;
 	}
 
 	cl_plock_release(&p_osm->lock);
 	OSM_LOG_EXIT(&p_osm->log);
 
-	return OSM_SIGNAL_DONE;
+	return ret;
 }
 
 /*
diff --git a/opensm/opensm/osm_state_mgr.c b/opensm/opensm/osm_state_mgr.c
index a3e3609..adc39a0 100644
--- a/opensm/opensm/osm_state_mgr.c
+++ b/opensm/opensm/osm_state_mgr.c
@@ -64,11 +64,11 @@
 #include <opensm/osm_opensm.h>
 
 extern void osm_drop_mgr_process(IN osm_sm_t * sm);
-extern osm_signal_t osm_qos_setup(IN osm_opensm_t * p_osm);
-extern osm_signal_t osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
-extern osm_signal_t osm_mcast_mgr_process(IN osm_sm_t * sm);
-extern osm_signal_t osm_mcast_mgr_process_mgroups(IN osm_sm_t * sm);
-extern osm_signal_t osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state);
+extern int osm_qos_setup(IN osm_opensm_t * p_osm);
+extern int osm_pkey_mgr_process(IN osm_opensm_t * p_osm);
+extern int osm_mcast_mgr_process(IN osm_sm_t * sm);
+extern int osm_mcast_mgr_process_mgroups(IN osm_sm_t * sm);
+extern int osm_link_mgr_process(IN osm_sm_t * sm, IN uint8_t state);
 
 /**********************************************************************
  **********************************************************************/
-- 
1.6.3.1




More information about the general mailing list