public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
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: Tue, 23 Dec 2025 15:38:04 +0200	[thread overview]
Message-ID: <20251223133804.GA11869@unreal> (raw)
In-Reply-To: <aUoK5SoYcJXTpUAQ@fedora>

On Tue, Dec 23, 2025 at 11:22:13AM +0800, Honggang LI wrote:
> On Thu, Dec 18, 2025 at 03:22:59PM +0200, Leon Romanovsky wrote:
> > Subject: Re: [PATCH] RDMA/rtrs: remove dead code
> > From: Leon Romanovsky <leon@kernel.org>
> > Date: Thu, 18 Dec 2025 15:22:59 +0200
> > 
> > 
> > You can go one step further and remove rkey too.
> 
> You are right. But I'd like to keep rkey for readability.
> 
> How about follwing patch?
> 
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> index 9ecc6343455d..4efb71c04a40 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c
> @@ -208,7 +208,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id)
>  	size_t sg_cnt;
>  	int err, offset;
>  	bool need_inval;
> -	u32 rkey = 0;
> +	u32 rkey;
>  	struct ib_reg_wr rwr;
>  	struct ib_sge *plist;
>  	struct ib_sge list;
> @@ -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;
>  
>  	wr->wr.opcode = IB_WR_RDMA_WRITE;
>  	wr->wr.wr_cqe   = &io_comp_cqe;
> 
> 
> Anyway, if you persisted, I will send a new patch as you suggested.

Please send new patch, there is not much readability in keeping "rkey =
wr->rkey" line.

Thanks

> 
> thanks
> > 
> > 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;
> 

      reply	other threads:[~2025-12-23 13:38 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
2025-12-23  3:22   ` Honggang LI
2025-12-23 13:38     ` Leon Romanovsky [this message]

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=20251223133804.GA11869@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox