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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6886
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Changpeng Liu 2021-03-15 22:45:07 +08:00 committed by Jim Harris
parent 43b63c68b9
commit e7f3142ca2

View File

@ -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)
{