From: netdev-bot+sashiko@kernel.org
To: tariqt@nvidia.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com,
sd@queasysnail.net, willemb@google.com,
aleksandr.loktionov@intel.com, parri.andrea@gmail.com,
borisp@nvidia.com, cjubran@nvidia.com, lcy8047@gmail.com,
cratiu@nvidia.com, daniel.zahka@gmail.com,
davem@davem-thinkpadp1gen8.ibmlond.csb, doruk@0sec.ai,
dtatulea@nvidia.com, gal@nvidia.com, jianbol@nvidia.com,
joasantonio108@gmail.com, leon@kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
mbloch@nvidia.com, phaddad@nvidia.com, ralf@mandelbit.com,
saeedm@nvidia.com, horms@kernel.org
Subject: Re: [PATCH net-next V5 1/7] net/mlx5e: Generalize TC <-> IPsec mutual exclusion
Date: Mon, 30 Nov 2026 12:07:32 +0000 [thread overview]
Message-ID: <179604045242.3146.11465224103483791527@kernel.org> (raw)
In-Reply-To: <20261129120331.1910180-2-tariqt@nvidia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The num_block_accel count leaks on PM suspend/resume while TC
flower rules are installed on the PF netdev in NIC (legacy) mode.
--
net/mlx5e: Generalize TC <-> IPsec mutual exclusion
This commit moves the TC/IPsec mutual exclusion helpers to en_accel.h as
mlx5e_accel_{,un}block_tc_offload() and renames num_block_ipsec to
num_block_accel. It also drops the CONFIG_MLX5_EN_IPSEC check from
is_tc_accel_check_needed(), so that follow-up patches can use the same gate
for PSP and MACsec.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 615af3acdb9eb..03bade86c38c2 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> @@ -4821,14 +4821,15 @@ static bool is_flow_rule_duplicate_allowed(struct net_device *dev,
[ ... ]
> -static bool is_tc_ipsec_order_check_needed(struct net_device *filter, struct mlx5e_priv *priv)
> +static bool is_tc_accel_check_needed(struct net_device *filter,
> + struct mlx5e_priv *priv)
> {
> - if (!IS_ENABLED(CONFIG_MLX5_EN_IPSEC))
> - return false;
> -
> if (filter != priv->netdev)
> return false;
[Severity: Medium]
Without the IS_ENABLED(CONFIG_MLX5_EN_IPSEC) check, every successful
mlx5e_configure_flower() on the PF netdev now increments num_block_accel in
every build. That count is becoming the gate for IPsec, PSP and MACsec. Can
it leak across PM suspend/resume in NIC (legacy) mode?
The only decrement is in mlx5e_delete_flower(). It only runs when the
flow's cookie is still in the driver's tc hashtable.
On system suspend the netdev stays registered, so the TC core keeps its
filters. The driver still frees its flows, though:
mlx5_suspend()
mlx5_unload_one(dev, true)
mlx5_detach_device(dev, true)
mlx5e_suspend()
_mlx5e_suspend()
mlx5e_detach_netdev()
profile->cleanup_rx() == mlx5e_cleanup_nic_rx()
mlx5e_tc_nic_cleanup()
rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, NULL);
The destroy callback does not drop the count:
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c:_mlx5e_tc_del_flow() {
...
mlx5e_tc_del_flow(priv, flow);
kfree(flow);
}
On resume, mlx5e_attach_netdev() creates a new, empty hashtable. When the
user later deletes the filters, mlx5e_delete_flower() misses the lookup.
It returns before it reaches mlx5e_tc_unblock_accel_offload():
flow = rhashtable_lookup(tc_ht, &f->cookie, tc_ht_params);
if (!flow || !same_flow_direction(flow, flags)) {
err = -EINVAL;
goto errout;
}
offload_block is set up only once, in mlx5_mdev_init(), and is never reset.
esw->user_count, by contrast, is reset on the legacy and offloads init
paths. So num_block_accel would stay non-zero for the life of the mdev.
Wouldn't every later mlx5e_accel_block_tc_offload() call on this mdev then
return -EBUSY until the driver is reloaded?
if (mdev->offload_block.num_block_accel)
ret = -EBUSY;
The leaking teardown path dates from commit c8e350e62fc5, where it only
affected IPsec packet offload in CONFIG_MLX5_EN_IPSEC builds. With this
patch and the follow-ups, one leaked TC count would block IPsec SA and
policy add, PSP RX enable and MACsec RX SA add. That includes builds
without IPsec. At the end of the series, the _mlx5e_tc_del_flow() and
mlx5e_tc_nic_cleanup() path still has no unblock.
The other teardown paths look fine:
- Health recovery, fw reset, devlink reload and driver unload use
suspend=false.
- _mlx5e_remove() calls unregister_netdev() before _mlx5e_suspend(), so
the TC core flushes the filters through mlx5e_delete_flower() first.
- In switchdev mode, mlx5e_vport_uplink_rep_unload() unregisters the
netdev before the profile change.
So this appears specific to PM suspend in NIC mode.
Should mlx5e_tc_nic_cleanup() also drop the num_block_accel count for each
flow it frees?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129120331.1910180-1-tariqt%40nvidia.com
next prev parent reply other threads:[~2026-11-30 12:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 12:03 [PATCH net-next V5 0/7] net/mlx5e: Prepare for PSP decapsulation Tariq Toukan
2026-11-29 12:03 ` [PATCH net-next V5 1/7] net/mlx5e: Generalize TC <-> IPsec mutual exclusion Tariq Toukan
2026-11-30 12:07 ` netdev-bot+sashiko [this message]
2026-11-29 12:03 ` [PATCH net-next V5 2/7] net/mlx5e: ipsec: Block TC offload when IPsec is enabled Tariq Toukan
2026-11-29 12:03 ` [PATCH net-next V5 3/7] net/mlx5e: psp: Block TC offload when PSP " Tariq Toukan
2026-11-29 12:03 ` [PATCH net-next V5 4/7] net/mlx5e: macsec: Block TC offload when MACsec " Tariq Toukan
2026-11-30 12:07 ` netdev-bot+sashiko
2026-11-29 12:03 ` [PATCH net-next V5 5/7] net/mlx5e: psp: Move RX marker from ft_metadata to flow_tag Tariq Toukan
2026-11-30 12:07 ` netdev-bot+sashiko
2026-11-29 12:03 ` [PATCH net-next V5 6/7] net/mlx5e: ipsec: " Tariq Toukan
2026-11-29 12:03 ` [PATCH net-next V5 7/7] net/mlx5e: macsec: " Tariq Toukan
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=179604045242.3146.11465224103483791527@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=borisp@nvidia.com \
--cc=cjubran@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davem-thinkpadp1gen8.ibmlond.csb \
--cc=davem@davemloft.net \
--cc=doruk@0sec.ai \
--cc=dtatulea@nvidia.com \
--cc=edumazet@kernel.org \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=jianbol@nvidia.com \
--cc=joasantonio108@gmail.com \
--cc=kuba@kernel.org \
--cc=lcy8047@gmail.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=parri.andrea@gmail.com \
--cc=phaddad@nvidia.com \
--cc=ralf@mandelbit.com \
--cc=saeedm@nvidia.com \
--cc=sd@queasysnail.net \
--cc=tariqt@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
all inboxes | Powered by JetHome®