summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx5/main.c
diff options
context:
space:
mode:
authorMark Bloch <mbloch@nvidia.com>2024-09-09 19:30:19 +0200
committerLeon Romanovsky <leon@kernel.org>2024-09-13 07:27:40 +0200
commit303ee44ac4b98196a4a311c670d3db0dc38cee84 (patch)
treef4eb435ffbc87454e382275d143c9a828836be29 /drivers/infiniband/hw/mlx5/main.c
parentRDMA/mlx5: Consider the query_vuid cap for data_direct (diff)
downloadlinux-303ee44ac4b98196a4a311c670d3db0dc38cee84.tar.xz
linux-303ee44ac4b98196a4a311c670d3db0dc38cee84.zip
RDMA/mlx5: Check RoCE LAG status before getting netdev
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>
Diffstat (limited to 'drivers/infiniband/hw/mlx5/main.c')
-rw-r--r--drivers/infiniband/hw/mlx5/main.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index af9ccae684ba..f09900435aa8 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -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)
@@ -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()
*/