[ofa-general] [PATCH] infiniband-diags/ibportstate: Support changing of link width
Hal Rosenstock
hnrose at comcast.net
Tue Sep 8 15:11:37 PDT 2009
Also, update man page
Signed-off-by: Hal Rosenstock <hal.rosenstock at gmail.com>
---
diff --git a/infiniband-diags/man/ibportstate.8 b/infiniband-diags/man/ibportstate.8
index 9b5e618..b64c18d 100644
--- a/infiniband-diags/man/ibportstate.8
+++ b/infiniband-diags/man/ibportstate.8
@@ -1,4 +1,4 @@
-.TH IBPORTSTATE 8 "October 19, 2006" "OpenIB" "OpenIB Diagnostics"
+.TH IBPORTSTATE 8 "September 8, 2009" "OpenIB" "OpenIB Diagnostics"
.SH NAME
ibportstate \- handle port (physical) state and link speed of an InfiniBand port
@@ -23,16 +23,19 @@ also allows the link speed enabled on any IB port to be adjusted.
.TP
op
Port operations allowed
- supported ops: enable, disable, reset, speed, query
+ supported ops: enable, disable, reset, speed, width, query
Default is query
.PP
ops enable, disable, and reset are only allowed on switch ports
(An error is indicated if attempted on CA or router ports)
- speed op is allowed on any port
+ speed and width ops are allowed on any port
speed values are legal values for PortInfo:LinkSpeedEnabled
(An error is indicated if PortInfo:LinkSpeedSupported does not support
this setting)
- (NOTE: Speed changes are not effected until the port goes through
+ width valyes 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
link renegotiation)
query also validates port characteristics (link width and speed)
based on the peer port. This checking is done when the port
@@ -108,8 +111,10 @@ ibportstate -D 0 1 # (query) by direct route
ibportstate 3 1 reset # by lid
.PP
ibportstate 3 1 speed 1 # by lid
+.PP
+ibportstate 3 1 width 1 # by lid
.SH AUTHOR
.TP
Hal Rosenstock
-.RI < halr at voltaire.com >
+.RI < hal.rosenstock at gmail.com >
diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c
index 76e74f7..d20961f 100644
--- a/infiniband-diags/src/ibportstate.c
+++ b/infiniband-diags/src/ibportstate.c
@@ -204,6 +204,7 @@ 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,
@@ -216,13 +217,14 @@ int main(int argc, char **argv)
int selfport = 0;
char usage_args[] = "<dest dr_path|lid|guid> <portnum> [<op>]\n"
- "\nSupported ops: enable, disable, reset, speed, query";
+ "\nSupported ops: enable, disable, reset, speed, width, query";
const char *usage_examples[] = {
"3 1 disable\t\t\t# by lid",
"-G 0x2C9000100D051 1 enable\t# by guid",
"-D 0 1\t\t\t# (query) by direct route",
"3 1 reset\t\t\t# by lid",
"3 1 speed 1\t\t\t# by lid",
+ "3 1 width 1\t\t\t# by lid",
NULL
};
@@ -263,6 +265,15 @@ int main(int argc, char **argv)
speed = strtoul(argv[3], 0, 0);
if (speed > 15)
IBERROR("invalid speed value %d", speed);
+ } else if (!strcmp(argv[2], "width")) {
+ if (argc < 4)
+ IBERROR
+ ("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);
}
}
@@ -298,6 +309,11 @@ int main(int argc, char **argv)
speed);
mad_set_field(data, 0, IB_PORT_STATE_F, 0);
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);
+ mad_set_field(data, 0, IB_PORT_STATE_F, 0);
+ mad_set_field(data, 0, IB_PORT_PHYS_STATE_F, 0);
}
err = set_port_info(&portid, data, portnum, port_op);
More information about the general
mailing list