From 11dac22ca06323148a387f71aef2a9885d5efa10 Mon Sep 17 00:00:00 2001 From: Shay Drory Date: Wed, 23 Sep 2026 13:38:19 +0300 Subject: [PATCH] net/mlx5: E-switch, do not leave an unpaired devcom registered If the initial PAIR event fails, the eswitch offloads devcom component stays registered until eswitch teardown even though no peer was ever paired. devcom is optional, so this is not a functional bug - but a registered component that reflects no actual pairing is incorrect state to keep around. Release it when the initial pairing fails. Signed-off-by: Shay Drory Reviewed-by: Moshe Shemesh Reviewed-by: Akiva Goldberger Signed-off-by: Tariq Toukan Link: https://patch.msgid.link/20260923103830.1183-3-tariqt@nvidia.com Signed-off-by: Jakub Kicinski --- .../ethernet/mellanox/mlx5/core/eswitch_offloads.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index eb74b6260168..e7d92d9bde16 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -3548,6 +3548,7 @@ err_out: void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, const struct mlx5_devcom_match_attr *attr) { + int err; int i; for (i = 0; i < MLX5_MAX_PORTS; i++) @@ -3572,10 +3573,12 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, if (!esw->devcom) return; - mlx5_devcom_send_event(esw->devcom, - ESW_OFFLOADS_DEVCOM_PAIR, - ESW_OFFLOADS_DEVCOM_UNPAIR, - esw); + err = mlx5_devcom_send_event(esw->devcom, + ESW_OFFLOADS_DEVCOM_PAIR, + ESW_OFFLOADS_DEVCOM_UNPAIR, + esw); + if (err) + mlx5_esw_offloads_devcom_cleanup(esw); } void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw)