From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: cel@kernel.org, linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/2] svcrdma: Refactor the creation of listener CMA ID
Date: Mon, 3 Jun 2024 22:03:02 +0800 [thread overview]
Message-ID: <1e54456d-a50d-c1ce-ca3e-e58e7e2bdbc3@linux.dev> (raw)
In-Reply-To: <Zl3DvlqRGasKmhz8@tissot.1015granger.net>
On 6/3/24 21:23, Chuck Lever wrote:
> On Mon, Jun 03, 2024 at 06:59:13PM +0800, Guoqing Jiang wrote:
>>
>> On 5/31/24 21:15, cel@kernel.org wrote:
>>> From: Chuck Lever <chuck.lever@oracle.com>
>>>
>>> In a moment, I will add a second consumer of CMA ID creation in
>>> svcrdma. Refactor so this code can be reused.
>>>
>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>>> ---
>>> net/sunrpc/xprtrdma/svc_rdma_transport.c | 67 ++++++++++++++----------
>>> 1 file changed, 40 insertions(+), 27 deletions(-)
>>>
>>> diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
>>> index 2b1c16b9547d..fa50b7494a0a 100644
>>> --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
>>> +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
>>> @@ -65,6 +65,8 @@
>>> static struct svcxprt_rdma *svc_rdma_create_xprt(struct svc_serv *serv,
>>> struct net *net, int node);
>>> +static int svc_rdma_listen_handler(struct rdma_cm_id *cma_id,
>>> + struct rdma_cm_event *event);
>>> static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
>>> struct net *net,
>>> struct sockaddr *sa, int salen,
>>> @@ -122,6 +124,41 @@ static void qp_event_handler(struct ib_event *event, void *context)
>>> }
>>> }
>>> +static struct rdma_cm_id *
>>> +svc_rdma_create_listen_id(struct net *net, struct sockaddr *sap,
>>> + void *context)
>>> +{
>>> + struct rdma_cm_id *listen_id;
>>> + int ret;
>>> +
>>> + listen_id = rdma_create_id(net, svc_rdma_listen_handler, context,
>>> + RDMA_PS_TCP, IB_QPT_RC);
>>> + if (IS_ERR(listen_id))
>>> + return listen_id;
>> I am wondering if above need to return PTR_ERR(listen_id),
> PTR_ERR would convert the listen_id error to an integer, but
> svc_rdma_create_listen_id() returns a pointer or an ERR_PTR. Thus
> using PTR_ERR() would be wrong in this case.
>
>
>> and I find some
>> callers (in net/rds/, nvme etc)
>> return PTR_ERR(id) while others (rtrs-srv, ib_isert.c) return ERR_PTR(ret)
>> with ret is set to PTR_ERR(id).
> These functions use PTR_ERR only when the calling function returns
> an int.
Thanks for the explanation!
Guoqing
next prev parent reply other threads:[~2024-06-03 14:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 13:15 [PATCH 0/2] Fix ADDR_CHANGE event handling for NFSD cel
2024-05-31 13:15 ` [PATCH 1/2] svcrdma: Refactor the creation of listener CMA ID cel
2024-06-03 10:59 ` Guoqing Jiang
2024-06-03 13:23 ` Chuck Lever
2024-06-03 14:03 ` Guoqing Jiang [this message]
2024-05-31 13:15 ` [PATCH 2/2] svcrdma: Handle ADDR_CHANGE CM event properly cel
2024-06-01 10:48 ` Zhu Yanjun
2024-06-01 16:00 ` Chuck Lever
2024-06-02 7:50 ` [PATCH 0/2] Fix ADDR_CHANGE event handling for NFSD Sagi Grimberg
2024-06-03 13:24 ` Chuck Lever III
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=1e54456d-a50d-c1ce-ca3e-e58e7e2bdbc3@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=cel@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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