Commit e7f3142c authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

nvmf/vfio-user: eliminate unmap_q function



unmap_q is only be called in unmap_qp, so remove this function to make the
code more clear to read.

Change-Id: I627c7a1efdcb85476cb618fced8b0bfc2d8f1f62
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6886


Community-CI: Broadcom CI
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 43b63c68
Loading
Loading
Loading
Loading
+8 −15
Original line number Diff line number Diff line
@@ -670,18 +670,6 @@ lookup_io_q(struct nvmf_vfio_user_ctrlr *ctrlr, const uint16_t qid, const bool i
	return q;
}

static void
unmap_q(vfu_ctx_t *vfu_ctx, struct nvme_q *q)
{
	if (q == NULL) {
		return;
	}
	if (q->addr != NULL) {
		vfu_unmap_sg(vfu_ctx, &q->sg, &q->iov, 1);
		q->addr = NULL;
	}
}

static void
unmap_qp(struct nvmf_vfio_user_qpair *qp)
{
@@ -695,9 +683,15 @@ unmap_qp(struct nvmf_vfio_user_qpair *qp)
	SPDK_DEBUGLOG(nvmf_vfio, "%s: destroy I/O QP%d\n",
		      ctrlr_id(ctrlr), qp->qpair.qid);

	unmap_q(ctrlr->endpoint->vfu_ctx, &qp->sq);
	unmap_q(ctrlr->endpoint->vfu_ctx, &qp->cq);
	if (qp->sq.addr != NULL) {
		vfu_unmap_sg(ctrlr->endpoint->vfu_ctx, &qp->sq.sg, &qp->sq.iov, 1);
		qp->sq.addr = NULL;
	}

	if (qp->cq.addr != NULL) {
		vfu_unmap_sg(ctrlr->endpoint->vfu_ctx, &qp->cq.sg, &qp->cq.iov, 1);
		qp->cq.addr = NULL;
	}
}

/*
@@ -1154,7 +1148,6 @@ memory_region_remove_cb(vfu_ctx_t *vfu_ctx, uint64_t iova, uint64_t len)
	return 0;
}


static int
nvmf_vfio_user_prop_req_rsp(struct nvmf_vfio_user_req *req, void *cb_arg)
{