netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeed@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>
Cc: Saeed Mahameed <saeedm@nvidia.com>,
	netdev@vger.kernel.org, Tariq Toukan <tariqt@nvidia.com>,
	Roi Dayan <roid@nvidia.com>, Maor Dickman <maord@nvidia.com>
Subject: [net-next 01/15] net/mlx5: Lag, Update multiport eswitch check to log an error
Date: Sat,  4 Feb 2023 02:08:40 -0800	[thread overview]
Message-ID: <20230204100854.388126-2-saeed@kernel.org> (raw)
In-Reply-To: <20230204100854.388126-1-saeed@kernel.org>

From: Roi Dayan <roid@nvidia.com>

Update the function to log an error to the user if failing to offload
the rule and while there add correct prefix for the function name.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc/act/mirred.c    |  6 +++---
 drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c   | 11 +++++++----
 drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h   |  4 +++-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c
index 78c427b38048..c095a12346de 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/mirred.c
@@ -232,9 +232,9 @@ parse_mirred(struct mlx5e_tc_act_parse_state *parse_state,
 	parse_state->ifindexes[if_count] = out_dev->ifindex;
 	parse_state->if_count++;
 	is_uplink_rep = mlx5e_eswitch_uplink_rep(out_dev);
-	err = mlx5_lag_do_mirred(priv->mdev, out_dev);
-	if (err)
-		return err;
+
+	if (mlx5_lag_mpesw_do_mirred(priv->mdev, out_dev, extack))
+		return -EOPNOTSUPP;
 
 	out_dev = get_fdb_out_dev(uplink_dev, out_dev);
 	if (!out_dev)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
index c17e8f1ec914..d2f840812942 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c
@@ -96,17 +96,20 @@ int mlx5_lag_add_mpesw_rule(struct mlx5_core_dev *dev)
 	return mlx5_lag_mpesw_queue_work(dev, MLX5_MPESW_OP_ENABLE);
 }
 
-int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev)
+int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
+			     struct net_device *out_dev,
+			     struct netlink_ext_ack *extack)
 {
 	struct mlx5_lag *ldev = mdev->priv.lag;
 
 	if (!netif_is_bond_master(out_dev) || !ldev)
 		return 0;
 
-	if (ldev->mode == MLX5_LAG_MODE_MPESW)
-		return -EOPNOTSUPP;
+	if (ldev->mode != MLX5_LAG_MODE_MPESW)
+		return 0;
 
-	return 0;
+	NL_SET_ERR_MSG_MOD(extack, "can't forward to bond in mpesw mode");
+	return -EOPNOTSUPP;
 }
 
 bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h
index 88e8daffcf92..f88dc6ec3de1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.h
@@ -12,7 +12,9 @@ struct lag_mpesw {
 	atomic_t mpesw_rule_count;
 };
 
-int mlx5_lag_do_mirred(struct mlx5_core_dev *mdev, struct net_device *out_dev);
+int mlx5_lag_mpesw_do_mirred(struct mlx5_core_dev *mdev,
+			     struct net_device *out_dev,
+			     struct netlink_ext_ack *extack);
 bool mlx5_lag_mpesw_is_activated(struct mlx5_core_dev *dev);
 #if IS_ENABLED(CONFIG_MLX5_ESWITCH)
 void mlx5_lag_mpesw_init(struct mlx5_lag *ldev);
-- 
2.39.1


  reply	other threads:[~2023-02-04 10:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 10:08 [pull request][net-next 00/15] mlx5 updates 2023-02-04 Saeed Mahameed
2023-02-04 10:08 ` Saeed Mahameed [this message]
2023-02-06  9:20   ` [net-next 01/15] net/mlx5: Lag, Update multiport eswitch check to log an error patchwork-bot+netdevbpf
2023-02-04 10:08 ` [net-next 02/15] net/mlx5: Lag, Use mlx5_lag_dev() instead of derefering pointers Saeed Mahameed
2023-02-04 10:08 ` [net-next 03/15] net/mlx5: Lag, Remove redundant bool allocation on the stack Saeed Mahameed
2023-02-04 10:08 ` [net-next 04/15] net/mlx5: Lag, Use flag to check for shared FDB mode Saeed Mahameed
2023-02-04 10:08 ` [net-next 05/15] net/mlx5: Lag, Move mpesw related definitions to mpesw.h Saeed Mahameed
2023-02-04 10:08 ` [net-next 06/15] net/mlx5: Separate mlx5 driver documentation into multiple pages Saeed Mahameed
2023-02-04 10:08 ` [net-next 07/15] net/mlx5: Update Kconfig parameter documentation Saeed Mahameed
2023-02-04 10:08 ` [net-next 08/15] net/mlx5: Document previously implemented mlx5 tracepoints Saeed Mahameed
2023-02-04 10:08 ` [net-next 09/15] net/mlx5: Add counter information to mlx5 driver documentation Saeed Mahameed
2023-02-04 10:08 ` [net-next 10/15] net/mlx5: Document support for RoCE HCA disablement capability Saeed Mahameed
2023-02-04 10:08 ` [net-next 11/15] net/mlx5: Add firmware support for MTUTC scaled_ppm frequency adjustments Saeed Mahameed
2023-02-04 10:08 ` [net-next 12/15] net/mlx5: Enhance debug print in page allocation failure Saeed Mahameed
2023-02-04 10:08 ` [net-next 13/15] net/mlx5e: IPoIB, Add support for XDR speed Saeed Mahameed
2023-02-04 10:08 ` [net-next 14/15] net/mlx5e: IPsec, support upper protocol selector field offload Saeed Mahameed
2023-02-04 10:08 ` [net-next 15/15] net/mlx5e: Trigger NAPI after activating an SQ 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=20230204100854.388126-2-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=maord@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@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 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).