From: Tariq Toukan <tariqt@nvidia.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, <netdev@vger.kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Willem de Bruijn <willemb@google.com>
Cc: Ariel Levkovich <lariel@mellanox.com>,
Cosmin Ratiu <cratiu@nvidia.com>, Gal Pressman <gal@nvidia.com>,
Leon Romanovsky <leon@kernel.org>, <linux-rdma@vger.kernel.org>,
Mark Bloch <mbloch@nvidia.com>,
"Muhammad Zuhayr al-Tayyar" <mzuhayr@earthlink.iq>,
Roi Dayan <roid@mellanox.com>,
"Saeed Mahameed" <saeedm@mellanox.com>,
Saeed Mahameed <saeedm@nvidia.com>,
"Tariq Toukan" <tariqt@nvidia.com>
Subject: [PATCH net] net/mlx5: E-Switch, Fix offloaded nf flowtable rules never being hit
Date: Wed, 25 Nov 2026 13:58:15 +0200 [thread overview]
Message-ID: <20261125115815.87909-1-tariqt@nvidia.com> (raw)
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
reply other threads:[~2026-11-25 11:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261125115815.87909-1-tariqt@nvidia.com \
--to=tariqt@nvidia.com \
--cc=andrew+netdev@lunn.ch \
--cc=cratiu@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=kuba@kernel.org \
--cc=lariel@mellanox.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=mzuhayr@earthlink.iq \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=roid@mellanox.com \
--cc=saeedm@mellanox.com \
--cc=saeedm@nvidia.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox