From 9d7e239f157a730de871d51a13b4212edac334f6 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Fri, 3 Dec 2021 18:56:00 +0800 Subject: [PATCH] nvmf/vfio-user: cleanup ADMIN CQ/SQ data structure Set the SQ/CQ size to 0 so that we will not try to remmap the ADMIN queue pair in the memory region callback before the ADMIN queue pair was enabled. Change-Id: I739a2ec3abcb54b17f31f2bc120312cd02ffeef1 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10531 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/nvmf/vfio_user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nvmf/vfio_user.c b/lib/nvmf/vfio_user.c index 621659d4e..b96a3312d 100644 --- a/lib/nvmf/vfio_user.c +++ b/lib/nvmf/vfio_user.c @@ -1493,6 +1493,10 @@ disable_admin_queue(struct nvmf_vfio_user_ctrlr *ctrlr) assert(ctrlr->qp[0] != NULL); unmap_qp(ctrlr->qp[0]); + ctrlr->qp[0]->sq.size = 0; + ctrlr->qp[0]->sq.head = 0; + ctrlr->qp[0]->cq.size = 0; + ctrlr->qp[0]->cq.tail = 0; } static void