Skip to contentSkip to conversation

nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag

PATCH Superseded Guixin Liu 2 participants 3 messages Mar 20, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Guixin Liu

author
#0 lore raw

PATCH 1/1 nvmet-rdma: remove NVMET_RDMA_REQ_INVALIDATE_RKEY flag

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

---
 drivers/nvme/target/rdma.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/nvme/target/rdma.c +2 -5
index f2bb9d95ecf4..d0bc72c75471 100644
@@ -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;
 
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 30 lines · Guixin Liu

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

---
  drivers/nvme/target/rdma.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
drivers/nvme/target/rdma.c +1 -2
index f2bb9d95ecf4..d0bc72c75471 100644
@@ -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;

drivers/nvme/target/rdma.c static u16 nvmet_rdma_map_sgl_keyed(struct nvmet_rdma_rsp *rsp, · line 911

Quoted 10 lines
drivers/nvme/target/rdma.c +1 -3
  	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()

author
#2 lore raw
Quoted 4 lines

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