From patchwork Sun Dec 23 17:14:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10741775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80F791A2B for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64D7A2870D for ; Sun, 23 Dec 2018 17:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58E6928736; Sun, 23 Dec 2018 17:15:25 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY 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 E350B2870D for ; Sun, 23 Dec 2018 17:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725808AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41695 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725793AbeLWRPV (ORCPT ); Sun, 23 Dec 2018 12:15:21 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 23 Dec 2018 19:21:38 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEQS030333; Sun, 23 Dec 2018 19:15:14 +0200 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id wBNHFEui007176; Sun, 23 Dec 2018 19:15:14 +0200 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id wBNHFE8Y007175; Sun, 23 Dec 2018 19:15:14 +0200 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, michaelgur@mellanox.com, jgg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 5/6] verbs: Added new rates derived from 2x and HDR support Date: Sun, 23 Dec 2018 19:14:56 +0200 Message-Id: <1545585297-6677-6-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> References: <1545585297-6677-1-git-send-email-yishaih@mellanox.com> 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 From: Michael Guralnik Due to 2x and HDR addition new rates exposed: 28 Gbps - FDR 2x. 50 Gbps - EDR 2x or HDR 1x. 400 Gbps - HDR 8x. 600 Gbps - HDR 12x. Utility methods were updated to support the new rates. Rate to mult - Convert the IB rate enum to a multiple of the base rate of 2.5 Gbit/sec. For example, IBV_RATE_5_GBPS will be converted to 2, since 5 Gbit/sec is 2 * 2.5 Gbit/sec. Rate to mbps - Convert IB rate enum to the mbps value. conversion done by multiplication of IB rate in mbps from IB spec and width needed to reach the rate. For example, 400 GBPS is reached by HDR 8x so the mbps rate is 53.125 Gbit/sec * 8 = 425,000 mbps. In addition, speed_str() and width_str() as part of ibv_devinfo were updated to consider the new HDR and 2x options. Signed-off-by: Michael Guralnik Signed-off-by: Yishai Hadas --- libibverbs/examples/devinfo.c | 2 ++ libibverbs/verbs.c | 16 ++++++++++++++++ libibverbs/verbs.h | 6 +++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index 5bbe936..735adb1 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -128,6 +128,7 @@ static const char *width_str(uint8_t width) case 2: return "4"; case 4: return "8"; case 8: return "12"; + case 16: return "2"; default: return "invalid width"; } } @@ -143,6 +144,7 @@ static const char *speed_str(uint8_t speed) case 16: return "14.0 Gbps"; case 32: return "25.0 Gbps"; + case 64: return "50.0 Gbps"; default: return "invalid speed"; } } diff --git a/libibverbs/verbs.c b/libibverbs/verbs.c index 3540ef2..9cdc361 100644 --- a/libibverbs/verbs.c +++ b/libibverbs/verbs.c @@ -69,6 +69,10 @@ int __attribute__((const)) ibv_rate_to_mult(enum ibv_rate rate) case IBV_RATE_60_GBPS: return 24; case IBV_RATE_80_GBPS: return 32; case IBV_RATE_120_GBPS: return 48; + case IBV_RATE_28_GBPS: return 11; + case IBV_RATE_50_GBPS: return 20; + case IBV_RATE_400_GBPS: return 160; + case IBV_RATE_600_GBPS: return 240; default: return -1; } } @@ -85,6 +89,10 @@ enum ibv_rate __attribute__((const)) mult_to_ibv_rate(int mult) case 24: return IBV_RATE_60_GBPS; case 32: return IBV_RATE_80_GBPS; case 48: return IBV_RATE_120_GBPS; + case 11: return IBV_RATE_28_GBPS; + case 20: return IBV_RATE_50_GBPS; + case 160: return IBV_RATE_400_GBPS; + case 240: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } @@ -109,6 +117,10 @@ int __attribute__((const)) ibv_rate_to_mbps(enum ibv_rate rate) case IBV_RATE_100_GBPS: return 103125; case IBV_RATE_200_GBPS: return 206250; case IBV_RATE_300_GBPS: return 309375; + case IBV_RATE_28_GBPS: return 28125; + case IBV_RATE_50_GBPS: return 53125; + case IBV_RATE_400_GBPS: return 425000; + case IBV_RATE_600_GBPS: return 637500; default: return -1; } } @@ -133,6 +145,10 @@ enum ibv_rate __attribute__((const)) mbps_to_ibv_rate(int mbps) case 103125: return IBV_RATE_100_GBPS; case 206250: return IBV_RATE_200_GBPS; case 309375: return IBV_RATE_300_GBPS; + case 28125: return IBV_RATE_28_GBPS; + case 53125: return IBV_RATE_50_GBPS; + case 425000: return IBV_RATE_400_GBPS; + case 637500: return IBV_RATE_600_GBPS; default: return IBV_RATE_MAX; } } diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 40a7280..c9491a7 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -661,7 +661,11 @@ enum ibv_rate { IBV_RATE_25_GBPS = 15, IBV_RATE_100_GBPS = 16, IBV_RATE_200_GBPS = 17, - IBV_RATE_300_GBPS = 18 + IBV_RATE_300_GBPS = 18, + IBV_RATE_28_GBPS = 19, + IBV_RATE_50_GBPS = 20, + IBV_RATE_400_GBPS = 21, + IBV_RATE_600_GBPS = 22, }; /**