nvmf/vfio-user: move io_q_exists()
As a general utility function, move it up with the others. Signed-off-by: John Levon <john.levon@nutanix.com> Change-Id: I32881c01afd9819c889730d7c09163c95fbb827e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11790 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
172ea8381a
commit
f49b1724ba
@ -497,6 +497,32 @@ cq_is_full(struct nvmf_vfio_user_cq *cq)
|
||||
return qindex == *cq_dbl_headp(cq);
|
||||
}
|
||||
|
||||
static bool
|
||||
io_q_exists(struct nvmf_vfio_user_ctrlr *vu_ctrlr, const uint16_t qid, const bool is_cq)
|
||||
{
|
||||
assert(vu_ctrlr != NULL);
|
||||
|
||||
if (qid == 0 || qid >= NVMF_VFIO_USER_MAX_QPAIRS_PER_CTRLR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_cq) {
|
||||
if (vu_ctrlr->cqs[qid] == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (vu_ctrlr->cqs[qid]->cq_state != VFIO_USER_CQ_DELETED &&
|
||||
vu_ctrlr->cqs[qid]->cq_state != VFIO_USER_CQ_UNUSED);
|
||||
}
|
||||
|
||||
if (vu_ctrlr->sqs[qid] == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (vu_ctrlr->sqs[qid]->sq_state != VFIO_USER_SQ_DELETED &&
|
||||
vu_ctrlr->sqs[qid]->sq_state != VFIO_USER_SQ_UNUSED);
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
vfio_user_migr_data_len(void)
|
||||
{
|
||||
@ -1215,32 +1241,6 @@ post_completion(struct nvmf_vfio_user_ctrlr *ctrlr, struct nvmf_vfio_user_cq *cq
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
io_q_exists(struct nvmf_vfio_user_ctrlr *vu_ctrlr, const uint16_t qid, const bool is_cq)
|
||||
{
|
||||
assert(vu_ctrlr != NULL);
|
||||
|
||||
if (qid == 0 || qid >= NVMF_VFIO_USER_MAX_QPAIRS_PER_CTRLR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_cq) {
|
||||
if (vu_ctrlr->cqs[qid] == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (vu_ctrlr->cqs[qid]->cq_state != VFIO_USER_CQ_DELETED &&
|
||||
vu_ctrlr->cqs[qid]->cq_state != VFIO_USER_CQ_UNUSED);
|
||||
}
|
||||
|
||||
if (vu_ctrlr->sqs[qid] == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (vu_ctrlr->sqs[qid]->sq_state != VFIO_USER_SQ_DELETED &&
|
||||
vu_ctrlr->sqs[qid]->sq_state != VFIO_USER_SQ_UNUSED);
|
||||
}
|
||||
|
||||
static void
|
||||
free_sq_reqs(struct nvmf_vfio_user_sq *sq)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user