From patchwork Mon Aug 17 12:37:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1346193 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVYVC3n2rz9sTh; Mon, 17 Aug 2020 22:37:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k7eOc-0006V5-NQ; Mon, 17 Aug 2020 12:37:50 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOb-0006U6-Ax for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:49 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOb-0000fo-0K for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:49 +0000 Received: by mail-qt1-f197.google.com with SMTP id e14so11960111qtm.5 for ; Mon, 17 Aug 2020 05:37:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3ZZZ2FzJ6/5OUWTBeIC/TDp3UPiT4dpmydJQmJmy9lE=; b=EXcczSCsD4bJLGK1p+5IKfc21zrqQnfL/qUuwtI9rBACkf/Xfx+U4DtKsfeBgzMP+y e4KrxFXbMA3f1MSdxDiAIoAdSXtVi8EBJ+EbthjNwrfHVrYhQZOj/gmRvIgVNy/idxAe R7AOGwq/FHIfjnsuKyYRy6csojh5eI2LeA9WkQfPO7oIS53xl8G/SWslfOb93kTdBwmC lV8rT82hGlwTpCoSq0aOdaId7cLz1+f/6Ksg735BsEhY+9og9UUckkLpN12ewt4ldv4L C0GA58UFyhutIgsbaOXdrr52XdHKVwmth5OvLMWVknINm5FZ3VWkIFJQWg4mmV7VA+Yj Ovcw== X-Gm-Message-State: AOAM531/KF1Zam+tKlqCFuEC3DJpM5ChYaoUU64ljBhXHl+hrkB8kBmL 3Tr4J13QtUzWdnwwrsbZSwtsUBTNxdcXVHMvxnnyKlC2i8R4CGkTnR6Dn8gd9r0961c6OnKtAKn 2TBsKjID5lq2xviMezhJJTzdPWGFBkL6jWgGJrvoMug== X-Received: by 2002:a0c:aedf:: with SMTP id n31mr13897511qvd.16.1597667867872; Mon, 17 Aug 2020 05:37:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxopjiknd++laVzNLFxD2yozc5T7SpTuBfbTb/dTa0cpcuNrPwMy51ke4PC2gp/Wuzob8cTQw== X-Received: by 2002:a0c:aedf:: with SMTP id n31mr13897495qvd.16.1597667867681; Mon, 17 Aug 2020 05:37:47 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id m15sm20177234qta.6.2020.08.17.05.37.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 05:37:47 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [BIONIC/linux-azure-4.15][PATCH 1/3] net/mlx5: Expose link speed directly Date: Mon, 17 Aug 2020 08:37:38 -0400 Message-Id: <20200817123740.6938-5-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200817123740.6938-1-william.gray@canonical.com> References: <20200817123740.6938-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Bloch Expose port rate as part of the port speed register fields. Signed-off-by: Mark Bloch Signed-off-by: Saeed Mahameed BugLink: https://bugs.launchpad.net/bugs/1876770 (backported from commit dc392fc56f39a00a46d6db2d150571ccafe99734) [ vilhelmgray: context adjustment ] Signed-off-by: William Breathitt Gray --- include/linux/mlx5/mlx5_ifc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h index b4f38bb534d2..d54a04326e37 100644 --- a/include/linux/mlx5/mlx5_ifc.h +++ b/include/linux/mlx5/mlx5_ifc.h @@ -7409,7 +7409,8 @@ struct mlx5_ifc_ptys_reg_bits { u8 proto_mask[0x3]; u8 an_status[0x4]; - u8 reserved_at_24[0x3c]; + u8 reserved_at_24[0x2c]; + u8 data_rate_oper[0x10]; u8 eth_proto_capability[0x20]; From patchwork Mon Aug 17 12:37:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1346192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVYVC3qH0z9sTm; Mon, 17 Aug 2020 22:37:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k7eOa-0006Tk-Vz; Mon, 17 Aug 2020 12:37:48 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOZ-0006TS-I6 for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:47 +0000 Received: from mail-qv1-f72.google.com ([209.85.219.72]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOZ-0000fW-7t for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:47 +0000 Received: by mail-qv1-f72.google.com with SMTP id j8so10858868qvu.3 for ; Mon, 17 Aug 2020 05:37:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hUtzuQcD2JvwcNQV7TsY8Dtziy9mjJ9oU5MtG8AmyvY=; b=M/fsycTTssGprmqjMciYlrNnmJe7yT8pZv58sXiFmsVWSs1DR8fTrZK1+faNrhwliW OqwCCDLj+e3Eij4IRbQsVlpsqCcs7FoOphygvTX9nePFG/qVAtBVPOTJeQYKv3uIk8Bn gEVssxpnfyVAGwJsEXdQ0mUa/5c8n7C0UnPFvOVbMF/UJ1Qmj2i56K4A+Vp8Qm2eZW+b oOn5t6MI6Vmf1cMAWZ9Yjb5wp+XjWySVFoI2VaOJoQEQ/vtTJ7YKRVPE+t7ANx2R53TF Bgm/riVIwPjZMoJysBBkwdRXpCw/J5SAQ8So0G1kunWFLZhgT6IETD4KWCgQn2SRWrLC AARg== X-Gm-Message-State: AOAM532Z1AH5t6eseQVwlT9L4llbt9Y7c8ahaRXSAwf+AIfcMTu5cE4Z UFsVnhg4FORvX5D4F42so9eVbEZufyTPJ/rZOlyiZ969nEkATeOu8TAsbbURIWb+eC4fGAzOL1/ eTL4vn3f4ed7boI3CpCvMcQBvQgTBdZCRuffUfJDzqw== X-Received: by 2002:ad4:54c6:: with SMTP id j6mr14287558qvx.126.1597667865920; Mon, 17 Aug 2020 05:37:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMHTL4LIG5WtGcis1YbZ091S555ER465XdI4m7qGNYwMpB7j3m7jP3sExdZcCXuIwmDL57Ow== X-Received: by 2002:ad4:54c6:: with SMTP id j6mr14287547qvx.126.1597667865709; Mon, 17 Aug 2020 05:37:45 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id m15sm20177234qta.6.2020.08.17.05.37.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 05:37:45 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [FOCAL/linux-azure][PATCH 2/3] net/mlx5: Expose port speed when possible Date: Mon, 17 Aug 2020 08:37:36 -0400 Message-Id: <20200817123740.6938-3-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200817123740.6938-1-william.gray@canonical.com> References: <20200817123740.6938-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Bloch When port speed can't be reported based on ext_eth_proto_capability or eth_proto_capability instead of reporting speed as unknown check if the port's speed can be inferred based on the data_rate_oper field. Signed-off-by: Mark Bloch Signed-off-by: Saeed Mahameed BugLink: https://bugs.launchpad.net/bugs/1876770 (cherry picked from commit c268ca6087f553bfc0e16ffec412b983ffe32fd4) Signed-off-by: William Breathitt Gray --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 39ee32518b10..a14e1a2cd429 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -780,6 +780,7 @@ static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings static void get_speed_duplex(struct net_device *netdev, u32 eth_proto_oper, bool force_legacy, + u16 data_rate_oper, struct ethtool_link_ksettings *link_ksettings) { struct mlx5e_priv *priv = netdev_priv(netdev); @@ -791,7 +792,10 @@ static void get_speed_duplex(struct net_device *netdev, speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper, force_legacy); if (!speed) { - speed = SPEED_UNKNOWN; + if (data_rate_oper) + speed = 100 * data_rate_oper; + else + speed = SPEED_UNKNOWN; goto out; } @@ -881,6 +885,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, { struct mlx5_core_dev *mdev = priv->mdev; u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; + u16 data_rate_oper; u32 rx_pause = 0; u32 tx_pause = 0; u32 eth_proto_cap; @@ -924,6 +929,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, an_disable_admin = MLX5_GET(ptys_reg, out, an_disable_admin); an_status = MLX5_GET(ptys_reg, out, an_status); connector_type = MLX5_GET(ptys_reg, out, connector_type); + data_rate_oper = MLX5_GET(ptys_reg, out, data_rate_oper); mlx5_query_port_pause(mdev, &rx_pause, &tx_pause); @@ -934,7 +940,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings, admin_ext); get_speed_duplex(priv->netdev, eth_proto_oper, !admin_ext, - link_ksettings); + data_rate_oper, link_ksettings); eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap; From patchwork Mon Aug 17 12:37:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1346190 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BVYVC33Jnz9sTK; Mon, 17 Aug 2020 22:37:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1k7eOc-0006Uk-BQ; Mon, 17 Aug 2020 12:37:50 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOa-0006Te-R2 for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:48 +0000 Received: from mail-qv1-f69.google.com ([209.85.219.69]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1k7eOa-0000fk-H1 for kernel-team@lists.ubuntu.com; Mon, 17 Aug 2020 12:37:48 +0000 Received: by mail-qv1-f69.google.com with SMTP id n5so10853804qvx.2 for ; Mon, 17 Aug 2020 05:37:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cBtuKZNY9yMqOdMy+O+T6J03goVMecgUFtqVCmafpBo=; b=UapUzBWZC5uH/4lcxOZiMQXeV6s7SoC3+eZmOYi5WNdj1YcR1B009Hjg4yalIhLZk9 vza0pyE7nI9ZAQCADRSb6CGzZFVOzZ0LbzRino9SP0cgE3vyoY9S7CdOoxfeXpIxEYN/ FvJ3QujxHLrvSmjM3zyqj+905ozKgDCJizSKYf9BO7ngx2GgSZGovlcCUukQ4ybKGstV VPo2uWGUlt+6qmE+aT8CMEMkoe8m4EMMujEyAwYACqKdYHISBlCoD130BvGGyHL9F7EN newJ/S6QfxAMYpxuC7PqW7IwAtpCRInvWxx9bxjLUb1SPEN7X0nD/kUeUAhn5rnNN+cl Y2Cw== X-Gm-Message-State: AOAM533JROOcwYPyrHfywVveZMcBd6Zcd/LME628x1NoeoBlV0Gzy20N +UJxFyrP503MvtOOA8+phY9lJ9Mkq/fjWIBR6zoeBai3tMPqE39C4zmHyvSIMWmdcnBfVTsxuKP DxkazSo1V47Nlr2Xzr1Kf0VL8/bnp5Mh1d4KaZyqX9Q== X-Received: by 2002:aed:29a4:: with SMTP id o33mr13574190qtd.66.1597667866830; Mon, 17 Aug 2020 05:37:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjJj5cBGFW0eBtyik6DASjlllIURaxEnv6f7TssXhmu92p+57Rrpurx+2KAfSjBm58svBPmA== X-Received: by 2002:aed:29a4:: with SMTP id o33mr13574173qtd.66.1597667866580; Mon, 17 Aug 2020 05:37:46 -0700 (PDT) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id m15sm20177234qta.6.2020.08.17.05.37.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Aug 2020 05:37:46 -0700 (PDT) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [FOCAL/linux-azure][PATCH 3/3] net/mlx5: Tidy up and fix reverse christmas ordring Date: Mon, 17 Aug 2020 08:37:37 -0400 Message-Id: <20200817123740.6938-4-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200817123740.6938-1-william.gray@canonical.com> References: <20200817123740.6938-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mark Bloch Use reverse chirstmas tree inside mlx5e_ethtool_get_link_ksettings. Signed-off-by: Mark Bloch Signed-off-by: Saeed Mahameed BugLink: https://bugs.launchpad.net/bugs/1876770 (cherry picked from commit 2f5438ca0ee01a1b3a9c37e3f33d47c8122afe74) Signed-off-by: William Breathitt Gray --- .../net/ethernet/mellanox/mlx5/core/en_ethtool.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index a14e1a2cd429..3e74ee6f7f2d 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -884,18 +884,18 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv, struct ethtool_link_ksettings *link_ksettings) { struct mlx5_core_dev *mdev = priv->mdev; - u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0}; + u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {}; + u32 eth_proto_admin; + u8 an_disable_admin; u16 data_rate_oper; + u32 eth_proto_oper; + u32 eth_proto_cap; + u8 connector_type; u32 rx_pause = 0; u32 tx_pause = 0; - u32 eth_proto_cap; - u32 eth_proto_admin; u32 eth_proto_lp; - u32 eth_proto_oper; - u8 an_disable_admin; - u8 an_status; - u8 connector_type; bool admin_ext; + u8 an_status; bool ext; int err;