From: Leon Romanovsky <leon@kernel.org>
To: Honggang LI <honggangli@163.com>
Cc: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
danil.kipnis@cloud.ionos.com, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/rtrs: remove dead code
Date: Thu, 18 Dec 2025 15:22:59 +0200 [thread overview]
Message-ID: <20251218132259.GE39046@unreal> (raw)
In-Reply-To: <20251201032405.484231-1-honggangli@163.com>
On Mon, Dec 01, 2025 at 11:24:05AM +0800, Honggang LI wrote:
> As rkey had been initialized to zero, the WARN_ON_ONCE should never been
> triggered. Remove it.
>
> Fixes: 9cb837480424 ("RDMA/rtrs: server: main functionality")
> Signed-off-by: Honggang LI <honggangli@163.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-srv.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> index ef4abdea3c2d..a95640e848a5 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> @@ -240,11 +240,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
> wr->wr.num_sge = 1;
> wr->remote_addr = le64_to_cpu(id->rd_msg->desc[0].addr);
> wr->rkey = le32_to_cpu(id->rd_msg->desc[0].key);
> - if (rkey == 0)
> - rkey = wr->rkey;
> - else
> - /* Only one key is actually used */
> - WARN_ON_ONCE(rkey != wr->rkey);
> + rkey = wr->rkey;
You can go one step further and remove rkey too.
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
index 9ecc6343455d..396dfc41e6da 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
@@ -208,7 +208,6 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
size_t sg_cnt;
int err, offset;
bool need_inval;
- u32 rkey = 0;
struct ib_reg_wr rwr;
struct ib_sge *plist;
struct ib_sge list;
@@ -240,12 +239,6 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
wr->wr.num_sge = 1;
wr->remote_addr = le64_to_cpu(id->rd_msg->desc[0].addr);
wr->rkey = le32_to_cpu(id->rd_msg->desc[0].key);
- if (rkey == 0)
- rkey = wr->rkey;
- else
- /* Only one key is actually used */
- WARN_ON_ONCE(rkey != wr->rkey);
-
wr->wr.opcode = IB_WR_RDMA_WRITE;
wr->wr.wr_cqe = &io_comp_cqe;
wr->wr.ex.imm_data = 0;
@@ -277,7 +270,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
inv_wr.opcode = IB_WR_SEND_WITH_INV;
inv_wr.wr_cqe = &io_comp_cqe;
inv_wr.send_flags = 0;
- inv_wr.ex.invalidate_rkey = rkey;
+ inv_wr.ex.invalidate_rkey = wr->rkey;
}
imm_wr.wr.next = NULL;
~
>
> wr->wr.opcode = IB_WR_RDMA_WRITE;
> wr->wr.wr_cqe = &io_comp_cqe;
> --
> 2.51.1
>
next prev parent reply other threads:[~2025-12-18 13:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-01 3:24 [PATCH] RDMA/rtrs: remove dead code Honggang LI
2025-12-18 13:22 ` Leon Romanovsky [this message]
2025-12-23 3:22 ` Honggang LI
2025-12-23 13:38 ` 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=20251218132259.GE39046@unreal \
--to=leon@kernel.org \
--cc=danil.kipnis@cloud.ionos.com \
--cc=haris.iqbal@ionos.com \
--cc=honggangli@163.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=linux-kernel@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 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.