From patchwork Wed Aug 2 09:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13337909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1ED7EC001DF for ; Wed, 2 Aug 2023 09:12:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231342AbjHBJME (ORCPT ); Wed, 2 Aug 2023 05:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbjHBJMD (ORCPT ); Wed, 2 Aug 2023 05:12:03 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC27A272A for ; Wed, 2 Aug 2023 02:12:02 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-686ba29ccb1so492571b3a.1 for ; Wed, 02 Aug 2023 02:12:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1690967522; x=1691572322; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F7q+ad3u/n13oddejDMfQJUsqVDfZJQi20NlZ+z7Q4s=; b=gViazE12g17Zugj1NuaL5BRbzxXLgVd3/jgYIAVp0VDr3Rj9t8GtQvxz7X4RCAxn9m LzhfoqdehQLTCA2wFTVZ47bkznF/HRTwH5fz+xZfEs4ncHZGs6vW9pRRxvAlv9oMxY7V M1cJyjcJQAoMgOKLUAT7pQFetdQTHJRDpvZKE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690967522; x=1691572322; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F7q+ad3u/n13oddejDMfQJUsqVDfZJQi20NlZ+z7Q4s=; b=NBu62N1pBKOG+brq+SxmvrdF0Mxb5IAZTpRS76MwNhukSvYp/OrzNISHZaDgLLLmRS Cpo+ZNiYsSdqwJmX8T00mEnMDSinxFZIdm2+7ftyTiD34EGvHypWTl8mdS29TykWelUw HL7dEcYqwXN88ZrgMLL881dRKFMaqzY6d9TH4qPoZJN1TSYOsEU4IuhaY49gR2R7ORTF 7h/UKWQZ00bkGx8j98i/tzgV65l+6MdTaEw+BCXT29DoiEjYGjseU1HcXas9aboUEk1h GN3PH5sgeFXKF0yKeBOH76YKBIwECYRAGvC9A1O+YEpqTsNfs+XRTkq3cSQNI0ifejtt c5aA== X-Gm-Message-State: ABy/qLZzHBKP0qxJpyK5gJNdHUncOHmD1yf5yZR8w2BWMrTurxIz0CsN 1Nm+B0jAXlprzhg6HJcz1vcObA== X-Google-Smtp-Source: APBJJlE83PG0v51PTZXuRYKB/RwUf5lBbn0VnOwvhd3iYgfLJhbHvLL/zfXnxYFgCdT+V/ij7kRmBQ== X-Received: by 2002:a05:6a00:1a4a:b0:681:919f:bf69 with SMTP id h10-20020a056a001a4a00b00681919fbf69mr14160896pfv.0.1690967522258; Wed, 02 Aug 2023 02:12:02 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id d9-20020aa78689000000b0064fa2fdfa9esm10565833pfo.81.2023.08.02.02.11.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2023 02:12:01 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Selvin Xavier Subject: [PATCH for-next v2] IB/core: Add more speed parsing in ib_get_width_and_speed() Date: Wed, 2 Aug 2023 02:00:23 -0700 Message-Id: <1690966823-8159-1-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP When the Ethernet driver does not provide the number of lanes in the __ethtool_get_link_ksettings() response, the function ib_get_width_and_speed() does not take consideration of 50G, 100G and 200G speeds while calculating the IB width and speed. Update the width and speed for the above netdev speeds. Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- v1 - v2: - Rebased the patch based on the latest changes in ib_get_width_and_speed - removed the switch case and use the existing else if check --- drivers/infiniband/core/verbs.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 25367bd..41ff559 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1899,9 +1899,18 @@ static void ib_get_width_and_speed(u32 netdev_speed, u32 lanes, } else if (netdev_speed <= SPEED_40000) { *width = IB_WIDTH_4X; *speed = IB_SPEED_FDR10; - } else { + } else if (netdev_speed <= SPEED_50000) { + *width = IB_WIDTH_2X; + *speed = IB_SPEED_EDR; + } else if (netdev_speed <= SPEED_100000) { *width = IB_WIDTH_4X; *speed = IB_SPEED_EDR; + } else if (netdev_speed <= SPEED_200000) { + *width = IB_WIDTH_4X; + *speed = IB_SPEED_HDR; + } else { + *width = IB_WIDTH_4X; + *speed = IB_SPEED_NDR; } return;