[ofa-general] Re: [PATCH] ibportstate: add width option

Sasha Khapyorsky sashak at voltaire.com
Sat Sep 19 13:05:40 PDT 2009


Hi Doron,

On 19:23 Sun 13 Sep     , Doron Shoham wrote:
> ibportstate: add width option.
> Similar to the speed option, this option can
> explicitly set the port's LinkWidthEnable value.
> It supports values from 0-15 and 255.
> 
> Signed-off-by: Doron Shoham <dorons at voltaire.com>

Almost equivalent patch was already submitted (and applied) by Hal. So
I'm just rebasing this to apply typos fixes:

commit cdc6452b0f8e2cd85dd61d5b43c9c65bfd5cc1a8
Author: Doron Shoham <dorons at voltaire.com>
Date:   Sun Sep 13 19:23:13 2009 +0300

    ibportstate: fixes for width option
    
    Originally was:
    
    ibportstate: add width option.
    Similar to the speed option, this option can
    explicitly set the port's LinkWidthEnable value.
    It supports values from 0-15 and 255.
    
    But since similar patch was submitted before, there is only rebase
    results with couple of typos fixes.
    
    Signed-off-by: Doron Shoham <dorons at voltaire.com>
    Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>

diff --git a/infiniband-diags/man/ibportstate.8 b/infiniband-diags/man/ibportstate.8
index b64c18d..fea860e 100644
--- a/infiniband-diags/man/ibportstate.8
+++ b/infiniband-diags/man/ibportstate.8
@@ -15,7 +15,7 @@ ibportstate allows the port state and port physical state of an IB port
 to be queried (in addition to link width and speed being validated
 relative to the peer port when the port queried is a switch port),
 or a switch port to be disabled, enabled, or reset. It
-also allows the link speed enabled on any IB port to be adjusted.
+also allows the link speed/width enabled on any IB port to be adjusted.
 
 .SH OPTIONS
 
@@ -32,7 +32,7 @@ Port operations allowed
  speed values are legal values for PortInfo:LinkSpeedEnabled
  (An error is indicated if PortInfo:LinkSpeedSupported does not support
   this setting)
- width valyes are legal values for PortInfo:LinkWidthEnabled
+ width values are legal values for PortInfo:LinkWidthEnabled
  (An error is indicated if PortInfo:LinkWidthSupported does not support
   this setting)
  (NOTE: Speed and width changes are not effected until the port goes through
diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c
index df13298..6fb97a8 100644
--- a/infiniband-diags/src/ibportstate.c
+++ b/infiniband-diags/src/ibportstate.c
@@ -204,7 +204,6 @@ int main(int argc, char **argv)
 	int err;
 	int port_op = 0;	/* default to query */
 	int speed = 15;
-	int new_width = 255;
 	int is_switch = 1;
 	int state, physstate, lwe, lws, lwa, lse, lss, lsa;
 	int peerlocalportnum, peerlwe, peerlws, peerlwa, peerlse, peerlss,
@@ -271,9 +270,9 @@ int main(int argc, char **argv)
 				    ("width requires an additional parameter");
 			port_op = 5;
 			/* Parse width value */
-			new_width = strtoul(argv[3], 0, 0);
-			if (new_width > 255)
-				IBERROR("invalid width value %d", new_width);
+			width = strtoul(argv[3], 0, 0);
+			if (width > 15 && width != 255)
+				IBERROR("invalid width value %d", width);
 		}
 	}
 
@@ -311,7 +310,7 @@ int main(int argc, char **argv)
 			mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 0);
 		} else if (port_op == 5) {	/* Set width */
 			mad_set_field(data, 0, IB_PORT_LINK_WIDTH_ENABLED_F,
-				      new_width);
+				      width);
 			mad_set_field(data, 0, IB_PORT_STATE_F, 0);
 			mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 0);
 		}




More information about the general mailing list