This Linux kernel change "net/mlx5: Use reversed order when unregister devices" is included in the Linux 4.19.66 release. This change is authored by Mark Zhang <markz [at] mellanox.com> on Tue Jul 9 05:37:12 2019 +0300. The commit for this change in Linux stable tree is 4dddd08 (patch) which is from upstream commit 08aa5e7. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 08aa5e7.
net/mlx5: Use reversed order when unregister devices [ Upstream commit 08aa5e7da6bce1a1963f63cf32c2e7ad434ad578 ] When lag is active, which is controlled by the bonded mlx5e netdev, mlx5 interface unregestering must happen in the reverse order where rdma is unregistered (unloaded) first, to guarantee all references to the lag context in hardware is removed, then remove mlx5e netdev interface which will cleanup the lag context from hardware. Without this fix during destroy of LAG interface, we observed following errors: * mlx5_cmd_check:752:(pid 12556): DESTROY_LAG(0x843) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0xe4ac33) * mlx5_cmd_check:752:(pid 12556): DESTROY_LAG(0x843) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0xa5aee8). Fixes: a31208b1e11d ("net/mlx5_core: New init and exit flow for mlx5_core") Reviewed-by: Parav Pandit <firstname.lastname@example.org> Reviewed-by: Leon Romanovsky <email@example.com> Signed-off-by: Mark Zhang <firstname.lastname@example.org> Signed-off-by: Saeed Mahameed <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/net/ethernet/mellanox/mlx5/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c index 1c225be..3692d6a 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c @@ -307,7 +307,7 @@ void mlx5_unregister_device(struct mlx5_core_dev *dev) struct mlx5_interface *intf; mutex_lock(&mlx5_intf_mutex); - list_for_each_entry(intf, &intf_list, list) + list_for_each_entry_reverse(intf, &intf_list, list) mlx5_remove_device(intf, priv); list_del(&priv->dev_list); mutex_unlock(&mlx5_intf_mutex);