diags/ibportstate: Support explicit port reset in addition to disable
and enable

Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]>

Index: src/ibportstate.c
===================================================================
--- src/ibportstate.c   (revision 9670)
+++ src/ibportstate.c   (working copy)
@@ -252,6 +252,8 @@ main(int argc, char **argv)
                        port_op = 1;
                else if (!strcmp(argv[2], "disable"))
                        port_op = 2;
+               else if (!strcmp(argv[2], "reset"))
+                       port_op = 3;
        }
 
        if (port_op)
@@ -266,13 +268,18 @@ main(int argc, char **argv)
        if (port_op) {
                if (port_op == 1)               /* Enable port */
                        mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 2);        
/* Polling */
-               else if (port_op == 2) {        /* Disable port */
+               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 */
                }
 
                if ((err = set_port_info(&portid, data, argv+1, argc-1)))
                        IBERROR("smpset portinfo: %s", err);
+               if (port_op == 3) {     /* Reset port - so also enable */
+                       mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 2);        
/* Polling */
+                       if ((err = set_port_info(&portid, data, argv+1, 
argc-1)))
+                               IBERROR("smpset portinfo: %s", err);
+               }
        }
 
        exit(0);
Index: man/ibportstate.8
===================================================================
--- man/ibportstate.8   (revision 9670)
+++ man/ibportstate.8   (working copy)
@@ -1,4 +1,4 @@
-.TH IBPORTSTATE 8 "July 25, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBPORTSTATE 8 "October 3, 2006" "OpenIB" "OpenIB Diagnostics"
 
 .SH NAME
 ibportstate \- handle port state and port physical state of an InfiniBand port 
@@ -10,7 +10,7 @@ ibportstate \- handle port state and por
 .SH DESCRIPTION
 .PP
 ibportstate allows the port state and port physical state of an IB port
-to be queried or a switch port to be disabled or enabled.
+to be queried or a switch port to be disabled, enabled, or reset.
 
 .SH OPTIONS
 
@@ -18,7 +18,7 @@ to be queried or a switch port to be dis
 .TP
 op
 Port operations allowed
- supported ops: enable, disable, query
+ supported ops: enable, disable, reset, query
  Default is query
 
 .SH COMMON OPTIONS




_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to