Skip to content

Commit

Permalink
Revert "RDMA/mlx5: Fix devlink deadlock on net namespace deletion"
Browse files Browse the repository at this point in the history
commit de641d7 upstream.

This reverts commit fbdd004.

Due to commit in fixes tag, netdevice events were received only in one net
namespace of mlx5_core_dev. Due to this when netdevice events arrive in
net namespace other than net namespace of mlx5_core_dev, they are missed.

This results in empty GID table due to RDMA device being detached from its
net device.

Hence, revert back to receive netdevice events in all net namespaces to
restore back RDMA functionality in non init_net net namespace. The
deadlock will have to be addressed in another patch.

Fixes: fbdd004 ("RDMA/mlx5: Fix devlink deadlock on net namespace deletion")
Link: https://lore.kernel.org/r/20210117092633.10690-1-leon@kernel.org
Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
paravmellanox authored and gregkh committed Feb 3, 2021
1 parent 28adabf commit 34b0c04
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 22 deletions.
6 changes: 2 additions & 4 deletions drivers/infiniband/hw/mlx5/main.c
Expand Up @@ -3305,8 +3305,7 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
int err;

dev->port[port_num].roce.nb.notifier_call = mlx5_netdev_event;
err = register_netdevice_notifier_net(mlx5_core_net(dev->mdev),
&dev->port[port_num].roce.nb);
err = register_netdevice_notifier(&dev->port[port_num].roce.nb);
if (err) {
dev->port[port_num].roce.nb.notifier_call = NULL;
return err;
Expand All @@ -3318,8 +3317,7 @@ static int mlx5_add_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
static void mlx5_remove_netdev_notifier(struct mlx5_ib_dev *dev, u8 port_num)
{
if (dev->port[port_num].roce.nb.notifier_call) {
unregister_netdevice_notifier_net(mlx5_core_net(dev->mdev),
&dev->port[port_num].roce.nb);
unregister_netdevice_notifier(&dev->port[port_num].roce.nb);
dev->port[port_num].roce.nb.notifier_call = NULL;
}
}
Expand Down
5 changes: 5 additions & 0 deletions drivers/net/ethernet/mellanox/mlx5/core/lib/mlx5.h
Expand Up @@ -90,4 +90,9 @@ int mlx5_create_encryption_key(struct mlx5_core_dev *mdev,
u32 key_type, u32 *p_key_id);
void mlx5_destroy_encryption_key(struct mlx5_core_dev *mdev, u32 key_id);

static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
{
return devlink_net(priv_to_devlink(dev));
}

#endif
18 changes: 0 additions & 18 deletions include/linux/mlx5/driver.h
Expand Up @@ -1213,22 +1213,4 @@ static inline bool mlx5_is_roce_enabled(struct mlx5_core_dev *dev)
return val.vbool;
}

/**
* mlx5_core_net - Provide net namespace of the mlx5_core_dev
* @dev: mlx5 core device
*
* mlx5_core_net() returns the net namespace of mlx5 core device.
* This can be called only in below described limited context.
* (a) When a devlink instance for mlx5_core is registered and
* when devlink reload operation is disabled.
* or
* (b) during devlink reload reload_down() and reload_up callbacks
* where it is ensured that devlink instance's net namespace is
* stable.
*/
static inline struct net *mlx5_core_net(struct mlx5_core_dev *dev)
{
return devlink_net(priv_to_devlink(dev));
}

#endif /* MLX5_DRIVER_H */

0 comments on commit 34b0c04

Please sign in to comment.