Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
@ 2026-11-25 11:58 Tariq Toukan
  2026-11-26 13:38 ` Daniel Machon
  2026-11-30  3:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tariq Toukan @ 2026-11-25 11:58 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn
  Cc: Ariel Levkovich, Cosmin Ratiu, Gal Pressman, Leon Romanovsky,
	linux-rdma, Mark Bloch, Muhammad Zuhayr al-Tayyar, Roi Dayan,
	Saeed Mahameed, Saeed Mahameed, Tariq Toukan

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.

Fixes: ae430332557a ("net/mlx5: Refactor multi chains and prios support")
Reported-by: Muhammad Zuhayr al-Tayyar <mzuhayr@earthlink.iq>
Closes: https://lore.kernel.org/netdev/AM0PR02MB4307F6D53A2B0AD628D91C81C6682@AM0PR02MB4307.eurprd02.prod.outlook.com/
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 474784131091..f71cd0303592 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -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
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
  2026-11-25 11:58 [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit Tariq Toukan
@ 2026-11-26 13:38 ` Daniel Machon
  2026-11-30  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Machon @ 2026-11-26 13:38 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni, Willem de Bruijn, Ariel Levkovich,
	Cosmin Ratiu, Gal Pressman, Leon Romanovsky, linux-rdma,
	Mark Bloch, Muhammad Zuhayr al-Tayyar, Roi Dayan, Saeed Mahameed,
	Saeed Mahameed

> 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.
> 
> Fixes: ae430332557a ("net/mlx5: Refactor multi chains and prios support")
> Reported-by: Muhammad Zuhayr al-Tayyar <mzuhayr@earthlink.iq>
> Closes: https://lore.kernel.org/netdev/AM0PR02MB4307F6D53A2B0AD628D91C81C6682@AM0PR02MB4307.eurprd02.prod.outlook.com/
> Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
> Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>

Reviewed-by: Daniel Machon <daniel.machon@microchip.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
  2026-11-25 11:58 [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit Tariq Toukan
  2026-11-26 13:38 ` Daniel Machon
@ 2026-11-30  3:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-30  3:50 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: andrew+netdev, davem, edumazet, kuba, netdev, pabeni, willemb,
	lariel, cratiu, gal, leon, linux-rdma, mbloch, mzuhayr, roid,
	saeedm, saeedm

Hello:

This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:

On Wed, 25 Nov 2026 13:58:15 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
    https://git.kernel.org/netdev/net/c/a00e4afd118e

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-30  3:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25 11:58 [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit Tariq Toukan
2026-11-26 13:38 ` Daniel Machon
2026-11-30  3:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox