Skip to contentSkip to conversation

net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit

PATCH New Tariq Toukan 1 participant 1 message Nov 25

Subsystems (4)
lore
Share & tools
lore

Tariq Toukan

author maintainer
#0 lore raw

PATCH 1/1 net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit

In switchdev mode, nf flowtable entries offloaded to the FDB are installed but never hit, and the traffic keeps going through the slow path.

esw_chains_create() opens the nf flowtable chain, then the root table (chain 0, prio 1), and only then sets the nf flowtable table as the end table of the chains. mlx5_chains_create_prio() takes the miss destination of a new prio from the end table when the prio is created, which for the root is still the default table, i.e. the slow path. So the root misses to the slow path, and the nf flowtable chain is never reached.

Another chain 0 prio, e.g. of a tc rule, hides the issue: the root's miss is rewired to it, and its own miss goes to the nf flowtable chain. This stays so after that prio is destroyed, until the eswitch is set up again. Setups that always have such a prio, like OVS, don't hit it.

Set the end table before opening the root, as it was before the offending commit.

Tested on ConnectX-6 Dx in switchdev mode, with two VFs routed through their representors and an nftables flowtable with offload on them. Without this patch, the connections are HW_OFFLOAD but 99% of their packets go through the representors until a chain 0 prio 2 tc rule is added; with it, they are forwarded by the eswitch from the start, in both SMFS and DMFS.

---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +5 -2
index 474784131091..f71cd0303592 100644
@@ -1693,6 +1693,11 @@ esw_chains_create(struct mlx5_eswitch *esw, struct mlx5_flow_table *miss_fdb)
 		goto nf_ft_err;
 	}
 
+	/* Set the end table before opening the root, so that the root's
+	 * miss rule goes to the nf flowtable chain, not to the slow path.
+	 */
+	mlx5_chains_set_end_ft(chains, nf_ft);
+
 	/* Always open the root for fast path */
 	ft = mlx5_chains_get_table(chains, 0, 1, 0);
 	if (IS_ERR(ft)) {
@@ -1707,8 +1712,6 @@ esw_chains_create(struct mlx5_eswitch *esw, struct mlx5_flow_table *miss_fdb)
 			goto level_1_err;
 	}
 
-	mlx5_chains_set_end_ft(chains, nf_ft);
-
 	return 0;
 
 level_1_err:

base-commit: cc7fe6e741730fef549e484379281736d32746f0

Signature · 1 line
2.44.0