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>,
	Jiri Pirko <jiri@nvidia.com>, Shay Drory <shayd@nvidia.com>
Subject: [net-next 10/15] net/mlx5: Call mlx5_esw_offloads_rep_load/unload() for uplink port directly
Date: Wed, 16 Aug 2023 14:00:44 -0700	[thread overview]
Message-ID: <20230816210049.54733-11-saeed@kernel.org> (raw)
In-Reply-To: <20230816210049.54733-1-saeed@kernel.org>

From: Jiri Pirko <jiri@nvidia.com>

For uplink port, mlx5_esw_offloads_load/unload_rep() are currently
called. There are 2 check inside, which effectively make the
functions a simple wrappers of mlx5_esw_offloads_rep_load/unload()
for uplink port. So avoid one check and indirection and call
mlx5_esw_offloads_rep_load/unload() for uplink port directly.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
---
 .../mellanox/mlx5/core/eswitch_offloads.c     | 20 ++++++++-----------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 46b8c60ac39a..c0b1b7b66cff 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2542,11 +2542,9 @@ int mlx5_esw_offloads_load_rep(struct mlx5_eswitch *esw, u16 vport_num)
 	if (esw->mode != MLX5_ESWITCH_OFFLOADS)
 		return 0;
 
-	if (vport_num != MLX5_VPORT_UPLINK) {
-		err = mlx5_esw_offloads_devlink_port_register(esw, vport_num);
-		if (err)
-			return err;
-	}
+	err = mlx5_esw_offloads_devlink_port_register(esw, vport_num);
+	if (err)
+		return err;
 
 	err = mlx5_esw_offloads_rep_load(esw, vport_num);
 	if (err)
@@ -2554,8 +2552,7 @@ int mlx5_esw_offloads_load_rep(struct mlx5_eswitch *esw, u16 vport_num)
 	return err;
 
 load_err:
-	if (vport_num != MLX5_VPORT_UPLINK)
-		mlx5_esw_offloads_devlink_port_unregister(esw, vport_num);
+	mlx5_esw_offloads_devlink_port_unregister(esw, vport_num);
 	return err;
 }
 
@@ -2566,8 +2563,7 @@ void mlx5_esw_offloads_unload_rep(struct mlx5_eswitch *esw, u16 vport_num)
 
 	mlx5_esw_offloads_rep_unload(esw, vport_num);
 
-	if (vport_num != MLX5_VPORT_UPLINK)
-		mlx5_esw_offloads_devlink_port_unregister(esw, vport_num);
+	mlx5_esw_offloads_devlink_port_unregister(esw, vport_num);
 }
 
 static int esw_set_slave_root_fdb(struct mlx5_core_dev *master,
@@ -3471,7 +3467,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 			vport->info.link_state = MLX5_VPORT_ADMIN_STATE_DOWN;
 
 	/* Uplink vport rep must load first. */
-	err = mlx5_esw_offloads_load_rep(esw, MLX5_VPORT_UPLINK);
+	err = mlx5_esw_offloads_rep_load(esw, MLX5_VPORT_UPLINK);
 	if (err)
 		goto err_uplink;
 
@@ -3482,7 +3478,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw)
 	return 0;
 
 err_vports:
-	mlx5_esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
+	mlx5_esw_offloads_rep_unload(esw, MLX5_VPORT_UPLINK);
 err_uplink:
 	esw_offloads_steering_cleanup(esw);
 err_steering_init:
@@ -3520,7 +3516,7 @@ static int esw_offloads_stop(struct mlx5_eswitch *esw,
 void esw_offloads_disable(struct mlx5_eswitch *esw)
 {
 	mlx5_eswitch_disable_pf_vf_vports(esw);
-	mlx5_esw_offloads_unload_rep(esw, MLX5_VPORT_UPLINK);
+	mlx5_esw_offloads_rep_unload(esw, MLX5_VPORT_UPLINK);
 	esw_set_passing_vport_metadata(esw, false);
 	esw_offloads_steering_cleanup(esw);
 	mapping_destroy(esw->offloads.reg_c0_obj_pool);
-- 
2.41.0


  parent reply	other threads:[~2023-08-16 21:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 21:00 [pull request][net-next 00/15] mlx5 updates 2023-08-16 Saeed Mahameed
2023-08-16 21:00 ` [net-next 01/15] net/mlx5e: aRFS, Prevent repeated kernel rule migrations requests Saeed Mahameed
2023-08-16 21:00 ` [net-next 02/15] net/mlx5e: aRFS, Warn if aRFS table does not exist for aRFS rule Saeed Mahameed
2023-08-16 21:00 ` [net-next 03/15] net/mlx5e: aRFS, Introduce ethtool stats Saeed Mahameed
2023-08-16 21:00 ` [net-next 04/15] net/mlx5e: Fix spelling mistake "Faided" -> "Failed" Saeed Mahameed
2023-08-16 21:00 ` [net-next 05/15] net/mlx5: IRQ, consolidate irq and affinity mask allocation Saeed Mahameed
2023-08-16 21:00 ` [net-next 06/15] net/mlx5: DR, Fix code indentation Saeed Mahameed
2023-08-16 21:00 ` [net-next 07/15] net/mlx5: DR, Remove unneeded local variable Saeed Mahameed
2023-08-16 21:00 ` [net-next 08/15] net/mlx5: Remove health syndrome enum duplication Saeed Mahameed
2023-08-16 21:00 ` [net-next 09/15] net/mlx5: Update dead links in Kconfig documentation Saeed Mahameed
2023-08-16 21:00 ` Saeed Mahameed [this message]
2023-08-16 21:00 ` [net-next 11/15] net/mlx5: Remove VPORT_UPLINK handling from devlink_port.c Saeed Mahameed
2023-08-16 21:00 ` [net-next 12/15] net/mlx5: Rename devlink port ops struct for PFs/VFs Saeed Mahameed
2023-08-16 21:00 ` [net-next 13/15] net/mlx5: DR, Supporting inline WQE when possible Saeed Mahameed
2023-08-16 21:00 ` [net-next 14/15] net/mlx5: Convert PCI error values to generic errnos Saeed Mahameed
2023-08-18 22:28   ` Jakub Kicinski
2023-08-19  2:55     ` Jakub Kicinski
2023-08-21 17:53       ` Saeed Mahameed
2023-08-16 21:00 ` [net-next 15/15] net/mlx5: Devcom, only use devcom after NULL check in mlx5_devcom_send_event() 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=20230816210049.54733-11-saeed@kernel.org \
    --to=saeed@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=shayd@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).