Re: [PATCH] infiniband-diags/ibportstate: allow changes to CA portinfo parameters
On Tue, Jan 12, 2010 at 5:11 AM, Sasha Khapyorsky sas...@voltaire.com wrote: Hi Ralph, On 13:43 Mon 11 Jan , Ralph Campbell wrote: Its been 2 months since I posted this. What is the current status? Last comment I saw was from Ira saying either add this functionality to ibportstate or rename ibportstate but don't split it off into a new command. You are right, it seems that an idea about universal and potentially extendable new tool didn't find many fans :) My preference is to go with the original patch. I haven't seen any strong objection to it. I understand Ralph's use case motivating this but it is also a potentially dangerous tool in the wrong person's hands. -- Hal I will go over original patch. Sasha -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] infiniband-diags/ibportstate: allow changes to CA portinfo parameters
Hi Ralph, On 13:43 Mon 11 Jan , Ralph Campbell wrote: Its been 2 months since I posted this. What is the current status? Last comment I saw was from Ira saying either add this functionality to ibportstate or rename ibportstate but don't split it off into a new command. You are right, it seems that an idea about universal and potentially extendable new tool didn't find many fans :) My preference is to go with the original patch. I haven't seen any strong objection to it. I will go over original patch. Sasha -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] infiniband-diags/ibportstate: allow changes to CA portinfo parameters
On 11:56 Thu 05 Nov , Ralph Campbell wrote: This patch adds new commands to ibportstate to support initializing the link for CAs connected back-to-back. It also allows more than one field to be changed at the same time such as lid 23 arm or width 1 speed 3 enable. Signed-off-by: Ralph Campbell ralph.campb...@qlogic.com Applied. Thanks. Sasha -- To unsubscribe from this list: send the line unsubscribe linux-rdma in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] infiniband-diags/ibportstate: allow changes to CA portinfo parameters
Its been 2 months since I posted this. What is the current status? Last comment I saw was from Ira saying either add this functionality to ibportstate or rename ibportstate but don't split it off into a new command. My preference is to go with the original patch. I haven't seen any strong objection to it. On Thu, 2009-11-05 at 11:56 -0800, Ralph Campbell wrote: This patch adds new commands to ibportstate to support initializing the link for CAs connected back-to-back. It also allows more than one field to be changed at the same time such as lid 23 arm or width 1 speed 3 enable. Signed-off-by: Ralph Campbell ralph.campb...@qlogic.com --- diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c index e631bfd..192b14e 100644 --- a/infiniband-diags/src/ibportstate.c +++ b/infiniband-diags/src/ibportstate.c @@ -46,93 +46,133 @@ #include ibdiag_common.h +enum port_ops { + QUERY, + ENABLE, + RESET, + DISABLE, + SPEED, + WIDTH, + DOWN, + ARM, + ACTIVE, + VLS, + MTU, + LID, + SMLID, + LMC, +}; + struct ibmad_port *srcport; +int speed = 15; +int width = 255; +int lid; +int smlid; +int lmc; +int mtu; +int vls; + +struct { + const char *name; + int *val; + int set; +} port_args[] = { + { query, NULL, 0 }, /* QUERY */ + { enable, NULL, 0 }, /* ENABLE */ + { reset, NULL, 0 }, /* RESET */ + { disable, NULL, 0 }, /* DISABLE */ + { speed, speed, 0 }, /* SPEED */ + { width, width, 0 }, /* WIDTH */ + { down, NULL, 0 },/* DOWN */ + { arm, NULL, 0 }, /* ARM */ + { active, NULL, 0 }, /* ACTIVE */ + { vls, vls, 0 }, /* VLS */ + { mtu, mtu, 0 }, /* MTU */ + { lid, lid, 0 }, /* LID */ + { smlid, smlid, 0 }, /* SMLID */ + { lmc, lmc, 0 }, /* LMC */ +}; + +#define NPORT_ARGS (sizeof(port_args) / sizeof(port_args[0])) /***/ +/* + * Return 1 if port is a switch, else zero. + */ static int get_node_info(ib_portid_t * dest, uint8_t * data) { int node_type; if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) - return -1; + IBERROR(smp query nodeinfo failed); node_type = mad_get_field(data, 0, IB_NODE_TYPE_F); if (node_type == IB_NODE_SWITCH)/* Switch NodeType ? */ - return 0; - else return 1; + else + return 0; } -static int get_port_info(ib_portid_t * dest, uint8_t * data, int portnum, -int port_op) +static void get_port_info(ib_portid_t * dest, uint8_t * data, int portnum) +{ + if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) + IBERROR(smp query portinfo failed); +} + +static void show_port_info(ib_portid_t * dest, uint8_t * data, int portnum) { char buf[2048]; char val[64]; - if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) - return -1; - - if (port_op != 4) { - mad_dump_portstates(buf, sizeof buf, data, sizeof data); - mad_decode_field(data, IB_PORT_LINK_WIDTH_SUPPORTED_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_SUPPORTED_F, - buf + strlen(buf), sizeof buf - strlen(buf), - val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_WIDTH_ENABLED_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_ENABLED_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_WIDTH_ACTIVE_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_ACTIVE_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_SUPPORTED_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_SUPPORTED_F, - buf + strlen(buf), sizeof buf - strlen(buf), - val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_ENABLED_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_ENABLED_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_ACTIVE_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_ACTIVE_F, buf + strlen(buf), - sizeof buf - strlen(buf), val);
[PATCH] infiniband-diags/ibportstate: allow changes to CA portinfo parameters
This patch adds new commands to ibportstate to support initializing the link for CAs connected back-to-back. It also allows more than one field to be changed at the same time such as lid 23 arm or width 1 speed 3 enable. Signed-off-by: Ralph Campbell ralph.campb...@qlogic.com --- diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c index e631bfd..192b14e 100644 --- a/infiniband-diags/src/ibportstate.c +++ b/infiniband-diags/src/ibportstate.c @@ -46,93 +46,133 @@ #include ibdiag_common.h +enum port_ops { + QUERY, + ENABLE, + RESET, + DISABLE, + SPEED, + WIDTH, + DOWN, + ARM, + ACTIVE, + VLS, + MTU, + LID, + SMLID, + LMC, +}; + struct ibmad_port *srcport; +int speed = 15; +int width = 255; +int lid; +int smlid; +int lmc; +int mtu; +int vls; + +struct { + const char *name; + int *val; + int set; +} port_args[] = { + { query, NULL, 0 }, /* QUERY */ + { enable, NULL, 0 }, /* ENABLE */ + { reset, NULL, 0 }, /* RESET */ + { disable, NULL, 0 }, /* DISABLE */ + { speed, speed, 0 }, /* SPEED */ + { width, width, 0 }, /* WIDTH */ + { down, NULL, 0 },/* DOWN */ + { arm, NULL, 0 }, /* ARM */ + { active, NULL, 0 }, /* ACTIVE */ + { vls, vls, 0 }, /* VLS */ + { mtu, mtu, 0 }, /* MTU */ + { lid, lid, 0 }, /* LID */ + { smlid, smlid, 0 }, /* SMLID */ + { lmc, lmc, 0 }, /* LMC */ +}; + +#define NPORT_ARGS (sizeof(port_args) / sizeof(port_args[0])) /***/ +/* + * Return 1 if port is a switch, else zero. + */ static int get_node_info(ib_portid_t * dest, uint8_t * data) { int node_type; if (!smp_query_via(data, dest, IB_ATTR_NODE_INFO, 0, 0, srcport)) - return -1; + IBERROR(smp query nodeinfo failed); node_type = mad_get_field(data, 0, IB_NODE_TYPE_F); if (node_type == IB_NODE_SWITCH)/* Switch NodeType ? */ - return 0; - else return 1; + else + return 0; } -static int get_port_info(ib_portid_t * dest, uint8_t * data, int portnum, -int port_op) +static void get_port_info(ib_portid_t * dest, uint8_t * data, int portnum) +{ + if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) + IBERROR(smp query portinfo failed); +} + +static void show_port_info(ib_portid_t * dest, uint8_t * data, int portnum) { char buf[2048]; char val[64]; - if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, portnum, 0, srcport)) - return -1; - - if (port_op != 4) { - mad_dump_portstates(buf, sizeof buf, data, sizeof data); - mad_decode_field(data, IB_PORT_LINK_WIDTH_SUPPORTED_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_SUPPORTED_F, - buf + strlen(buf), sizeof buf - strlen(buf), - val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_WIDTH_ENABLED_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_ENABLED_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_WIDTH_ACTIVE_F, val); - mad_dump_field(IB_PORT_LINK_WIDTH_ACTIVE_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_SUPPORTED_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_SUPPORTED_F, - buf + strlen(buf), sizeof buf - strlen(buf), - val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_ENABLED_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_ENABLED_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - mad_decode_field(data, IB_PORT_LINK_SPEED_ACTIVE_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_ACTIVE_F, buf + strlen(buf), - sizeof buf - strlen(buf), val); - sprintf(buf + strlen(buf), %s, \n); - } else { - mad_decode_field(data, IB_PORT_LINK_SPEED_ENABLED_F, val); - mad_dump_field(IB_PORT_LINK_SPEED_ENABLED_F, buf, sizeof buf, - val); - sprintf(buf + strlen(buf), %s, \n); - } + mad_dump_portstates(buf, sizeof buf, data, sizeof data); + mad_decode_field(data, IB_PORT_LID_F, val); + mad_dump_field(IB_PORT_LID_F, buf + strlen(buf), +