Blame SOURCES/0170-netdrv-net-mlx5e-Rename-hw_modify-to-preactivate.patch

d8f823
From b4469ee9c5ec4d217e295427ccda298052e20526 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:54:42 -0400
d8f823
Subject: [PATCH 170/312] [netdrv] net/mlx5e: Rename hw_modify to preactivate
d8f823
d8f823
Message-id: <20200512105530.4207-77-ahleihel@redhat.com>
d8f823
Patchwork-id: 306948
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 076/124] net/mlx5e: Rename hw_modify to preactivate
d8f823
Bugzilla: 1789382
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789382
d8f823
Upstream: v5.7-rc1
d8f823
d8f823
commit dca147b3dce5abb5284ff747211960fd2db5ec2e
d8f823
Author: Maxim Mikityanskiy <maximmi@mellanox.com>
d8f823
Date:   Thu Oct 31 09:39:34 2019 +0200
d8f823
d8f823
    net/mlx5e: Rename hw_modify to preactivate
d8f823
d8f823
    mlx5e_safe_switch_channels accepts a callback to be called before
d8f823
    activating new channels. It is intended to configure some hardware
d8f823
    parameters in cases where channels are recreated because some
d8f823
    configuration has changed.
d8f823
d8f823
    Recently, this callback has started being used to update the driver's
d8f823
    internal MLX5E_STATE_XDP_OPEN flag, and the following patches also
d8f823
    intend to use this callback for software preparations. This patch
d8f823
    renames the hw_modify callback to preactivate, so that the name fits
d8f823
    better.
d8f823
d8f823
    Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
d8f823
    Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en.h      |  6 +++---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 14 ++++++++------
d8f823
 2 files changed, 11 insertions(+), 9 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
index f0f33971be6c..99c7a8047b26 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
d8f823
@@ -1024,14 +1024,14 @@ int mlx5e_open_channels(struct mlx5e_priv *priv,
d8f823
 			struct mlx5e_channels *chs);
d8f823
 void mlx5e_close_channels(struct mlx5e_channels *chs);
d8f823
 
d8f823
-/* Function pointer to be used to modify WH settings while
d8f823
+/* Function pointer to be used to modify HW or kernel settings while
d8f823
  * switching channels
d8f823
  */
d8f823
-typedef int (*mlx5e_fp_hw_modify)(struct mlx5e_priv *priv);
d8f823
+typedef int (*mlx5e_fp_preactivate)(struct mlx5e_priv *priv);
d8f823
 int mlx5e_safe_reopen_channels(struct mlx5e_priv *priv);
d8f823
 int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
d8f823
 			       struct mlx5e_channels *new_chs,
d8f823
-			       mlx5e_fp_hw_modify hw_modify);
d8f823
+			       mlx5e_fp_preactivate preactivate);
d8f823
 void mlx5e_activate_priv_channels(struct mlx5e_priv *priv);
d8f823
 void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv);
d8f823
 
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
index eed6e024675e..70bcd75e241e 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
d8f823
@@ -2955,7 +2955,7 @@ void mlx5e_deactivate_priv_channels(struct mlx5e_priv *priv)
d8f823
 
d8f823
 static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
d8f823
 				       struct mlx5e_channels *new_chs,
d8f823
-				       mlx5e_fp_hw_modify hw_modify)
d8f823
+				       mlx5e_fp_preactivate preactivate)
d8f823
 {
d8f823
 	struct net_device *netdev = priv->netdev;
d8f823
 	int new_num_txqs;
d8f823
@@ -2974,9 +2974,11 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
d8f823
 
d8f823
 	priv->channels = *new_chs;
d8f823
 
d8f823
-	/* New channels are ready to roll, modify HW settings if needed */
d8f823
-	if (hw_modify)
d8f823
-		hw_modify(priv);
d8f823
+	/* New channels are ready to roll, call the preactivate hook if needed
d8f823
+	 * to modify HW settings or update kernel parameters.
d8f823
+	 */
d8f823
+	if (preactivate)
d8f823
+		preactivate(priv);
d8f823
 
d8f823
 	priv->profile->update_rx(priv);
d8f823
 	mlx5e_activate_priv_channels(priv);
d8f823
@@ -2988,7 +2990,7 @@ static void mlx5e_switch_priv_channels(struct mlx5e_priv *priv,
d8f823
 
d8f823
 int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
d8f823
 			       struct mlx5e_channels *new_chs,
d8f823
-			       mlx5e_fp_hw_modify hw_modify)
d8f823
+			       mlx5e_fp_preactivate preactivate)
d8f823
 {
d8f823
 	int err;
d8f823
 
d8f823
@@ -2996,7 +2998,7 @@ int mlx5e_safe_switch_channels(struct mlx5e_priv *priv,
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
-	mlx5e_switch_priv_channels(priv, new_chs, hw_modify);
d8f823
+	mlx5e_switch_priv_channels(priv, new_chs, preactivate);
d8f823
 	return 0;
d8f823
 }
d8f823
 
d8f823
-- 
d8f823
2.13.6
d8f823