nvmf/vfio-user: process NVMe response cdw0 correctly

The NVMf library will set cdw0 based on specific command,
so we use it directly in vfio-user, otherwise, some NVMe
commands such as AER can't work.

Fix issue #2016.

Change-Id: Ie1a80a92c0856b61822ee51ce5d8faaaf1d463de
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8556
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
Changpeng Liu 2021-06-30 21:02:10 +08:00 committed by Jim Harris
parent e34ad3e2c5
commit d5102d37b3

View File

@ -579,7 +579,7 @@ handle_cmd_req(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvme_cmd *cmd,
* @ctrlr: the vfio-user controller
* @cmd: the NVMe command for which the completion is posted
* @cq: the completion queue
* @cdw0: cdw0 as reported by NVMf (only for SPDK_NVME_OPC_GET/SET_FEATURES)
* @cdw0: cdw0 as reported by NVMf
* @sc: the NVMe CQE status code
* @sct: the NVMe CQE status code type
*/
@ -617,20 +617,11 @@ post_completion(struct nvmf_vfio_user_ctrlr *ctrlr, struct spdk_nvme_cmd *cmd,
ctrlr_id(ctrlr), qid, cmd->cid, sc, ctrlr->qp[qid]->sq.head,
cq->tail);
if (qid == 0) {
switch (cmd->opc) {
case SPDK_NVME_OPC_SET_FEATURES:
case SPDK_NVME_OPC_GET_FEATURES:
cpl->cdw0 = cdw0;
break;
}
}
assert(ctrlr->qp[qid] != NULL);
cpl->sqhd = ctrlr->qp[qid]->sq.head;
cpl->cid = cmd->cid;
cpl->cdw0 = cdw0;
cpl->status.dnr = 0x0;
cpl->status.m = 0x0;
cpl->status.sct = sct;