From patchwork Fri Aug 12 01:08:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ira Weiny X-Patchwork-Id: 1059272 X-Patchwork-Delegate: ira.weiny@intel.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7C18Ct9031474 for ; Fri, 12 Aug 2011 01:08:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751910Ab1HLBII (ORCPT ); Thu, 11 Aug 2011 21:08:08 -0400 Received: from nspiron-3.llnl.gov ([128.115.41.83]:18998 "EHLO smtp.llnl.gov" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751463Ab1HLBIH (ORCPT ); Thu, 11 Aug 2011 21:08:07 -0400 X-Attachments: None Received: from eris.llnl.gov (HELO trebuchet) ([134.9.2.84]) by smtp.llnl.gov with SMTP; 11 Aug 2011 18:08:07 -0700 Date: Thu, 11 Aug 2011 18:08:06 -0700 From: Ira Weiny To: "linux-rdma@vger.kernel.org" Subject: [PATCH 3/3] infiniband-diags: add Ext Speed Support to ibqueryerrors Message-Id: <20110811180806.7b570d81.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 (demeter2.kernel.org [140.211.167.43]); Fri, 12 Aug 2011 01:08:12 +0000 (UTC) Signed-off-by: Ira Weiny --- src/ibqueryerrors.c | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index 493020b..e7a7cdb 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -169,6 +169,7 @@ static void print_port_config(char *node_name, ibnd_node_t * node, int portnum) char speed_msg[256]; char ext_port_str[256]; int iwidth, ispeed, istate, iphystate; + int n = 0; ibnd_port_t *port = node->ports[portnum]; @@ -176,7 +177,9 @@ static void print_port_config(char *node_name, ibnd_node_t * node, int portnum) 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); @@ -189,11 +192,25 @@ static void print_port_config(char *node_name, ibnd_node_t * node, int portnum) * returned for all PortInfo components except PortState and * PortPhysicalState */ if (istate != IB_LINK_DOWN) { - snprintf(link_str, 256, "(%3s %9s %6s/%8s)", - mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64, &iwidth), - mad_dump_val(IB_PORT_LINK_SPEED_ACTIVE_F, speed, 64, &ispeed), - mad_dump_val(IB_PORT_STATE_F, state, 64, &istate), - mad_dump_val(IB_PORT_PHYS_STATE_F, physstate, 64, &iphystate)); + n = snprintf(link_str, 256, "(%3s", + mad_dump_val(IB_PORT_LINK_WIDTH_ACTIVE_F, width, 64, + &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)); + } + + 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)); } else { snprintf(link_str, 256, "( %6s/%8s)", mad_dump_val(IB_PORT_STATE_F, state, 64, &istate),