[ofa-general] Re: [PATCH v2] opensm: fix PortInfo update issues.

Sasha Khapyorsky sashak at voltaire.com
Mon Nov 12 14:34:42 PST 2007


This fixes PortInfo update for switch port 0 (esp0 in link_mgr) -
handle it as end port.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_lid_mgr.c  |   26 ++++++--------------------
 opensm/opensm/osm_link_mgr.c |   11 +++--------
 2 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/opensm/opensm/osm_lid_mgr.c b/opensm/opensm/osm_lid_mgr.c
index d25605f..c85f6f6 100644
--- a/opensm/opensm/osm_lid_mgr.c
+++ b/opensm/opensm/osm_lid_mgr.c
@@ -959,15 +959,9 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	 */
 
 	memset(payload, 0, IB_SMP_DATA_SIZE);
-
-	/* Correction by FUJITSU */
-	if (port_num != 0)
-		memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
+	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
 
 	/*
-	   Correction following a bug injected by the previous
-	   FUJITSU line:
-
 	   Should never write back a value that is bigger then 3 in
 	   the PortPhysicalState field, so cannot simply copy!
 
@@ -976,21 +970,13 @@ __osm_lid_mgr_set_physp_pi(IN osm_lid_mgr_t * const p_mgr,
 	   link down default state = polling
 	   port state - no change
 	 */
-	/* these values can be set only for ca ports, so if we are
-	   on a switch node, set these values to zero */
-	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH)
-		p_pi->state_info2 = 0x0;
-	else {
-		p_pi->state_info2 = 0x02;
-		/* Check to see if the value we are setting is different than
-		   the value in the port_info. If it is, turn on send_set flag */
-		if (ib_port_info_get_link_down_def_state(p_pi) !=
-		    ib_port_info_get_link_down_def_state(p_old_pi))
-			send_set = TRUE;
-	}
-
+	p_pi->state_info2 = 0x02;
 	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
 
+	if (ib_port_info_get_link_down_def_state(p_pi) !=
+	    ib_port_info_get_link_down_def_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;
diff --git a/opensm/opensm/osm_link_mgr.c b/opensm/opensm/osm_link_mgr.c
index b151c76..5cfd93b 100644
--- a/opensm/opensm/osm_link_mgr.c
+++ b/opensm/opensm/osm_link_mgr.c
@@ -166,24 +166,20 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 	p_old_pi = &p_physp->port_info;
 
 	memset(payload, 0, IB_SMP_DATA_SIZE);
-
-	/* Correction by FUJITSU */
 	memcpy(payload, p_old_pi, sizeof(ib_port_info_t));
 
 	/*
-	   Correction following a bug injected by the previous
-	   FUJITSU line:
-
 	   Should never write back a value that is bigger then 3 in
 	   the PortPhysicalState field - so can not simply copy!
 
 	   Actually we want to write there:
 	   port physical state - no change,
 	   link down default state = polling
-	   port state - no change
+	   port state - as requested.
 	 */
 	p_pi->state_info2 = 0x02;
-	ib_port_info_set_port_state(p_pi, IB_LINK_NO_CHANGE);
+	ib_port_info_set_port_state(p_pi, port_state);
+
 	if (ib_port_info_get_link_down_def_state(p_pi) !=
 	    ib_port_info_get_link_down_def_state(p_old_pi))
 		send_set = TRUE;
@@ -358,7 +354,6 @@ __osm_link_mgr_set_physp_pi(IN osm_link_mgr_t * const p_mgr,
 		 */
 		context.pi_context.ignore_errors = FALSE;
 
-	ib_port_info_set_port_state(p_pi, port_state);
 	if (port_state != IB_LINK_NO_CHANGE &&
 	    ib_port_info_get_port_state(p_pi) !=
 	    ib_port_info_get_port_state(p_old_pi)) {
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list