nvme: add SGL dword alignment requirement flag when SGL is supported

Dword alignment and granularity are required for the data blocks when
the controller reports this capability.

Change-Id: I6b6300515a528acb34a032050ceedf673a4b326c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1315
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2020-03-16 22:26:50 -04:00 committed by Tomasz Zawadzki
parent 3de6a9c57a
commit 121aca0bc6
2 changed files with 6 additions and 1 deletions

View File

@ -397,10 +397,11 @@ struct spdk_nvme_host_id {
* Used for identifying if the controller supports these flags.
*/
enum spdk_nvme_ctrlr_flags {
SPDK_NVME_CTRLR_SGL_SUPPORTED = 0x1, /**< The SGL is supported */
SPDK_NVME_CTRLR_SGL_SUPPORTED = 0x1, /**< SGL is supported */
SPDK_NVME_CTRLR_SECURITY_SEND_RECV_SUPPORTED = 0x2, /**< security send/receive is supported */
SPDK_NVME_CTRLR_WRR_SUPPORTED = 0x4, /**< Weighted Round Robin is supported */
SPDK_NVME_CTRLR_COMPARE_AND_WRITE_SUPPORTED = 0x8, /**< Compare and write fused operations supported */
SPDK_NVME_CTRLR_SGL_REQUIRES_DWORD_ALIGNMENT = 0x10, /**< Dword alignment is required for SGL */
};
/**

View File

@ -1236,7 +1236,11 @@ nvme_ctrlr_identify_done(void *arg, const struct spdk_nvme_cpl *cpl)
}
if (ctrlr->cdata.sgls.supported) {
assert(ctrlr->cdata.sgls.supported != 0x3);
ctrlr->flags |= SPDK_NVME_CTRLR_SGL_SUPPORTED;
if (ctrlr->cdata.sgls.supported == 0x2) {
ctrlr->flags |= SPDK_NVME_CTRLR_SGL_REQUIRES_DWORD_ALIGNMENT;
}
/*
* Use MSDBD to ensure our max_sges doesn't exceed what the
* controller supports.