public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Guralnik <michaelgur@nvidia.com>
To: <jgg@nvidia.com>
Cc: <linux-rdma@vger.kernel.org>, <leonro@nvidia.com>,
	<mbloch@nvidia.com>, <cmeiohas@nvidia.com>, <msanalla@nvidia.com>,
	<dsahern@gmail.com>, "Michael Guralnik" <michaelgur@nvidia.com>
Subject: [PATCH v3 rdma-next 1/7] RDMA/mlx5: Check RoCE LAG status before getting netdev
Date: Mon, 9 Sep 2024 20:30:19 +0300	[thread overview]
Message-ID: <20240909173025.30422-2-michaelgur@nvidia.com> (raw)
In-Reply-To: <20240909173025.30422-1-michaelgur@nvidia.com>

From: Mark Bloch <mbloch@nvidia.com>

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>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
 drivers/infiniband/hw/mlx5/main.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index b85ad3c0bfa1..cdf1ce0f6b34 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()
 	 */
-- 
2.17.2


  reply	other threads:[~2024-09-09 17:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 17:30 [PATCH rdma-next v3 0/7] Support RDMA events monitoring through Michael Guralnik
2024-09-09 17:30 ` Michael Guralnik [this message]
2024-09-10  3:58   ` [PATCH v3 rdma-next 1/7] RDMA/mlx5: Check RoCE LAG status before getting netdev Kalesh Anakkur Purayil
2024-09-09 17:30 ` [PATCH v3 rdma-next 2/7] RDMA/mlx5: Obtain upper net device only when needed Michael Guralnik
2024-09-10  3:59   ` Kalesh Anakkur Purayil
2024-09-09 17:30 ` [PATCH v3 rdma-next 3/7] RDMA/mlx5: Initialize phys_port_cnt earlier in RDMA device creation Michael Guralnik
2024-09-09 17:30 ` [PATCH v3 rdma-next 4/7] RDMA/device: Remove optimization in ib_device_get_netdev() Michael Guralnik
2024-09-10  4:00   ` Kalesh Anakkur Purayil
2024-09-09 17:30 ` [PATCH v3 rdma-next 5/7] RDMA/mlx5: Use IB set_netdev and get_netdev functions Michael Guralnik
2024-09-09 17:30 ` [PATCH v3 rdma-next 6/7] RDMA/nldev: Add support for RDMA monitoring Michael Guralnik
2024-09-09 18:05   ` Leon Romanovsky
2024-09-10 11:09   ` Leon Romanovsky
2024-09-09 17:30 ` [PATCH v3 rdma-next 7/7] RDMA/nldev: Expose whether RDMA monitoring is supported Michael Guralnik
2024-09-11 13:30 ` [PATCH rdma-next v3 0/7] Support RDMA events monitoring through Leon Romanovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240909173025.30422-2-michaelgur@nvidia.com \
    --to=michaelgur@nvidia.com \
    --cc=cmeiohas@nvidia.com \
    --cc=dsahern@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=leonro@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=msanalla@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox