From: Yanjun Zhu <yanjun.zhu@linux.dev>
To: Bob Pearson <rpearsonhpe@gmail.com>,
jgg@ziepe.ca, leon@kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/1] RDMA/rxe: Compact the function free_rd_atomic_resource
Date: Tue, 17 May 2022 23:14:56 +0800 [thread overview]
Message-ID: <f3a827f0-69bd-7bae-21cf-02a88063d39d@linux.dev> (raw)
In-Reply-To: <c9e99081-f6aa-0167-77ff-57533b107e90@gmail.com>
在 2022/5/17 22:51, Bob Pearson 写道:
> On 5/17/22 14:08, yanjun.zhu@linux.dev wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> Compact the function and move it to the header file.
> I have two issues with this patch.
>
> There is no advantage of having an inline function in a header file
> that is only called once. The compiler is perfectly capable of (and does)
> inlining a static function in a .c file if only called once. This just
> makes the code harder to read.
When this function is put into the header file, this function can be
included into the caller function file.
The compiler does not need to call this function in different file. In
theory, this can increase
the compile speed.
Why do you insist on putting this function in .c file?
Zhu Yanjun
>
> There is a patch in for-rc that gets rid of read.mr in favor of an rkey.
> This patch is out of date.
>
> Bob
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> drivers/infiniband/sw/rxe/rxe_loc.h | 11 ++++++++++-
>> drivers/infiniband/sw/rxe/rxe_qp.c | 15 ++-------------
>> drivers/infiniband/sw/rxe/rxe_resp.c | 4 ++--
>> 3 files changed, 14 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rxe/rxe_loc.h
>> index 409efeecd581..6517b4f104b1 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_loc.h
>> +++ b/drivers/infiniband/sw/rxe/rxe_loc.h
>> @@ -145,7 +145,16 @@ static inline int rcv_wqe_size(int max_sge)
>> max_sge * sizeof(struct ib_sge);
>> }
>>
>> -void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res);
>> +static inline void free_rd_atomic_resource(struct resp_res *res)
>> +{
>> + if (res->type == RXE_ATOMIC_MASK) {
>> + kfree_skb(res->atomic.skb);
>> + } else if (res->type == RXE_READ_MASK) {
>> + if (res->read.mr)
>> + rxe_drop_ref(res->read.mr);
>> + }
>> + res->type = 0;
>> +}
>>
>> static inline void rxe_advance_resp_resource(struct rxe_qp *qp)
>> {
>> diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
>> index 5f270cbf18c6..b29208852bc4 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_qp.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_qp.c
>> @@ -126,24 +126,13 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)
>> for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
>> struct resp_res *res = &qp->resp.resources[i];
>>
>> - free_rd_atomic_resource(qp, res);
>> + free_rd_atomic_resource(res);
>> }
>> kfree(qp->resp.resources);
>> qp->resp.resources = NULL;
>> }
>> }
>>
>> -void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res)
>> -{
>> - if (res->type == RXE_ATOMIC_MASK) {
>> - kfree_skb(res->atomic.skb);
>> - } else if (res->type == RXE_READ_MASK) {
>> - if (res->read.mr)
>> - rxe_drop_ref(res->read.mr);
>> - }
>> - res->type = 0;
>> -}
>> -
>> static void cleanup_rd_atomic_resources(struct rxe_qp *qp)
>> {
>> int i;
>> @@ -152,7 +141,7 @@ static void cleanup_rd_atomic_resources(struct rxe_qp *qp)
>> if (qp->resp.resources) {
>> for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
>> res = &qp->resp.resources[i];
>> - free_rd_atomic_resource(qp, res);
>> + free_rd_atomic_resource(res);
>> }
>> }
>> }
>> diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
>> index c369d78fc8e8..923a71ff305c 100644
>> --- a/drivers/infiniband/sw/rxe/rxe_resp.c
>> +++ b/drivers/infiniband/sw/rxe/rxe_resp.c
>> @@ -663,7 +663,7 @@ static enum resp_states read_reply(struct rxe_qp *qp,
>> */
>> res = &qp->resp.resources[qp->resp.res_head];
>>
>> - free_rd_atomic_resource(qp, res);
>> + free_rd_atomic_resource(res);
>> rxe_advance_resp_resource(qp);
>>
>> res->type = RXE_READ_MASK;
>> @@ -977,7 +977,7 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
>> }
>>
>> res = &qp->resp.resources[qp->resp.res_head];
>> - free_rd_atomic_resource(qp, res);
>> + free_rd_atomic_resource(res);
>> rxe_advance_resp_resource(qp);
>>
>> skb_get(skb);
next prev parent reply other threads:[~2022-05-17 15:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 19:08 [PATCH 1/1] RDMA/rxe: Compact the function free_rd_atomic_resource yanjun.zhu
2022-05-17 14:51 ` Bob Pearson
2022-05-17 14:55 ` Jason Gunthorpe
2022-05-17 15:14 ` Yanjun Zhu [this message]
2022-05-17 15:49 ` Bob Pearson
2022-05-19 14:00 ` Yanjun Zhu
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=f3a827f0-69bd-7bae-21cf-02a88063d39d@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=rpearsonhpe@gmail.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.