From patchwork Fri Aug 12 01:08:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 1059252 X-Patchwork-Delegate: ira.weiny@intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7C18AqK027508 for ; Fri, 12 Aug 2011 01:08:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751764Ab1HLBIG (ORCPT ); Thu, 11 Aug 2011 21:08:06 -0400 Received: from nspiron-2.llnl.gov ([128.115.41.82]:59500 "EHLO nspiron-2.llnl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752610Ab1HLBID (ORCPT ); Thu, 11 Aug 2011 21:08:03 -0400 X-Attachments: None Received: from eris.llnl.gov (HELO trebuchet) ([134.9.2.84]) by nspiron-2.llnl.gov with SMTP; 11 Aug 2011 18:08:02 -0700 Date: Thu, 11 Aug 2011 18:08:02 -0700 From: Ira Weiny To: "linux-rdma@vger.kernel.org" Subject: [PATCH 1/3] infiniband-diags: Add Extended Link Speed Support to iblinkinfo Message-Id: <20110811180802.314c35b2.weiny2@llnl.gov> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.18.9; x86_64-unknown-linux-gnu) Mime-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 12 Aug 2011 01:08:11 +0000 (UTC) Signed-off-by: Ira Weiny --- include/ibdiag_common.h | 1 + src/iblinkinfo.c | 61 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 14 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index 57bde20..a7ce62f 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -49,6 +49,7 @@ extern enum MAD_DEST ibd_dest_type; extern ib_portid_t *ibd_sm_id; extern int ibd_timeout; + /*========================================================*/ /* External interface */ /*========================================================*/ diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index c07d33e..81fa8aa 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -92,6 +92,9 @@ void get_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * port) { char buf[64]; uint32_t max_speed = 0; + uint32_t loc_sup_speed = 0; + uint32_t rem_sup_speed = 0; + uint32_t speed = 0; uint32_t max_width = get_max(mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_SUPPORTED_F) @@ -105,17 +108,33 @@ void get_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * port) mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, buf, 64, &max_width)); - max_speed = get_max(mad_get_field(port->info, 0, - IB_PORT_LINK_SPEED_SUPPORTED_F) - & mad_get_field(port->remoteport->info, 0, - IB_PORT_LINK_SPEED_SUPPORTED_F)); - if ((max_speed & mad_get_field(port->info, 0, - IB_PORT_LINK_SPEED_ACTIVE_F)) == 0) + loc_sup_speed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_SUPPORTED_F); + loc_sup_speed <<= 4; + loc_sup_speed |= mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_SUPPORTED_F); + + rem_sup_speed = mad_get_field(port->remoteport->info, 0, IB_PORT_LINK_SPEED_EXT_SUPPORTED_F); + rem_sup_speed <<= 4; + rem_sup_speed |= mad_get_field(port->remoteport->info, 0, IB_PORT_LINK_SPEED_SUPPORTED_F); + + max_speed = get_max(loc_sup_speed & rem_sup_speed); + + speed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); + speed <<= 4; + speed |= mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F); + + if ((max_speed & speed) == 0) { // we are not at the max supported speed // print what we could be at. - snprintf(speed_msg, msg_size, "Could be %s", - mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, - buf, 64, &max_speed)); + if (max_speed & 0xF0) { + max_speed >>= 4; + snprintf(speed_msg, msg_size, "Could be %s", + mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, + buf, 64, &max_speed)); + } else + snprintf(speed_msg, msg_size, "Could be %s", + mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, + buf, 64, &max_speed)); + } } int filterdownport_check(ibnd_node_t * node, ibnd_port_t * port) @@ -158,7 +177,9 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) return; iwidth = mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_ACTIVE_F); - ispeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F); + ispeed = mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_EXT_ACTIVE_F); + ispeed <<= 4; + ispeed |= mad_get_field(port->info, 0, IB_PORT_LINK_SPEED_ACTIVE_F); istate = mad_get_field(port->info, 0, IB_PORT_STATE_F); iphystate = mad_get_field(port->info, 0, IB_PORT_PHYS_STATE_F); @@ -177,11 +198,23 @@ void print_port(ibnd_node_t * node, ibnd_port_t * port, char *out_prefix) * returned for all PortInfo components except PortState and * PortPhysicalState */ if (istate != IB_LINK_DOWN) { - n = snprintf(link_str, 256, "(%3s %9s %6s/%8s)", + + n = snprintf(link_str, 256, "(%3s", mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64, - &iwidth), - mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed, 64, - &ispeed), + &iwidth)); + + if (ispeed & 0xF0) { + ispeed >>= 4; + n += snprintf(link_str + n, 256 - n, " %12s", + mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F, speed, 64, + &ispeed)); + } else { + n += snprintf(link_str + n, 256 - n, " %12s", + mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed, 64, + &ispeed)); + } + + n += snprintf(link_str + n, 256 - n, " %6s/%8s)", mad_dump_val(IB_PORT_STATE_F, state, 64, &istate), mad_dump_val(IB_PORT_PHYS_STATE_F, physstate, 64, &iphystate));