All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Aya Levin <ayal@mellanox.com>,
	Eran Ben Elisha <eranbe@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [net-next V2 07/14] net/mlx5e: Set FEC to auto when configured mode is not supported
Date: Sat, 25 Jan 2020 05:11:33 +0000	[thread overview]
Message-ID: <20200125051039.59165-8-saeedm@mellanox.com> (raw)
In-Reply-To: <20200125051039.59165-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-01-25  5:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-25  5:10 [pull request][net-next V2 00/14] Mellanox, mlx5 updates 2020-01-24 Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 01/14] devlink: Force enclosing array on binary fmsg data Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 02/14] net/mlx5: Add support for resource dump Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 03/14] net/mlx5e: Gather reporters APIs together Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 04/14] net/mlx5e: Support dump callback in TX reporter Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 05/14] net/mlx5e: Support dump callback in RX reporter Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 06/14] mlx5: Use proper logging and tracing line terminations Saeed Mahameed
2020-01-25  5:11 ` Saeed Mahameed [this message]
2020-01-25  5:11 ` [net-next V2 08/14] net/mlx5e: Enforce setting of a single FEC mode Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 09/14] net/mlx5e: Advertise globaly supported FEC modes Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 10/14] net/mlxe5: Separate between FEC and current speed Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 11/14] ethtool: Add support for low latency RS FEC Saeed Mahameed
2020-01-25 19:40   ` Jakub Kicinski
2020-01-25 21:05     ` Andrew Lunn
2020-01-26  9:13       ` Aya Levin
2020-01-26 17:22         ` Andrew Lunn
2020-01-27 21:56       ` Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 12/14] net/mlx5e: Add support for FEC modes based on 50G per lane links Saeed Mahameed
2020-01-25  5:11 ` [net-next V2 13/14] net/mlx5: DR, Handle reformat capability over sw-steering tables Saeed Mahameed
2020-01-25  5:12 ` [net-next V2 14/14] net/mlx5: Fix lowest FDB pool size 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=20200125051039.59165-8-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=ayal@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=eranbe@mellanox.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.