netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Aya Levin <ayal@mellanox.com>,
	Eran Ben Elisha <eranbe@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next V3 07/13] net/mlx5e: Set FEC to auto when configured mode is not supported
Date: Tue, 11 Feb 2020 14:32:48 -0800	[thread overview]
Message-ID: <20200211223254.101641-8-saeedm@mellanox.com> (raw)
In-Reply-To: <20200211223254.101641-1-saeedm@mellanox.com>

From: Aya Levin <ayal@mellanox.com>

When configuring FEC mode, driver tries to set it for all available
link types. If a link type doesn't support a FEC mode, set this link
type to auto (FW best effort). Prior to this patch, when a link type
didn't support a FEC mode is was set to no FEC.

Signed-off-by: Aya Levin <ayal@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/en/port.c | 22 +++++--------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c
index fce6eccdcf8b..f0dc0ca3ddc4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/port.c
@@ -501,8 +501,6 @@ int mlx5e_get_fec_mode(struct mlx5_core_dev *dev, u32 *fec_mode_active,
 
 int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)
 {
-	u8 fec_policy_nofec = BIT(MLX5E_FEC_NOFEC);
-	bool fec_mode_not_supp_in_speed = false;
 	u32 out[MLX5_ST_SZ_DW(pplm_reg)] = {};
 	u32 in[MLX5_ST_SZ_DW(pplm_reg)] = {};
 	int sz = MLX5_ST_SZ_BYTES(pplm_reg);
@@ -526,23 +524,15 @@ int mlx5e_set_fec_mode(struct mlx5_core_dev *dev, u8 fec_policy)
 
 	for (i = 0; i < MLX5E_FEC_SUPPORTED_SPEEDS; i++) {
 		mlx5e_get_fec_cap_field(out, &fec_caps, fec_supported_speeds[i]);
-		/* policy supported for link speed, or policy is auto */
-		if (fec_caps & fec_policy || fec_policy == fec_policy_auto) {
+		/* policy supported for link speed */
+		if (fec_caps & fec_policy)
 			mlx5e_fec_admin_field(out, &fec_policy, 1,
 					      fec_supported_speeds[i]);
-		} else {
-			/* turn off FEC if supported. Else, leave it the same */
-			if (fec_caps & fec_policy_nofec)
-				mlx5e_fec_admin_field(out, &fec_policy_nofec, 1,
-						      fec_supported_speeds[i]);
-			fec_mode_not_supp_in_speed = true;
-		}
+		else
+			/* set FEC to auto*/
+			mlx5e_fec_admin_field(out, &fec_policy_auto, 1,
+					      fec_supported_speeds[i]);
 	}
 
-	if (fec_mode_not_supp_in_speed)
-		mlx5_core_dbg(dev,
-			      "FEC policy 0x%x is not supported for some speeds",
-			      fec_policy);
-
 	return mlx5_core_access_reg(dev, out, sz, out, sz, MLX5_REG_PPLM, 0, 1);
 }
-- 
2.24.1


  parent reply	other threads:[~2020-02-11 22:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 22:32 [pull request][net-next V3 00/13] Mellanox, mlx5 updates 2020-01-24 Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 01/13] devlink: Force enclosing array on binary fmsg data Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 02/13] net/mlx5: Add support for resource dump Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 03/13] net/mlx5e: Gather reporters APIs together Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 04/13] net/mlx5e: Support dump callback in TX reporter Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 05/13] net/mlx5e: Support dump callback in RX reporter Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 06/13] mlx5: Use proper logging and tracing line terminations Saeed Mahameed
2020-02-11 22:32 ` Saeed Mahameed [this message]
2020-02-11 22:32 ` [net-next V3 08/13] net/mlx5e: Enforce setting of a single FEC mode Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 09/13] net/mlx5e: Advertise globaly supported FEC modes Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 10/13] net/mlxe5: Separate between FEC and current speed Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 11/13] ethtool: Add support for low latency RS FEC Saeed Mahameed
2020-02-11 23:10   ` Andrew Lunn
2020-02-11 22:32 ` [net-next V3 12/13] net/mlx5e: Add support for FEC modes based on 50G per lane links Saeed Mahameed
2020-02-11 22:32 ` [net-next V3 13/13] net/mlx5: Remove a useless 'drain_workqueue()' call in 'mlx5e_ipsec_cleanup()' Saeed Mahameed
2020-02-11 23:21 ` [pull request][net-next V3 00/13] Mellanox, mlx5 updates 2020-01-24 Jeff Kirsher
2020-02-12 19:29   ` Saeed Mahameed
2020-02-12  0:54 ` David Miller
2020-02-12 19:27   ` Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200211223254.101641-8-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=ayal@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).