nvme: remove dead code for zero-length SGL request
_nvme_qpair_build_hw_sgl_request() will only be called for payload_size != 0, so every SGL will have at least one segment. Drop the 'else' that was handling nseg == 0, and add an assert to document the payload_size requirement. Change-Id: I48e2a862a7657ba85605c0d35c0b65dfac072167 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
69f9796482
commit
bf6477ccab
@ -665,6 +665,7 @@ _nvme_qpair_build_hw_sgl_request(struct spdk_nvme_qpair *qpair, struct nvme_requ
|
|||||||
/*
|
/*
|
||||||
* Build scattered payloads.
|
* Build scattered payloads.
|
||||||
*/
|
*/
|
||||||
|
nvme_assert(req->payload_size != 0, ("cannot build SGL for zero-length transfer\n"));
|
||||||
nvme_assert(req->payload.type == NVME_PAYLOAD_TYPE_SGL, ("sgl payload type required\n"));
|
nvme_assert(req->payload.type == NVME_PAYLOAD_TYPE_SGL, ("sgl payload type required\n"));
|
||||||
nvme_assert(req->payload.u.sgl.reset_sgl_fn != NULL, ("sgl reset callback required\n"));
|
nvme_assert(req->payload.u.sgl.reset_sgl_fn != NULL, ("sgl reset callback required\n"));
|
||||||
nvme_assert(req->payload.u.sgl.next_sge_fn != NULL, ("sgl callback required\n"));
|
nvme_assert(req->payload.u.sgl.next_sge_fn != NULL, ("sgl callback required\n"));
|
||||||
@ -704,14 +705,11 @@ _nvme_qpair_build_hw_sgl_request(struct spdk_nvme_qpair *qpair, struct nvme_requ
|
|||||||
req->cmd.dptr.sgl1.type = SPDK_NVME_SGL_TYPE_DATA_BLOCK;
|
req->cmd.dptr.sgl1.type = SPDK_NVME_SGL_TYPE_DATA_BLOCK;
|
||||||
req->cmd.dptr.sgl1.address = phys_addr;
|
req->cmd.dptr.sgl1.address = phys_addr;
|
||||||
req->cmd.dptr.sgl1.length = data_transfered;
|
req->cmd.dptr.sgl1.length = data_transfered;
|
||||||
} else if (nseg > 1) {
|
} else {
|
||||||
/* For now we can only support 1 SGL segment in NVMe controller */
|
/* For now we can only support 1 SGL segment in NVMe controller */
|
||||||
req->cmd.dptr.sgl1.type = SPDK_NVME_SGL_TYPE_LAST_SEGMENT;
|
req->cmd.dptr.sgl1.type = SPDK_NVME_SGL_TYPE_LAST_SEGMENT;
|
||||||
req->cmd.dptr.sgl1.address = tr->prp_sgl_bus_addr;
|
req->cmd.dptr.sgl1.address = tr->prp_sgl_bus_addr;
|
||||||
req->cmd.dptr.sgl1.length = nseg * sizeof(struct spdk_nvme_sgl_descriptor);
|
req->cmd.dptr.sgl1.length = nseg * sizeof(struct spdk_nvme_sgl_descriptor);
|
||||||
} else {
|
|
||||||
_nvme_fail_request_bad_vtophys(qpair, tr);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user