[ofa-general] [PATCH] opensm: eliminate some unneeded PortInfo Set requests

Sasha Khapyorsky sashak at voltaire.com
Mon Nov 12 13:11:08 PST 2007


This removes osm_physp_t got_set_resp flag and in this way eliminates
some unneeded PortInfo Set requests. Originally this flag becomes TRUE
only when PortInfo SetResp is arrived, and unless it is TRUE PortInfo
Set request will be enforced (which means each port on a subnet will
get PortInfo Set at least once). OTOH port could be already configured
properly, in this case Set is not needed.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/include/opensm/osm_port.h  |   11 -----------
 opensm/opensm/osm_lid_mgr.c       |    9 +++++----
 opensm/opensm/osm_link_mgr.c      |   26 +++++++++++---------------
 opensm/opensm/osm_port_info_rcv.c |    3 ---
 4 files changed, 16 insertions(+), 33 deletions(-)

diff --git a/opensm/include/opensm/osm_port.h b/opensm/include/opensm/osm_port.h
index f2cfe18..ea60bfe 100644
--- a/opensm/include/opensm/osm_port.h
+++ b/opensm/include/opensm/osm_port.h
@@ -121,7 +121,6 @@ typedef struct _osm_physp {
 	osm_pkey_tbl_t pkeys;
 	ib_vl_arb_table_t vl_arb[4];
 	cl_ptr_vector_t slvl_by_port;
-	boolean_t got_set_resp;
 } osm_physp_t;
 /*
 * FIELDS
@@ -174,16 +173,6 @@ typedef struct _osm_physp {
 *		On switches have an entry for every other input port (inc SMA=0).
 *		On CAs only one per port.
 *
-*	got_set_resp
-*		Marks whether or not we got a PortInfoSetResp from this port or not.
-*		This is used for minimizing the number of PortInfoSet requests sent.
-*		If we already got a set response from this port, then we will
-*		send a PortInfoSet only if the values we are updating are
-*		different than the ones on the port. If the haven't gotten a set
-*		response - then we want to send the request anyways - since
-*		every we need at least one PortInfoSet request for every port
-*		(by a new SM).
-*
 * SEE ALSO
 *	Port
 *********/
diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index 076d0e9..41e42bd 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -973,6 +973,10 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	p_pi->state_info2 = 0x02;
 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
 
+	/* didn't get PortInfo before */
+	if (!ib_port_info_get_port_state(p_old_pi))
+		send_set = TRUE;
+
 	p_pi->m_key = p_mgr->p_subn->opt.m_key;
 	if (memcmp(&p_pi->m_key, &p_old_pi->m_key, sizeof(p_pi->m_key)))
 		send_set = TRUE;
@@ -1144,11 +1148,8 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	   2. first_time_master_sweep flag on the subnet is TRUE. This means the
 	   SM just became master, and it then needs to send a PortInfo Set to
 	   every port.
-	   3. got_set_resp on the physical port is FALSE. This means we haven't seen
-	   this port before and we need to send Set of PortInfo to it.
 	 */
-	if (p_mgr->p_subn->first_time_master_sweep == TRUE ||
-	    p_physp->got_set_resp == FALSE)
+	if (p_mgr->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
 	if (send_set) {
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index 80e34b2..768d4c4 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -180,6 +180,10 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 	p_pi->state_info2 = 0x02;
 	ib_port_info_set_port_state(p_pi, port_state);
 
+	/* didn't get PortInfo before */
+	if (!ib_port_info_get_port_state(p_old_pi))
+		send_set = TRUE;
+
 	/* we only change port fields if we do not change state */
 	if (port_state == IB_LINK_NO_CHANGE) {
 		/* The following fields are relevant only for CA port, router, or Enh. SP0 */
@@ -351,8 +355,7 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		context.pi_context.ignore_errors = FALSE;
 
 	if (port_state != IB_LINK_NO_CHANGE &&
-	    ib_port_info_get_port_state(p_pi) !=
-	    ib_port_info_get_port_state(p_old_pi)) {
+	    port_state != ib_port_info_get_port_state(p_old_pi)) {
 		send_set = TRUE;
 		if (port_state == IB_LINK_ACTIVE)
 			context.pi_context.active_transition = TRUE;
@@ -369,20 +372,13 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 	/* We need to send the PortInfoSet request with the new sm_lid
 	   in the following cases:
 	   1. There is a change in the values (send_set == TRUE)
-	   2. This is an ca port or a switch port 0 and got_set_resp is FALSE
-	   (in this case we sent a PortInfoSet in the osm_lid_mgr, but for some
-	   reason we didn't get a response) - try and re-send.
-	   3. This is a switch port and:
-	   a. first_time_master_sweep flag on the subnet is TRUE. This means the
-	   SM just became master, and it then needs to send at PortInfoSet to
-	   every port (and this is the first time we can send a PortInfoSet to
-	   switch external ports).
-	   b. got_set_resp on the physical port is FALSE. This means we haven't
-	   seen this port before - need to send PortInfoSet to it.
+	   2. This is a switch external port (so it wasn't handled yet by
+	   osm_lid_mgr) and first_time_master_sweep flag on the subnet is TRUE,
+	   which means the SM just became master, and it then needs to send at
+	   PortInfoSet to every port.
 	 */
-	if (p_physp->got_set_resp == FALSE
-	    || (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH && port_num
-		&& p_mgr->p_subn->first_time_master_sweep == TRUE))
+	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH && port_num
+	    && p_mgr->p_subn->first_time_master_sweep == TRUE)
 		send_set = TRUE;
 
 	if (send_set) {
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index 68a04b9..70ee7df 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -563,9 +563,6 @@ osm_pi_rcv_process_set(IN const osm_pi_rcv_t * const p_rcv,
 
 	osm_physp_set_port_info(p_physp, p_pi);
 
-	/* We got a PortInfoSetResp - set the got_set_resp flag to TRUE */
-	p_physp->got_set_resp = TRUE;
-
 	OSM_LOG_EXIT(p_rcv->p_log);
 }
 
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list