dif: Fix opposite definition of DIF location parameter from SPDK NVMe API
SPDK NVMe driver and NVMe CLI define the parameter about DIF location as follows: If set to 1 and DIF is enabled, then DIF is transferred as the first 8 bytes of metadata. If set to 0 and DIF is enabled, then DIF is transferred as the last 8 bytes of metadata. Defaults to 0. This patch fixes the apparent inconsistency. Change-Id: I481332bb9a6caa488664dbd1fe6039270b9f9663 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/c/440672 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
9cba82b955
commit
3f836b036f
@ -110,8 +110,8 @@ struct spdk_dif_error {
|
|||||||
* \param md_size Metadata size in a block.
|
* \param md_size Metadata size in a block.
|
||||||
* \param md_interleave If true, metadata is interleaved with block data.
|
* \param md_interleave If true, metadata is interleaved with block data.
|
||||||
* If false, metadata is separated with block data.
|
* If false, metadata is separated with block data.
|
||||||
* \param dif_loc DIF location. If true, DIF is set in the last 8 bytes of metadata.
|
* \param dif_loc DIF location. If true, DIF is set in the first 8 bytes of metadata.
|
||||||
* If false, DIF is in the first 8 bytes of metadata.
|
* If false, DIF is in the last 8 bytes of metadata.
|
||||||
* \param dif_type Type of DIF.
|
* \param dif_type Type of DIF.
|
||||||
* \param dif_flags Flag to specify the DIF action.
|
* \param dif_flags Flag to specify the DIF action.
|
||||||
* \param init_ref_tag Initial reference tag. For type 1, this is the
|
* \param init_ref_tag Initial reference tag. For type 1, this is the
|
||||||
|
@ -158,7 +158,7 @@ _dif_is_disabled(enum spdk_dif_type dif_type)
|
|||||||
static uint32_t
|
static uint32_t
|
||||||
_get_guard_interval(uint32_t block_size, uint32_t md_size, bool dif_loc, bool md_interleave)
|
_get_guard_interval(uint32_t block_size, uint32_t md_size, bool dif_loc, bool md_interleave)
|
||||||
{
|
{
|
||||||
if (dif_loc) {
|
if (!dif_loc) {
|
||||||
/* For metadata formats with more than 8 bytes, if the DIF is
|
/* For metadata formats with more than 8 bytes, if the DIF is
|
||||||
* contained in the last 8 bytes of metadata, then the CRC
|
* contained in the last 8 bytes of metadata, then the CRC
|
||||||
* covers all metadata up to but excluding these last 8 bytes.
|
* covers all metadata up to but excluding these last 8 bytes.
|
||||||
|
@ -183,7 +183,7 @@ dif_generate_and_verify_test(void)
|
|||||||
|
|
||||||
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
||||||
_dif_generate_and_verify(&iov,
|
_dif_generate_and_verify(&iov,
|
||||||
4096 + 128, 128, false,
|
4096 + 128, 128, true,
|
||||||
SPDK_DIF_TYPE1, dif_flags,
|
SPDK_DIF_TYPE1, dif_flags,
|
||||||
22, 22,
|
22, 22,
|
||||||
0x22, 0xFFFF, 0x22,
|
0x22, 0xFFFF, 0x22,
|
||||||
@ -191,7 +191,7 @@ dif_generate_and_verify_test(void)
|
|||||||
|
|
||||||
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
||||||
_dif_generate_and_verify(&iov,
|
_dif_generate_and_verify(&iov,
|
||||||
4096 + 128, 128, true,
|
4096 + 128, 128, false,
|
||||||
SPDK_DIF_TYPE1, dif_flags,
|
SPDK_DIF_TYPE1, dif_flags,
|
||||||
22, 22,
|
22, 22,
|
||||||
0x22, 0xFFFF, 0x22,
|
0x22, 0xFFFF, 0x22,
|
||||||
@ -613,11 +613,11 @@ dif_inject_error_and_verify(struct iovec *iovs, int iovcnt,
|
|||||||
{
|
{
|
||||||
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
||||||
_dif_inject_error_and_verify(iovs, iovcnt, block_size, md_size, num_blocks,
|
_dif_inject_error_and_verify(iovs, iovcnt, block_size, md_size, num_blocks,
|
||||||
inject_flags, false);
|
inject_flags, true);
|
||||||
|
|
||||||
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
||||||
_dif_inject_error_and_verify(iovs, iovcnt, block_size, md_size, num_blocks,
|
_dif_inject_error_and_verify(iovs, iovcnt, block_size, md_size, num_blocks,
|
||||||
inject_flags, true);
|
inject_flags, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -935,12 +935,12 @@ dif_copy_inject_error_and_verify(struct iovec *iovs, int iovcnt, struct iovec *b
|
|||||||
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
||||||
_dif_copy_inject_error_and_verify(iovs, iovcnt, bounce_iov,
|
_dif_copy_inject_error_and_verify(iovs, iovcnt, bounce_iov,
|
||||||
block_size, md_size, num_blocks,
|
block_size, md_size, num_blocks,
|
||||||
inject_flags, false);
|
inject_flags, true);
|
||||||
|
|
||||||
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
||||||
_dif_copy_inject_error_and_verify(iovs, iovcnt, bounce_iov,
|
_dif_copy_inject_error_and_verify(iovs, iovcnt, bounce_iov,
|
||||||
block_size, md_size, num_blocks,
|
block_size, md_size, num_blocks,
|
||||||
inject_flags, true);
|
inject_flags, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1219,11 +1219,11 @@ dix_inject_error_and_verify(struct iovec *iovs, int iovcnt, struct iovec *md_iov
|
|||||||
{
|
{
|
||||||
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
/* The case that DIF is contained in the first 8 bytes of metadata. */
|
||||||
_dix_inject_error_and_verify(iovs, iovcnt, md_iov, block_size, md_size, num_blocks,
|
_dix_inject_error_and_verify(iovs, iovcnt, md_iov, block_size, md_size, num_blocks,
|
||||||
inject_flags, false);
|
inject_flags, true);
|
||||||
|
|
||||||
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
/* The case that DIF is contained in the last 8 bytes of metadata. */
|
||||||
_dix_inject_error_and_verify(iovs, iovcnt, md_iov, block_size, md_size, num_blocks,
|
_dix_inject_error_and_verify(iovs, iovcnt, md_iov, block_size, md_size, num_blocks,
|
||||||
inject_flags, true);
|
inject_flags, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user