* [PATCH net-next] net/mlx5e: kTLS, Simplify error unwind in mlx5e_ktls_set_feature_rx()
@ 2026-11-16 11:08 Xuanqiang Luo
2026-11-16 11:12 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Xuanqiang Luo @ 2026-11-16 11:08 UTC (permalink / raw)
To: netdev
Cc: horms, saeedm, leon, tariqt, mbloch, borisp, witu, andrew+netdev,
davem, edumazet, kuba, pabeni, linux-rdma, linux-kernel,
Xuanqiang Luo
From: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
mlx5e_ktls_set_feature_rx() has become harder to follow: the error
handling is nested in the conditions and the main flow is conditional.
Handle the error cases in conditionals, keep the main flow
unconditional, and destroy the accel TCP flow tables in a single
place. Use goto to unlock on the early return.
No functional change intended.
Suggested-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/all/20261029134019.GG257209@horms.kernel.org/
Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn>
---
Only compile-tested on top of net-next 7ccc5e05043b (arm64, W=1). I do
not have a crypto-enabled ConnectX NIC to run it on.
.../mellanox/mlx5/core/en_accel/ktls.c | 23 +++++++++++--------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
index 3cc1213c2f68..0f5dcd1b822e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
@@ -137,19 +137,22 @@ int mlx5e_ktls_set_feature_rx(struct net_device *netdev, bool enable)
mutex_lock(&priv->state_lock);
if (enable) {
err = mlx5e_accel_fs_tcp_create(priv->fs);
- if (!err && !priv->ktls_rx_was_enabled) {
- priv->ktls_rx_was_enabled = true;
- err = mlx5e_safe_reopen_channels(priv);
- if (err) {
- priv->ktls_rx_was_enabled = false;
- mlx5e_accel_fs_tcp_destroy(priv->fs);
- }
+ if (err || priv->ktls_rx_was_enabled)
+ goto out_unlock;
+
+ priv->ktls_rx_was_enabled = true;
+ err = mlx5e_safe_reopen_channels(priv);
+ if (err) {
+ priv->ktls_rx_was_enabled = false;
+ enable = false;
}
- } else {
- mlx5e_accel_fs_tcp_destroy(priv->fs);
}
- mutex_unlock(&priv->state_lock);
+ if (!enable)
+ mlx5e_accel_fs_tcp_destroy(priv->fs);
+
+out_unlock:
+ mutex_unlock(&priv->state_lock);
return err;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-16 11:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 11:08 [PATCH net-next] net/mlx5e: kTLS, Simplify error unwind in mlx5e_ktls_set_feature_rx() Xuanqiang Luo
2026-11-16 11:12 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox