Blame SOURCES/0082-netdrv-net-mlx5-E-switch-Offloads-introduce-and-use-.patch

d8f823
From d8608d0e2b0bcaa440ea7bcc65ef20699846a27e Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Sun, 10 May 2020 15:03:59 -0400
d8f823
Subject: [PATCH 082/312] [netdrv] net/mlx5: E-switch, Offloads introduce and
d8f823
 use per vport acl tables APIs
d8f823
d8f823
Message-id: <20200510150452.10307-35-ahleihel@redhat.com>
d8f823
Patchwork-id: 306658
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789380 v2 34/87] net/mlx5: E-switch, Offloads introduce and use per vport acl tables APIs
d8f823
Bugzilla: 1789380
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Jonathan Toppins <jtoppins@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789380
d8f823
Upstream: v5.5-rc1
d8f823
d8f823
commit 89a0f1fb16adca959ea1485a856fbcfcd1d24208
d8f823
Author: Parav Pandit <parav@mellanox.com>
d8f823
Date:   Mon Oct 28 23:35:20 2019 +0000
d8f823
d8f823
    net/mlx5: E-switch, Offloads introduce and use per vport acl tables APIs
d8f823
d8f823
    Introduce and use per vport ACL tables creation and destroy APIs, so that
d8f823
    subsequently patch can use them during enabling/disabling a vport.
d8f823
d8f823
    Signed-off-by: Parav Pandit <parav@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
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 49 ++++++++++++++--------
d8f823
 1 file changed, 32 insertions(+), 17 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 b33543c5f68f..756031dcf056 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
d8f823
@@ -1964,6 +1964,32 @@ static bool esw_use_vport_metadata(const struct mlx5_eswitch *esw)
d8f823
 	       esw_check_vport_match_metadata_supported(esw);
d8f823
 }
d8f823
 
d8f823
+static int
d8f823
+esw_vport_create_offloads_acl_tables(struct mlx5_eswitch *esw,
d8f823
+				     struct mlx5_vport *vport)
d8f823
+{
d8f823
+	int err;
d8f823
+
d8f823
+	err = esw_vport_ingress_config(esw, vport);
d8f823
+	if (err)
d8f823
+		return err;
d8f823
+
d8f823
+	if (mlx5_eswitch_is_vf_vport(esw, vport->vport)) {
d8f823
+		err = esw_vport_egress_config(esw, vport);
d8f823
+		if (err)
d8f823
+			esw_vport_disable_ingress_acl(esw, vport);
d8f823
+	}
d8f823
+	return err;
d8f823
+}
d8f823
+
d8f823
+static void
d8f823
+esw_vport_destroy_offloads_acl_tables(struct mlx5_eswitch *esw,
d8f823
+				      struct mlx5_vport *vport)
d8f823
+{
d8f823
+	esw_vport_disable_egress_acl(esw, vport);
d8f823
+	esw_vport_disable_ingress_acl(esw, vport);
d8f823
+}
d8f823
+
d8f823
 static int esw_create_offloads_acl_tables(struct mlx5_eswitch *esw)
d8f823
 {
d8f823
 	struct mlx5_vport *vport;
d8f823
@@ -1974,15 +2000,9 @@ static int esw_create_offloads_acl_tables(struct mlx5_eswitch *esw)
d8f823
 		esw->flags |= MLX5_ESWITCH_VPORT_MATCH_METADATA;
d8f823
 
d8f823
 	mlx5_esw_for_all_vports(esw, i, vport) {
d8f823
-		err = esw_vport_ingress_config(esw, vport);
d8f823
+		err = esw_vport_create_offloads_acl_tables(esw, vport);
d8f823
 		if (err)
d8f823
-			goto err_ingress;
d8f823
-
d8f823
-		if (mlx5_eswitch_is_vf_vport(esw, vport->vport)) {
d8f823
-			err = esw_vport_egress_config(esw, vport);
d8f823
-			if (err)
d8f823
-				goto err_egress;
d8f823
-		}
d8f823
+			goto err_acl_table;
d8f823
 	}
d8f823
 
d8f823
 	if (mlx5_eswitch_vport_match_metadata_enabled(esw))
d8f823
@@ -1990,13 +2010,10 @@ static int esw_create_offloads_acl_tables(struct mlx5_eswitch *esw)
d8f823
 
d8f823
 	return 0;
d8f823
 
d8f823
-err_egress:
d8f823
-	esw_vport_disable_ingress_acl(esw, vport);
d8f823
-err_ingress:
d8f823
+err_acl_table:
d8f823
 	for (j = MLX5_VPORT_PF; j < i; j++) {
d8f823
 		vport = &esw->vports[j];
d8f823
-		esw_vport_disable_egress_acl(esw, vport);
d8f823
-		esw_vport_disable_ingress_acl(esw, vport);
d8f823
+		esw_vport_destroy_offloads_acl_tables(esw, vport);
d8f823
 	}
d8f823
 
d8f823
 	return err;
d8f823
@@ -2007,10 +2024,8 @@ static void esw_destroy_offloads_acl_tables(struct mlx5_eswitch *esw)
d8f823
 	struct mlx5_vport *vport;
d8f823
 	int i;
d8f823
 
d8f823
-	mlx5_esw_for_all_vports(esw, i, vport) {
d8f823
-		esw_vport_disable_egress_acl(esw, vport);
d8f823
-		esw_vport_disable_ingress_acl(esw, vport);
d8f823
-	}
d8f823
+	mlx5_esw_for_all_vports(esw, i, vport)
d8f823
+		esw_vport_destroy_offloads_acl_tables(esw, vport);
d8f823
 
d8f823
 	esw->flags &= ~MLX5_ESWITCH_VPORT_MATCH_METADATA;
d8f823
 }
d8f823
-- 
d8f823
2.13.6
d8f823