From 71159819b076ec58f4b5b47d99292ff14abd40d3 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Wed, 18 Dec 2019 16:02:49 +0300 Subject: [PATCH] nvme/pcie: Don't use contig SGL commands for admin qpair Command with cns SPDK_NVME_IDENTIFY_ACTIVE_NS_LIST is issued during controller initialization and if the controller supports SGL, this command will be built as a contig SGL. This leads to a failed completion with the following status: INVALID FIELD (00/02) sqid:0 cid:95 cdw0:0 sqhd:0004 p:1 m:0 dnr:0 The first identify command SPDK_NVME_IDENTIFY_CTRLR passed since it was built as a PRP command - we didn't know that the controller supported SGL at that time. Fix - do not build SGL requests for admin qpair Change-Id: I72ab7fe33c03e60ea9f20a9c8afd7c79c40843aa Signed-off-by: Alexey Marchuk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478320 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/nvme/nvme_pcie.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 9ce9ea237..4b6678a3d 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -2065,7 +2065,10 @@ nvme_pcie_qpair_submit_request(struct spdk_nvme_qpair *qpair, struct nvme_reques /* Null payload - leave PRP fields untouched */ rc = 0; } else if (nvme_payload_type(&req->payload) == NVME_PAYLOAD_TYPE_CONTIG) { - if (ctrlr->flags & SPDK_NVME_CTRLR_SGL_SUPPORTED) { + /* Some NVME drives can't handle SGL request submitted to the admin qpair + * even if they report SGL support */ + if ((ctrlr->flags & SPDK_NVME_CTRLR_SGL_SUPPORTED) != 0 && + !nvme_qpair_is_admin_queue(qpair)) { rc = nvme_pcie_qpair_build_contig_hw_sgl_request(qpair, req, tr); } else { rc = nvme_pcie_qpair_build_contig_request(qpair, req, tr);