[ofa-general] [PATCH] infiniband-diags: Do not change logical state on SubnAdmSet

Eli Dorfman (Voltaire) dorfman.eli at gmail.com
Sun May 31 07:44:46 PDT 2009


Do not change logical state on SubnAdmSet

When changing physical state do not change logical port state.
>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 allows reset in a single MAD.

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