[ofa-general] [PATCH v2] infiniband-diags: Do not change port state on SubnSet

Eli Dorfman (Voltaire) dorfman.eli at gmail.com
Wed Jun 3 07:12:56 PDT 2009


Do not change port state on SubnSet

When changing physical state do not change logical port state to avoid invalid 
transitions in port state machine.
>From the IB spec When writing PortInfo:PortState, only legal transitions are
valid. So if PortState is ACTIVE and we try to set it to ACTIVE this will fail.

This patch will allow reset in a single MAD by changing physical state to polling.

Signed-off-by: Eli Dorfman <elid at voltaire.com>
---
 infiniband-diags/src/ibportstate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c
index 65c9ca1..d19a2e5 100644
--- a/infiniband-diags/src/ibportstate.c
+++ b/infiniband-diags/src/ibportstate.c
@@ -275,8 +275,10 @@ int main(int argc, char **argv)
 
 	/* Only if one of the "set" options is chosen */
 	if (port_op) {
-		if (port_op == 1)		/* Enable port */
+		if (port_op == 1) {		/* Enable port */
 			mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 2);	/* Polling */
+			mad_set_field(data, 0, IB_PORT_STATE_F, 0);             /* No Change */
+		}
 		else if ((port_op == 2) || (port_op == 3)) { /* Disable port */
 			mad_set_field(data, 0, IB_PORT_STATE_F, 1);             /* Down */
 			mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 3);        /* Disabled */
@@ -292,6 +294,7 @@ int main(int argc, char **argv)
 
 		if (port_op == 3) {	/* Reset port - so also enable */
 			mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 2);	/* Polling */
+			mad_set_field(data, 0, IB_PORT_STATE_F, 0);             /* No Change */
 			err = set_port_info(&portid, data, portnum, port_op);
 			if (err < 0)
 				IBERROR("smp set portinfo failed");
-- 
1.5.5




More information about the general mailing list