Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by netdev-bot+sashiko
Fri, 27 Nov 2026 22:32
Re: [PATCH net 04/10] net/mlx5e: Drain pending hardware event work before freeing IPsec SA
Author: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 22:32
Date: Fri, 27 Nov 2026 22:32
93 lines
11422 bytes
11422 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message leaves out a second change to IPsec init and
teardown ordering.
--
net/mlx5e: Drain pending hardware event work before freeing IPsec SA
The IPsec hardware event work item now lives in struct
mlx5e_ipsec_sa_entry instead of being allocated for each event. This lets
mlx5e_xfrm_free_state() call mlx5_eq_synchronize_async_irq() and then
cancel_work_sync() on it before the SA is freed. The patch also moves the
mlx5 notifier registration out of the ASO helpers and into
mlx5e_ipsec_init() and mlx5e_ipsec_cleanup().
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> index a549851c83827..ea7a1ae2056fa 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
[ ... ]
> @@ -1022,18 +1031,22 @@ void mlx5e_ipsec_init(struct mlx5e_priv *priv)
> if (!ipsec->wq)
> goto err_wq;
>
> - if (mlx5_ipsec_device_caps(priv->mdev) &
> - MLX5_IPSEC_CAP_PACKET_OFFLOAD) {
> + if (pkt_offload) {
> ret = mlx5e_ipsec_aso_init(ipsec);
> if (ret)
> goto err_aso;
> +
> + ipsec->nb.notifier_call = mlx5e_ipsec_event;
> + ret = mlx5_notifier_register(priv->mdev, &ipsec->nb);
> + if (ret)
> + goto clear_aso;
> }
[ ... ]
> @@ -1073,8 +1089,10 @@ void mlx5e_ipsec_cleanup(struct mlx5e_priv *priv)
> ipsec->netevent_nb.notifier_call = NULL;
> }
> if (ipsec->aso)
> - mlx5e_ipsec_aso_cleanup(ipsec);
> + mlx5_notifier_unregister(ipsec->mdev, &ipsec->nb);
> destroy_workqueue(ipsec->wq);
> + if (ipsec->aso)
> + mlx5e_ipsec_aso_cleanup(ipsec);
> kfree(ipsec);
> priv->ipsec = NULL;
> }
[Severity: Low]
Could the commit message also describe this init and teardown change?
Right now it only covers embedding event_work in sa_entry and cancelling
it in mlx5e_xfrm_free_state().
The patch also makes these changes:
- mlx5_notifier_register() and mlx5_notifier_unregister() for ipsec->nb
move out of mlx5e_ipsec_aso_init() and mlx5e_ipsec_aso_cleanup() in
ipsec_offload.c. They now live in mlx5e_ipsec_init() and
mlx5e_ipsec_cleanup().
- mlx5e_ipsec_init() now checks the return value of
mlx5_notifier_register(), which was ignored before. It also gains a
new err_notifier unwind label.
- mlx5e_ipsec_cleanup() now calls destroy_workqueue() before
mlx5e_ipsec_aso_cleanup(), where it used to call it after.
The reorder looks like a fix for a separate lifetime problem. Before this
patch, event work still pending on ipsec->wq could run this path after the
ASO had been freed and ipsec->aso set to NULL:
mlx5e_ipsec_handle_event()->mlx5e_ipsec_aso_query()
The new ordering looks correct. Without a note in the changelog, though,
someone backporting this may not see that the ordering change is needed.
Would it make sense to add a sentence explaining why the workqueue has to
be drained before the ASO is torn down?
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126215614.792598-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