Blame SOURCES/0266-netdrv-net-mlx5-Avoid-deriving-mlx5_core_dev-second-.patch

d8f823
From 3be4371f8c2705031cb0913297eaeec46c615ab4 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 19 May 2020 07:49:29 -0400
d8f823
Subject: [PATCH 266/312] [netdrv] net/mlx5: Avoid deriving mlx5_core_dev
d8f823
 second time
d8f823
d8f823
Message-id: <20200519074934.6303-59-ahleihel@redhat.com>
d8f823
Patchwork-id: 310562
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1663246 58/63] net/mlx5: Avoid deriving mlx5_core_dev second time
d8f823
Bugzilla: 1835595 1663246
d8f823
RH-Acked-by: Marcelo Leitner <mleitner@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: John Linville <linville@redhat.com>
d8f823
RH-Acked-by: Ivan Vecera <ivecera@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1835595
d8f823
Bugzilla: http://bugzilla.redhat.com/1663246
d8f823
Upstream: v5.7-rc1
d8f823
d8f823
commit 0e6fa491e8b0a9a0115896fc88a404f8d89c2e80
d8f823
Author: Parav Pandit <parav@mellanox.com>
d8f823
Date:   Tue Dec 17 23:16:11 2019 -0600
d8f823
d8f823
    net/mlx5: Avoid deriving mlx5_core_dev second time
d8f823
d8f823
    All callers needs to work on mlx5_core_dev and it is already derived
d8f823
    before calling mlx5_devlink_eswitch_check().
d8f823
    Hence, accept mlx5_core_dev in mlx5_devlink_eswitch_check().
d8f823
d8f823
    Given that it works on mlx5_core_dev change helper function name to
d8f823
    drop devlink prefix.
d8f823
d8f823
    Reviewed-by: Roi Dayan <roid@mellanox.com>
d8f823
    Reviewed-by: Bodong Wang <bodong@mellanox.com>
d8f823
    Signed-off-by: Parav Pandit <parav@mellanox.com>
d8f823
    Reviewed-by: Mark Bloch <markb@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
 .../net/ethernet/mellanox/mlx5/core/eswitch_offloads.c   | 16 +++++++---------
d8f823
 1 file changed, 7 insertions(+), 9 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
index 8d277bdaccea..96a6eaf84a50 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
@@ -2574,10 +2574,8 @@ static int esw_inline_mode_to_devlink(u8 mlx5_mode, u8 *mode)
d8f823
 	return 0;
d8f823
 }
d8f823
 
d8f823
-static int mlx5_devlink_eswitch_check(struct devlink *devlink)
d8f823
+static int mlx5_eswitch_check(const struct mlx5_core_dev *dev)
d8f823
 {
d8f823
-	struct mlx5_core_dev *dev = devlink_priv(devlink);
d8f823
-
d8f823
 	if (MLX5_CAP_GEN(dev, port_type) != MLX5_CAP_PORT_TYPE_ETH)
d8f823
 		return -EOPNOTSUPP;
d8f823
 
d8f823
@@ -2598,7 +2596,7 @@ int mlx5_devlink_eswitch_mode_set(struct devlink *devlink, u16 mode,
d8f823
 	u16 cur_mlx5_mode, mlx5_mode = 0;
d8f823
 	int err;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
@@ -2623,7 +2621,7 @@ int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode)
d8f823
 	struct mlx5_core_dev *dev = devlink_priv(devlink);
d8f823
 	int err;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
@@ -2638,7 +2636,7 @@ int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
d8f823
 	int err, vport, num_vport;
d8f823
 	u8 mlx5_mode;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
@@ -2692,7 +2690,7 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode)
d8f823
 	struct mlx5_eswitch *esw = dev->priv.eswitch;
d8f823
 	int err;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
@@ -2744,7 +2742,7 @@ int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
d8f823
 	struct mlx5_eswitch *esw = dev->priv.eswitch;
d8f823
 	int err;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
@@ -2793,7 +2791,7 @@ int mlx5_devlink_eswitch_encap_mode_get(struct devlink *devlink,
d8f823
 	struct mlx5_eswitch *esw = dev->priv.eswitch;
d8f823
 	int err;
d8f823
 
d8f823
-	err = mlx5_devlink_eswitch_check(devlink);
d8f823
+	err = mlx5_eswitch_check(dev);
d8f823
 	if (err)
d8f823
 		return err;
d8f823
 
d8f823
-- 
d8f823
2.13.6
d8f823