Skip to contentSkip to conversation

nvme-rdma: Introduce nvme_rdma_destroy_qp

PATCH New Max Gurtovoy 2 participants 6 messages Nov 4, 2017 – Nov 6, 2017 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

QP object is created using rdma_cm api, therefore the destruction should use the same api for symmetry.

Signed-off-by Max Gurtovoy <maxg at mellanox.com>

---

Changes from v1:
- rebase against nvme-4.15

---
 drivers/nvme/host/rdma.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/nvme/host/rdma.c +8 -2
index 03644ec..ae3e4d6 100644
@@ -266,6 +266,12 @@ static int nvme_rdma_create_qp(struct nvme_rdma_queue *queue, const int factor)
 	return ret;
 }
 
+static void nvme_rdma_destroy_qp(struct nvme_rdma_queue *queue)
+{
+	rdma_destroy_qp(queue->cm_id);
+	queue->qp = NULL;
+}
+
 static int nvme_rdma_reinit_request(void *data, struct request *rq)
 {
 	struct nvme_rdma_ctrl *ctrl = data;
@@ -439,7 +445,7 @@ static void nvme_rdma_destroy_queue_ib(struct nvme_rdma_queue *queue)
 	struct nvme_rdma_device *dev = queue->device;
 	struct ib_device *ibdev = dev->dev;
 
-	rdma_destroy_qp(queue->cm_id);
+	nvme_rdma_destroy_qp(queue);
 	ib_free_cq(queue->ib_cq);
 
 	nvme_rdma_free_ring(ibdev, queue->rsp_ring, queue->queue_size,
@@ -493,7 +499,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue)
 	return 0;
 
 out_destroy_qp:
-	ib_destroy_qp(queue->qp);
+	nvme_rdma_destroy_qp(queue);
 out_destroy_ib_cq:
 	ib_free_cq(queue->ib_cq);
 out_put_dev:
Signature · 1 line
1.7.1
maintainer
#1 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

drivers/nvme/host/rdma.c static int nvme_rdma_create_qp(struct nvme_rdma_queue *queue, const int factor) · line 272

Quoted 5 lines
drivers/nvme/host/rdma.c +4 -0
+static void nvme_rdma_destroy_qp(struct nvme_rdma_queue *queue)
+{
+	rdma_destroy_qp(queue->cm_id);
+	queue->qp = NULL;

Why is setting the qp to NULL needed here?

I'd rather not do this if we don't have a good reason reason for it.

#2 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

Quoted 9 lines · Sagi Grimberg

drivers/nvme/host/rdma.c static int nvme_rdma_create_qp(struct nvme_rdma_queue *queue, const int factor)

Quoted 5 lines
drivers/nvme/host/rdma.c +4 -0
+static void nvme_rdma_destroy_qp(struct nvme_rdma_queue *queue)
+{
+??? rdma_destroy_qp(queue->cm_id);
+??? queue->qp = NULL;

Why is setting the qp to NULL needed here?

I'd rather not do this if we don't have a good reason reason for it.

Currently it's there for symmetry.
Do you prefer to point to freed memory ? I can resend it if needed.

maintainer
#3 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

Quoted 1 line

Do you prefer to point to freed memory ? I can resend it if needed.

Setting it to NULL suggest that we somehow rely on it, I'd prefer not to do it. Personally I don't think we really need the wrapper function until we actually need to compound operations when removing an rdma qp...

#4 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

Quoted 6 lines · Sagi Grimberg
Quoted 1 line

Do you prefer to point to freed memory ? I can resend it if needed.

Setting it to NULL suggest that we somehow rely on it, I'd prefer not to do it. Personally I don't think we really need the wrapper function until we actually need to compound operations when removing an rdma qp...

Ok, I'll send a fix to the error flow (this was my main goal).

maintainer
#5 lore raw

PATCH v2 1/1 nvme-rdma: Introduce nvme_rdma_destroy_qp

Quoted 1 line

Ok, I'll send a fix to the error flow (this was my main goal).

Thanks Max