Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag
@ 2024-03-20  9:20 Guixin Liu
  2024-03-20 10:45 ` Sagi Grimberg
  0 siblings, 1 reply; 3+ messages in thread
From: Guixin Liu @ 2024-03-20  9:20 UTC (permalink / raw)
  To: hch, sagi, kch; +Cc: linux-nvme

We can simply use invalidate_rkey to check instead of adding a flag.

Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
 drivers/nvme/target/rdma.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
index f2bb9d95ecf4..d0bc72c75471 100644
--- a/drivers/nvme/target/rdma.c
+++ b/drivers/nvme/target/rdma.c
@@ -53,7 +53,6 @@ struct nvmet_rdma_cmd {
 
 enum {
 	NVMET_RDMA_REQ_INLINE_DATA	= (1 << 0),
-	NVMET_RDMA_REQ_INVALIDATE_RKEY	= (1 << 1),
 };
 
 struct nvmet_rdma_rsp {
@@ -722,7 +721,7 @@ static void nvmet_rdma_queue_response(struct nvmet_req *req)
 	struct rdma_cm_id *cm_id = rsp->queue->cm_id;
 	struct ib_send_wr *first_wr;
 
-	if (rsp->flags & NVMET_RDMA_REQ_INVALIDATE_RKEY) {
+	if (rsp->invalidate_rkey) {
 		rsp->send_wr.opcode = IB_WR_SEND_WITH_INV;
 		rsp->send_wr.ex.invalidate_rkey = rsp->invalidate_rkey;
 	} else {
@@ -905,10 +904,8 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,
 		goto error_out;
 	rsp->n_rdma += ret;
 
-	if (invalidate) {
+	if (invalidate)
 		rsp->invalidate_rkey = key;
-		rsp->flags |= NVMET_RDMA_REQ_INVALIDATE_RKEY;
-	}
 
 	return 0;
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag
  2024-03-20  9:20 [PATCH] nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag Guixin Liu
@ 2024-03-20 10:45 ` Sagi Grimberg
  2024-03-20 10:56   ` Guixin Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2024-03-20 10:45 UTC (permalink / raw)
  To: Guixin Liu, hch, kch; +Cc: linux-nvme



On 20/03/2024 11:20, Guixin Liu wrote:
> We can simply use invalidate_rkey to check instead of adding a flag.
>
> Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
> ---
>   drivers/nvme/target/rdma.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c
> index f2bb9d95ecf4..d0bc72c75471 100644
> --- a/drivers/nvme/target/rdma.c
> +++ b/drivers/nvme/target/rdma.c
> @@ -53,7 +53,6 @@ struct nvmet_rdma_cmd {
>   
>   enum {
>   	NVMET_RDMA_REQ_INLINE_DATA	= (1 << 0),
> -	NVMET_RDMA_REQ_INVALIDATE_RKEY	= (1 << 1),
>   };
>   
>   struct nvmet_rdma_rsp {
> @@ -722,7 +721,7 @@ static void nvmet_rdma_queue_response(struct nvmet_req *req)
>   	struct rdma_cm_id *cm_id = rsp->queue->cm_id;
>   	struct ib_send_wr *first_wr;
>   
> -	if (rsp->flags & NVMET_RDMA_REQ_INVALIDATE_RKEY) {
> +	if (rsp->invalidate_rkey) {
>   		rsp->send_wr.opcode = IB_WR_SEND_WITH_INV;
>   		rsp->send_wr.ex.invalidate_rkey = rsp->invalidate_rkey;
>   	} else {
> @@ -905,10 +904,8 @@ static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp,
>   		goto error_out;
>   	rsp->n_rdma += ret;
>   
> -	if (invalidate) {
> +	if (invalidate)
>   		rsp->invalidate_rkey = key;
> -		rsp->flags |= NVMET_RDMA_REQ_INVALIDATE_RKEY;
> -	}
>   
>   	return 0;
>   

Who clears invalidate_rkey between executions?
I think you need to clear right after nvmet_rdma_get_rsp()


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag
  2024-03-20 10:45 ` Sagi Grimberg
@ 2024-03-20 10:56   ` Guixin Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Guixin Liu @ 2024-03-20 10:56 UTC (permalink / raw)
  To: Sagi Grimberg, hch, kch; +Cc: linux-nvme


>
> Who clears invalidate_rkey between executions?
> I think you need to clear right after nvmet_rdma_get_rsp()

You are right, I need clear invalidate_rkey to 0 after nvmet_rdma_get_rsp().

Thanks,

Guixin Liu



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-20 10:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-20  9:20 [PATCH] nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag Guixin Liu
2024-03-20 10:45 ` Sagi Grimberg
2024-03-20 10:56   ` Guixin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox