All of lore.kernel.org
 help / color / mirror / Atom feed
From: saeed@kernel.org
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Jianbo Liu <jianbol@mellanox.com>,
	Raed Salem <raeds@mellanox.com>, Roi Dayan <roid@mellanox.com>,
	Jiri Pirko <jiri@nvidia.com>, Raed Salem <raeds@nvidia.com>,
	Roi Dayan <roid@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>
Subject: [net-next 08/16] net/mlx5e: Add LAG warning for unsupported tx type
Date: Tue, 15 Sep 2020 13:25:25 -0700	[thread overview]
Message-ID: <20200915202533.64389-9-saeed@kernel.org> (raw)
In-Reply-To: <20200915202533.64389-1-saeed@kernel.org>

From: Jianbo Liu <jianbol@mellanox.com>

If bond tx type is not active-backup or hash, LAG offload can't be
enabled. When CHANGEUPPER event is received, and both PFs (and only
them) under the same lag master are about to be enslaved, a warning
is returned for user to know the offload failure, otherwise PFs are
enslaved silently without LAG offload activated.

Signed-off-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Raed Salem <raeds@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/lag.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
index 8b6e2aae2783..191d3d5be46d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag.c
@@ -355,7 +355,7 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
 {
 	struct net_device *upper = info->upper_dev, *ndev_tmp;
 	struct netdev_lag_upper_info *lag_upper_info = NULL;
-	bool is_bonded;
+	bool is_bonded, is_in_lag, mode_supported;
 	int bond_status = 0;
 	int num_slaves = 0;
 	int idx;
@@ -391,13 +391,18 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev,
 	/* Determine bonding status:
 	 * A device is considered bonded if both its physical ports are slaves
 	 * of the same lag master, and only them.
-	 * Lag mode must be activebackup or hash.
 	 */
-	is_bonded = (num_slaves == MLX5_MAX_PORTS) &&
-		    (bond_status == 0x3) &&
-		    ((tracker->tx_type == NETDEV_LAG_TX_TYPE_ACTIVEBACKUP) ||
-		     (tracker->tx_type == NETDEV_LAG_TX_TYPE_HASH));
+	is_in_lag = num_slaves == MLX5_MAX_PORTS && bond_status == 0x3;
 
+	/* Lag mode must be activebackup or hash. */
+	mode_supported = tracker->tx_type == NETDEV_LAG_TX_TYPE_ACTIVEBACKUP ||
+			 tracker->tx_type == NETDEV_LAG_TX_TYPE_HASH;
+
+	if (is_in_lag && !mode_supported)
+		NL_SET_ERR_MSG_MOD(info->info.extack,
+				   "Can't activate LAG offload, TX type isn't supported");
+
+	is_bonded = is_in_lag && mode_supported;
 	if (tracker->is_bonded != is_bonded) {
 		tracker->is_bonded = is_bonded;
 		return 1;
-- 
2.26.2


  parent reply	other threads:[~2020-09-15 21:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 20:25 [pull request][net-next 00/16] mlx5 updates 2020-09-15 saeed
2020-09-15 20:25 ` [net-next 01/16] net/mlx5: Fix uninitialized variable warning saeed
2020-09-15 20:25 ` [net-next 02/16] net/mlx5: remove erroneous fallthrough saeed
2020-09-15 20:25 ` [net-next 03/16] net/mlx5: Always use container_of to find mdev pointer from clock struct saeed
2020-09-15 20:25 ` [net-next 04/16] net/mlx5: Rename ptp clock info saeed
2020-09-15 20:25 ` [net-next 05/16] net/mlx5: Release clock lock before scheduling a PPS work saeed
2020-09-15 20:25 ` [net-next 06/16] net/mlx5: Don't call timecounter cyc2time directly from 1PPS flow saeed
2020-09-15 20:25 ` [net-next 07/16] net/mlx5e: Return a valid errno if can't get lag device index saeed
2020-09-15 20:25 ` saeed [this message]
2020-09-15 20:25 ` [net-next 09/16] net/mlx5e: Add LAG warning if bond slave is not lag master saeed
2020-09-15 20:25 ` [net-next 10/16] net/mlx5: E-Switch, Check and enable metadata support flag before using saeed
2020-09-15 20:25 ` [net-next 11/16] net/mlx5: E-Switch, Dedicated metadata for uplink vport saeed
2020-09-15 20:25 ` [net-next 12/16] net/mlx5: E-Switch, Setup all vports' metadata to support peer miss rule saeed
2020-09-15 20:25 ` [net-next 13/16] net/mlx5: E-Switch, Use vport metadata matching by default saeed
2020-09-15 20:25 ` [net-next 14/16] net/mlx5e: Add support for tc trap saeed
2020-09-15 20:25 ` [net-next 15/16] net/mlx5e: Add IPv6 traffic class (DSCP) header rewrite support saeed
2020-09-15 20:25 ` [net-next 16/16] net/mlx5e: Add CQE compression support for multi-strides packets saeed
2020-09-16 16:56 ` [pull request][net-next 00/16] mlx5 updates 2020-09-15 Jakub Kicinski
2020-09-17  6:01   ` Saeed Mahameed
2020-09-16 22:18 ` David Miller

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=20200915202533.64389-9-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=jianbol@mellanox.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=raeds@mellanox.com \
    --cc=raeds@nvidia.com \
    --cc=roid@mellanox.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    /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.