Blame SOURCES/0254-netdrv-net-mlx5-E-Switch-Fix-using-fwd-and-modify-wh.patch

d8f823
From e6aa12d9737f02f82238814ede2bd3e3865ae78b Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 19 May 2020 07:49:16 -0400
d8f823
Subject: [PATCH 254/312] [netdrv] net/mlx5: E-Switch: Fix using fwd and modify
d8f823
 when firmware doesn't support it
d8f823
d8f823
Message-id: <20200519074934.6303-46-ahleihel@redhat.com>
d8f823
Patchwork-id: 310543
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1663246 45/63] net/mlx5: E-Switch: Fix using fwd and modify when firmware doesn't support it
d8f823
Bugzilla: 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/1663246
d8f823
Upstream: v5.7-rc1
d8f823
d8f823
commit 0b3a8b6b53406f2d890cda369aa9d61e30bc4162
d8f823
Author: Paul Blakey <paulb@mellanox.com>
d8f823
Date:   Sun Mar 1 16:12:00 2020 +0200
d8f823
d8f823
    net/mlx5: E-Switch: Fix using fwd and modify when firmware doesn't support it
d8f823
d8f823
    Currently, if firmware doesn't support fwd and modify, driver fails
d8f823
    initializing eswitch chains while entering switchdev mode.
d8f823
d8f823
    Instead, on such cases, disable the chains and prio feature (as we can't
d8f823
    restore the chain on miss) and the usage of fwd and modify.
d8f823
d8f823
    Fixes: 8f1e0b97cc70 ("net/mlx5: E-Switch, Mark miss packets with new chain id mapping")
d8f823
    Signed-off-by: Paul Blakey <paulb@mellanox.com>
d8f823
    Reviewed-by: Oz Shlomo <ozsh@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_chains.c | 15 +++++++++++++--
d8f823
 1 file changed, 13 insertions(+), 2 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
d8f823
index 0f9c9aae11bf..a7d88ab35bbf 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads_chains.c
d8f823
@@ -23,6 +23,8 @@
d8f823
 #define tc_end_fdb(esw) (esw_chains_priv(esw)->tc_end_fdb)
d8f823
 #define fdb_ignore_flow_level_supported(esw) \
d8f823
 	(MLX5_CAP_ESW_FLOWTABLE_FDB((esw)->dev, ignore_flow_level))
d8f823
+#define fdb_modify_header_fwd_to_table_supported(esw) \
d8f823
+	(MLX5_CAP_ESW_FLOWTABLE((esw)->dev, fdb_modify_header_fwd_to_table))
d8f823
 
d8f823
 /* Firmware currently has 4 pool of 4 sizes that it supports (ESW_POOLS),
d8f823
  * and a virtual memory region of 16M (ESW_SIZE), this region is duplicated
d8f823
@@ -106,7 +108,8 @@ bool mlx5_esw_chains_prios_supported(struct mlx5_eswitch *esw)
d8f823
 
d8f823
 bool mlx5_esw_chains_backwards_supported(struct mlx5_eswitch *esw)
d8f823
 {
d8f823
-	return fdb_ignore_flow_level_supported(esw);
d8f823
+	return mlx5_esw_chains_prios_supported(esw) &&
d8f823
+	       fdb_ignore_flow_level_supported(esw);
d8f823
 }
d8f823
 
d8f823
 u32 mlx5_esw_chains_get_chain_range(struct mlx5_eswitch *esw)
d8f823
@@ -417,7 +420,8 @@ mlx5_esw_chains_add_miss_rule(struct fdb_chain *fdb_chain,
d8f823
 	dest.type  = MLX5_FLOW_DESTINATION_TYPE_FLOW_TABLE;
d8f823
 	dest.ft = next_fdb;
d8f823
 
d8f823
-	if (fdb_chain->chain != mlx5_esw_chains_get_ft_chain(esw)) {
d8f823
+	if (fdb_chain->chain != mlx5_esw_chains_get_ft_chain(esw) &&
d8f823
+	    fdb_modify_header_fwd_to_table_supported(esw)) {
d8f823
 		act.modify_hdr = fdb_chain->miss_modify_hdr;
d8f823
 		act.action |= MLX5_FLOW_CONTEXT_ACTION_MOD_HDR;
d8f823
 	}
d8f823
@@ -777,6 +781,13 @@ mlx5_esw_chains_init(struct mlx5_eswitch *esw)
d8f823
 	    esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) {
d8f823
 		esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
d8f823
 		esw_warn(dev, "Tc chains and priorities offload aren't supported, update firmware if needed\n");
d8f823
+	} else if (!fdb_modify_header_fwd_to_table_supported(esw)) {
d8f823
+		/* Disabled when ttl workaround is needed, e.g
d8f823
+		 * when ESWITCH_IPV4_TTL_MODIFY_ENABLE = true in mlxconfig
d8f823
+		 */
d8f823
+		esw_warn(dev,
d8f823
+			 "Tc chains and priorities offload aren't supported, check firmware version, or mlxconfig settings\n");
d8f823
+		esw->fdb_table.flags &= ~ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
d8f823
 	} else {
d8f823
 		esw->fdb_table.flags |= ESW_FDB_CHAINS_AND_PRIOS_SUPPORTED;
d8f823
 		esw_info(dev, "Supported tc offload range - chains: %u, prios: %u\n",
d8f823
-- 
d8f823
2.13.6
d8f823