From patchwork Thu Jun 22 14:36:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 9804543 X-Patchwork-Delegate: ira.weiny@intel.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B959F60386 for ; Thu, 22 Jun 2017 14:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A696128696 for ; Thu, 22 Jun 2017 14:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B14D286AC; Thu, 22 Jun 2017 14:36:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0B9728696 for ; Thu, 22 Jun 2017 14:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751283AbdFVOgt (ORCPT ); Thu, 22 Jun 2017 10:36:49 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33413 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbdFVOgs (ORCPT ); Thu, 22 Jun 2017 10:36:48 -0400 Received: by mail-wr0-f194.google.com with SMTP id x23so5161119wrb.0 for ; Thu, 22 Jun 2017 07:36:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dev-mellanox-co-il.20150623.gappssmtp.com; s=20150623; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=MYWpyDhKzS4BJfpttm/GGP2Xs7yCZHLx0vZa+wGxqf0=; b=qGJadpZ0dhO3McpSss5C4YpAHo6Q0GcN4ADRqBzkNR+R3Dk5IO96WImFwzKtUOubFc +s0Qlmq65QOc5fNLW1/2kCAUBz3BTgABDkXJHtZ6QkHM+CYbzqbiZ2KmN3qYfjIQZ5pM wRyIZNkUBXkBnZm3R3VkMqbzHCSPWVtXK8LdCa8DMuuL25EOTOE3HVdz3kZS/kGSbeIQ 7XMFYKcz8vi2JFkvr6XRG8qkqjFZfOQEuYaXO6/Eu5I09zv+MtmPNvZ5a56ooksAVGeD DlDm9vsNx0s/QYEq30r83FqyI2OpIfY1magdsSXMaW/dMkQz53VMbn2+uvsx2VAhaHC9 UnKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=MYWpyDhKzS4BJfpttm/GGP2Xs7yCZHLx0vZa+wGxqf0=; b=TjepRqJ7EtWdO/qL8X5ExfOt2fJeow6gH/MS/jNlWFERgq3fHcIXtJNtuLi/FfQ4J4 bPPb18PMSPD+yWYLNpc0y4mYrILtd4MqJ2WY5nufNefey2eSOTPdwC0Awi11aqlUaXMA oPxdbIo99ZwNbLa+6T8ws4nhfV0rxsfv94c5oOzU9JK/uDkklWNVJ5j/puvNdvWmbfWM vpHU3h373akEkQMjjHp9Enqk2KigxKO2yOBtKuaWH+9wTuAj57T9gMKjxXOLzAQt+rBc 9iJ9HlrkJlq0ruTRR2mNhhvu3chhdj2B/nvU9bWgKS9s6Z8yuFk2pYvWFBXkE1rfE/94 md0g== X-Gm-Message-State: AKS2vOwnSp9VOh3YAnvnMNbvb9JF4i+7cO5QyNEASZXwRoUGf9gJ06qH n1GVM66usmmceuNj9Jw= X-Received: by 10.223.181.135 with SMTP id c7mr2427294wre.150.1498142206127; Thu, 22 Jun 2017 07:36:46 -0700 (PDT) Received: from [192.168.1.183] (c-73-182-207-166.hsd1.ma.comcast.net. [73.182.207.166]) by smtp.googlemail.com with ESMTPSA id p87sm3046187wma.2.2017.06.22.07.36.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 07:36:45 -0700 (PDT) To: "Weiny, Ira" Cc: "linux-rdma@vger.kernel.org" From: Hal Rosenstock Subject: [PATCH infiniband-diags 1/3] Support 2x link widths Message-ID: Date: Thu, 22 Jun 2017 10:36:43 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 Content-Language: en-US Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Per MgtWG errata #9306-9309 2x is indicated by bit 4 in link width fields in PortInfo Signed-off-by: Hal Rosenstock --- libibmad/src/dump.c | 14 ++++++++++++-- src/ibdiag_common.c | 20 +++++++++++++++++++- src/ibnetdiscover.c | 3 +++ src/ibportstate.c | 7 ++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c index b491bc2..8e1f5d1 100644 --- a/libibmad/src/dump.c +++ b/libibmad/src/dump.c @@ -183,6 +183,9 @@ void mad_dump_linkwidth(char *buf, int bufsz, void *val, int valsz) case 8: snprintf(buf, bufsz, "12X"); break; + case 16: + snprintf(buf, bufsz, "2X"); + break; default: IBWARN("bad width %d", width); snprintf(buf, bufsz, "undefined (%d)", width); @@ -202,10 +205,12 @@ static void dump_linkwidth(char *buf, int bufsz, int width) n += snprintf(buf + n, bufsz - n, "8X or "); if (n < bufsz && (width & 0x8)) n += snprintf(buf + n, bufsz - n, "12X or "); + if (n < bufsz && (width & 0x10)) + n += snprintf(buf + n, bufsz - n, "2X or "); if (n >= bufsz) return; - else if (width == 0 || (width >> 4)) + else if (width == 0 || (width >> 5)) snprintf(buf + n, bufsz - n, "undefined (%d)", width); else if (bufsz > 3) buf[n - 4] = '\0'; @@ -223,10 +228,15 @@ void mad_dump_linkwidthsup(char *buf, int bufsz, void *val, int valsz) case 7: case 11: case 15: + case 17: + case 19: + case 23: + case 27: + case 31: break; default: - if (!(width >> 4)) + if (!(width >> 5)) snprintf(buf + strlen(buf), bufsz - strlen(buf), " (IBA extension)"); break; diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 1f91269..cd8f707 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -737,6 +737,24 @@ int resolve_portid_str(char *ca_name, uint8_t ca_port, ib_portid_t * portid, return -1; } +static unsigned int get_max_width(unsigned int num) +{ + unsigned r = 0; /* 1x */ + + if (num & 8) + r = 3; /* 12x */ + else { + if (num & 4) + r = 2; /* 8x */ + else if (num & 2) + r = 1; /* 4x */ + else if (num & 0x10) + r = 4; /* 2x */ + } + + return (1 << r); +} + static unsigned int get_max(unsigned int num) { unsigned r = 0; // r will be lg(num) @@ -754,7 +772,7 @@ void get_max_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * p uint32_t cap_mask, rem_cap_mask, fdr10; uint8_t *info = NULL; - uint32_t max_width = get_max(mad_get_field(port->info, 0, + uint32_t max_width = get_max_width(mad_get_field(port->info, 0, IB_PORT_LINK_WIDTH_SUPPORTED_F) & mad_get_field(port->remoteport->info, 0, IB_PORT_LINK_WIDTH_SUPPORTED_F)); diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 0ad5e31..68374a2 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -134,6 +134,9 @@ char *dump_linkwidth_compat(uint32_t width) case 8: return ("12x"); break; + case 16: + return ("2x"); + break; } return ("??"); } diff --git a/src/ibportstate.c b/src/ibportstate.c index fe8be25..06bd5d2 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -321,6 +321,11 @@ static void validate_width(int width, int peerwidth, int lwa) IBWARN ("Peer ports operating at active width %d rather than 2 (4x)", lwa); + } else if ((width & peerwidth & 0x10)) { + if (lwa != 16) + IBWARN + ("Peer ports operating at active width %d rather than 16 (2x)", + lwa); } else if ((width & peerwidth & 0x1)) { if (lwa != 1) IBWARN @@ -461,7 +466,7 @@ int main(int argc, char **argv) IBEXIT("invalid fdr10 speed value %ld", val); break; case WIDTH: - if ((val > 15 && val != 255)) + if ((val > 31 && val != 255)) IBEXIT("invalid width value %ld", val); break; case VLS: