Skip to content

Commit

Permalink
RDMA/mlx5: Check RoCE LAG status before getting netdev
Browse files Browse the repository at this point in the history
Check if RoCE LAG is active before calling the LAG layer for netdev.
This clarifies if LAG is active. No behavior changes with this patch.

Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Link: https://patch.msgid.link/20240909173025.30422-2-michaelgur@nvidia.com
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
  • Loading branch information
Mark Bloch authored and Leon Romanovsky committed Sep 13, 2024
1 parent c77aec6 commit 303ee44
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions drivers/infiniband/hw/mlx5/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,18 @@ static int mlx5_netdev_event(struct notifier_block *this,
case NETDEV_CHANGE:
case NETDEV_UP:
case NETDEV_DOWN: {
struct net_device *lag_ndev = mlx5_lag_get_roce_netdev(mdev);
struct net_device *upper = NULL;

if (lag_ndev) {
upper = netdev_master_upper_dev_get(lag_ndev);
dev_put(lag_ndev);
if (mlx5_lag_is_roce(mdev)) {
struct net_device *lag_ndev;

lag_ndev = mlx5_lag_get_roce_netdev(mdev);
if (lag_ndev) {
upper = netdev_master_upper_dev_get(lag_ndev);
dev_put(lag_ndev);
} else {
goto done;
}
}

if (ibdev->is_rep)
Expand Down Expand Up @@ -257,9 +263,10 @@ static struct net_device *mlx5_ib_get_netdev(struct ib_device *device,
if (!mdev)
return NULL;

ndev = mlx5_lag_get_roce_netdev(mdev);
if (ndev)
if (mlx5_lag_is_roce(mdev)) {
ndev = mlx5_lag_get_roce_netdev(mdev);
goto out;
}

/* Ensure ndev does not disappear before we invoke dev_hold()
*/
Expand Down

0 comments on commit 303ee44

Please sign in to comment.