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 v6 02/12] RDMA/core: Allow calling query_port when netdev isn't attached in iWarp
Date: Tue, 12 Apr 2022 10:37:11 +0800 [thread overview]
Message-ID: <20220412023721.47371-3-chengyou@linux.alibaba.com> (raw)
In-Reply-To: <20220412023721.47371-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
next prev parent reply other threads:[~2022-04-12 2:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-12 2:37 [PATCH for-next v6 00/12] Elastic RDMA Adapter (ERDMA) driver Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 01/12] RDMA: Add ERDMA to rdma_driver_id definition Cheng Xu
2022-04-12 2:37 ` Cheng Xu [this message]
2022-04-12 2:37 ` [PATCH for-next v6 03/12] RDMA/erdma: Add the hardware related definitions Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 04/12] RDMA/erdma: Add main include file Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 05/12] RDMA/erdma: Add cmdq implementation Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 06/12] RDMA/erdma: Add event queue implementation Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 07/12] RDMA/erdma: Add verbs header file Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 08/12] RDMA/erdma: Add verbs implementation Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 09/12] RDMA/erdma: Add connection management (CM) support Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 10/12] RDMA/erdma: Add the erdma module Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 11/12] RDMA/erdma: Add the ABI definitions Cheng Xu
2022-04-12 2:37 ` [PATCH for-next v6 12/12] RDMA/erdma: Add driver to kernel build environment 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=20220412023721.47371-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox