diff mbox

[03/27] opensm/osm_link_mgr.c: Set PortInfo:PortState to LinkDown when remote port isn't accessible

Message ID 1343750695-28063-3-git-send-email-alexne@mellanox.com (mailing list archive)
State Accepted
Delegated to: Alex Netes
Headers show

Commit Message

Alex Netes July 31, 2012, 4:04 p.m. UTC
From: Hal Rosenstock <hal@mellanox.com>

There might be a scenario where port's link physical state is LinkUp,
but port's peer doesn't answer to SMPs. In this case we will move the port
to LinkDown.

Signed-off-by: Daniel Klein <danielk@mellanox.com>
Signed-off-by: Vladimir Koushnir <vladimirk@mellanox.com>
Signed-off-by: Alex Netes <alexne@mellanox.com>
Signed-off-by: Hal Rosenstock <hal@mellanox.com>
---
 opensm/osm_link_mgr.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/opensm/osm_link_mgr.c b/opensm/osm_link_mgr.c
index 8301643..8733329 100644
--- a/opensm/osm_link_mgr.c
+++ b/opensm/osm_link_mgr.c
@@ -484,7 +484,7 @@  Exit:
 static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
 				 IN const uint8_t link_state)
 {
-	osm_physp_t *p_physp;
+	osm_physp_t *p_physp, *p_physp_remote;
 	uint32_t i, num_physp;
 	int ret = 0;
 	uint8_t current_state;
@@ -517,6 +517,19 @@  static int link_mgr_process_node(osm_sm_t * sm, IN osm_node_t * p_node,
 			continue;
 
 		/*
+		    Set PortState to DOWN in case Remote Physical Port is
+		    unreachable. We have to check this for all ports, except
+		    port zero.
+		 */
+		p_physp_remote = osm_physp_get_remote(p_physp);
+		if ((i != 0) && (!p_physp_remote ||
+		    !osm_physp_is_valid(p_physp_remote))) {
+			if (current_state != IB_LINK_INIT)
+				link_mgr_set_physp_pi(sm, p_physp, IB_LINK_DOWN);
+			continue;
+		}
+
+		/*
 		   Normally we only send state update if state is lower
 		   then required state. However, we need to send update if
 		   no state change required.