Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Mon, 30 Nov 2026 12:07
Re: [PATCH net-next V5 4/7] net/mlx5e: macsec: Block TC offload when MACsec is enabled
Author: netdev-bot+sashiko
Date: Mon, 30 Nov 2026 12:07
Date: Mon, 30 Nov 2026 12:07
116 lines
12484 bytes
12484 bytes
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] This patch makes every installed MACsec RX decrypt rule take a
device-wide TC block.
--
net/mlx5e: macsec: Block TC offload when MACsec is enabled
This patch makes each installed MACsec RX decrypt rule hold a device-wide
TC offload block. The block is taken in mlx5e_macsec_init_sa_fs() and
released in mlx5e_macsec_cleanup_sa_fs(). macsec_upd_secy_hw_address()
also keeps TC blocked while it rebuilds the RX rules.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> index 13896e9c1d331..146f1036dba42 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
[ ... ]
> @@ -325,6 +326,8 @@ static void mlx5e_macsec_cleanup_sa_fs(struct mlx5e_macsec *macsec,
> mlx5_macsec_fs_del_rule(macsec->mdev->macsec_fs, sa->macsec_rule, action, netdev,
> fs_id);
> sa->macsec_rule = NULL;
> + if (!is_tx)
> + mlx5e_accel_unblock_tc_offload(macsec->mdev);
> }
[ ... ]
> @@ -354,13 +358,26 @@ static int mlx5e_macsec_init_sa_fs(struct macsec_context *ctx,
> rule_attrs.action = (is_tx) ? MLX5_ACCEL_MACSEC_ACTION_ENCRYPT :
> MLX5_ACCEL_MACSEC_ACTION_DECRYPT;
>
> + if (!is_tx) {
> + err = mlx5e_accel_block_tc_offload(priv->mdev);
> + if (err)
> + return err;
> + }
> +
[Severity: Medium]
Can mdev->offload_block.num_block_tc leak here when the NIC profile is
torn down while RX SAs are still installed?
The only place this block is released is mlx5e_macsec_cleanup_sa_fs().
When the eswitch moves from legacy to switchdev, the path is:
mlx5e_vport_uplink_rep_load()
mlx5e_netdev_change_profile()
priv->profile->cleanup(priv) == mlx5e_nic_cleanup()
mlx5e_macsec_cleanup()
mlx5e_macsec_cleanup() tears everything down without walking the RX SAs:
mlx5_notifier_unregister(mdev, &macsec->nb);
mlx5_macsec_fs_cleanup(mdev->macsec_fs);
destroy_workqueue(macsec->wq);
mlx5e_macsec_aso_cleanup(&macsec->aso, mdev);
mutex_destroy(&macsec->lock);
kfree(macsec);
The netdev stays registered during a profile change. The MACsec core
(macsec_notify() in drivers/net/macsec.c) only deletes secys on
NETDEV_UNREGISTER, so mdo_del_secy is never called either.
Unlike IPsec, MACsec does not call mlx5_eswitch_block_mode(), so nothing
prevents this mode change.
After the switch, num_block_tc stays above zero in struct mlx5_core_dev.
It is only initialized at mdev init and is never reset. The uplink
representor reuses the same netdev, and is_tc_accel_check_needed()
returns true for it. Every mlx5e_configure_flower() on the uplink would
then fail in mlx5e_tc_block_accel_offload():
if (mdev->offload_block.num_block_tc)
ret = -EBUSY;
Going back to legacy mode doesn't seem to recover either.
mlx5e_macsec_init() allocates a fresh, empty context, so a later
mdo_del_secy can't find the device and never unblocks. TC offload on the
uplink/NIC netdev would stay disabled until the mlx5_core_dev is
re-probed.
Dropping SA rules during profile teardown is an older problem. The
persistent device-level TC block is what turns it into a lasting TC
offload outage. Later patches in the series don't seem to touch
mlx5e_macsec_cleanup() or the profile-change path.
Should mlx5e_macsec_cleanup() release the TC blocks held by installed RX
rules? Alternatively, should MACsec RX offload block the eswitch mode
change?
> macsec_rule = mlx5_macsec_fs_add_rule(macsec_fs, ctx, &rule_attrs, fs_id);
> - if (!macsec_rule)
> - return -ENOMEM;
> + if (!macsec_rule) {
> + err = -ENOMEM;
> + goto out_unblock_tc;
> + }
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261129120331.1910180-1-tariqt%40nvidia.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads