All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cheng Xu <chengyou@linux.alibaba.com>
To: jgg@ziepe.ca, dledford@redhat.com, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, KaiShen@linux.alibaba.com,
	chengyou@linux.alibaba.com, tonylu@linux.alibaba.com,
	BMT@zurich.ibm.com
Subject: [PATCH for-next v5 02/12] RDMA/core: Allow calling query_port when netdev isn't attached in iWarp
Date: Wed,  6 Apr 2022 10:34:40 +0800	[thread overview]
Message-ID: <20220406023450.56683-3-chengyou@linux.alibaba.com> (raw)
In-Reply-To: <20220406023450.56683-1-chengyou@linux.alibaba.com>

This change lets the iWarp device drivers decide the return value of
iw_query_port when attached netdev is NULL. This allows ib_register_device
calling when netdev is NULL.

background info:
https://lore.kernel.org/all/20220118141324.GF8034@ziepe.ca/

Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
---
 drivers/infiniband/core/device.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index a311df07b1bd..1638b1188dc8 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -2019,8 +2019,12 @@ static int iw_query_port(struct ib_device *device,
 	memset(port_attr, 0, sizeof(*port_attr));
 
 	netdev = ib_device_get_netdev(device, port_num);
+	/* Some iwarp device may be not binded to a netdev temporarily when
+	 * ib_register_device called. To adapt this scenario, allowing iWarp
+	 * device drivers decide the return value.
+	 */
 	if (!netdev)
-		return -ENODEV;
+		goto query_port;
 
 	port_attr->max_mtu = IB_MTU_4096;
 	port_attr->active_mtu = ib_mtu_int_to_enum(netdev->mtu);
@@ -2045,6 +2049,7 @@ static int iw_query_port(struct ib_device *device,
 	}
 
 	dev_put(netdev);
+query_port:
 	return device->ops.query_port(device, port_num, port_attr);
 }
 
-- 
2.27.0


  parent reply	other threads:[~2022-04-06  8:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  2:34 [PATCH for-next v5 00/12] Elastic RDMA Adapter (ERDMA) driver Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 01/12] RDMA: Add ERDMA to rdma_driver_id definition Cheng Xu
2022-04-06  2:34 ` Cheng Xu [this message]
2022-04-06  2:34 ` [PATCH for-next v5 03/12] RDMA/erdma: Add the hardware related definitions Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 04/12] RDMA/erdma: Add main include file Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 05/12] RDMA/erdma: Add cmdq implementation Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 06/12] RDMA/erdma: Add event queue implementation Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 07/12] RDMA/erdma: Add verbs header file Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 08/12] RDMA/erdma: Add verbs implementation Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 09/12] RDMA/erdma: Add connection management (CM) support Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 10/12] RDMA/erdma: Add the erdma module Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 11/12] RDMA/erdma: Add the ABI definitions Cheng Xu
2022-04-06  2:34 ` [PATCH for-next v5 12/12] RDMA/erdma: Add driver to kernel build environment Cheng Xu
2022-04-11  2:52 ` [PATCH for-next v5 00/12] Elastic RDMA Adapter (ERDMA) driver Cheng Xu

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=20220406023450.56683-3-chengyou@linux.alibaba.com \
    --to=chengyou@linux.alibaba.com \
    --cc=BMT@zurich.ibm.com \
    --cc=KaiShen@linux.alibaba.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tonylu@linux.alibaba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.