Like memcpy, but works on two iovecs.
Change-Id: Ia1cf462a95690286f0c19325fc10937b9ba6baf3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473976
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
When dealing with sockets most code in SPDK buffers
data into large chunks to minimize the number of
syscalls made. The pipe utility is designed to make
that easy.
Change-Id: Ie29966712bbfb43fb49457e042903cf45864e6c6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465707
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
For in each loop, encoding with Arm NEON deals with 48 bytes and decoding
deals with 64 bytes:
encode: add test with src_len=48 and more than 48;
decode: add test with src_len=64 and more than 64.
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Ie156d147165a2511eed03d212eb78300e0edc84c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.
This patch adds an API, spdk_dif_remap_ref_tag to satisfy the case.
UT code is added together in this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I55cc45c475d4e86e736f5712baf02fcabfde3c82
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461104
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
When using stacked virtual bdev (e.g. split virtual bdev), block
address space will be remapped during I/O processing and so reference
tag will have to be remapped accordingly.
The use case is explained in detail as follows:
- Format a single NVMe SSD with DIF enabled.
- Create a NVMe bdev on the NVMe SSD with DIF enabled.
- Create four split vbdevs on the NVMe bdev.
- Add the split vbdevs to a NVMe-oF target.
- Application is aware of block address space of the split vbdevs.
- Application submits read/write I/O to the NVMe-oF target.
Case 1:
- Configure NVMe-oF target to DIF pass-through.
Case 2:
- Configure NVMe-oF target to DIF insert/strip
For the case 1,
- Application inserts DIF for write I/O and verifies DIF for read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
I/O because application expects reference tags are based on the
block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
because reference tags are already based on the block address space
of the NVMe bdev.
For the case 2,
- NVMe-oF target inserts DIF for write I/O, and verifies and strips
DIF or read I/O.
- The split vbdevs remaps reference tags of DIF both for read and write
I/O because NVMe-oF target expects reference tags are based on the
block address space of split vbdevs.
- The NVMe bdev processs read/write I/Os without remapping reference tags
because reference tags are already based on the block address space
of the NVMe bdev.
This patch adds two APIs, spdk_dif_ctx_set_remapped_init_ref_tag
and spdk_dif_remap_ref_tag to satisfy the use case.
UT code is added together in this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib3101129225b334d2f578eab75197790b1818770
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/461103
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Compilation Warning on fedora30.
dif_ut.c:151:24: warning: The left operand of '==' is a garbage value
return (iov->iov_base == iov_base && iov->iov_len == iov_len);
~~~~~~~~~~~~~ ^
This is related to issue #822.
Change-Id: Ie050c65d3747c551e2c26e84d3879742eaf86fd8
Signed-off-by: Hailiang Wang <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459712
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This will be used to get extended LBA based range or length in NVMe/TCP
target later.
Change-Id: Id0f08bdaeea634dbc05b34a0f7914be21aef9aae
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458706
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Add spdk_dif_update_crc32c_stream to update CRC32C by stream fashion.
spdk_dif_update_crc32c_stream utilizes the updated _dif_update_crc32c_split.
A minor bug was found in UT for spdk_dif_update_crc32c and is fixed
together in this patch.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I92358e845e8e2e17c6f288aa718b947e71e6e1fb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458919
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_update_crc32c_split will have to
process partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block
On the other hand, _dif_update_crc32c_split had assumed that passed
block is always a complete block.
This patch exposes offset_in_block, data_len, and guard as parameters
of _dif_update_crc32c_split() and make _dif_verify_split() process
the above two types of data block properly.
The next patch will utilize the updated _dif_update_crc32c_split to
add spdk_dif_update_crc32c_stream().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iee29377ad49d4f209673fffb4de4a23a54f31766
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458918
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Add spdk_dif_verify_stream to verify DIF by stream fashion.
spdk_dif_verify_stream utilizes the updated _dif_verify_split.
spdk_dif_verify_stream is very similar with spdk_dif_generate_stream().
UT code demonstrates how it is realized.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1c5d197cf4c0bbc82c8e7f4fa45ddc0b94051058
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458330
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_verify_split will have to process
partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block
On the other hand, _dif_verify_split had assumed that passed block
is always a complete block.
According to the refactoring done in the last patch, this patch
exposes offset_in_block, data_len, and guard as parameters of
_dif_verify_split() and make _dif_verify_split() process the
above two types of data block properly.
The next patch will utilize the updated _dif_verify_split to
add spdk_dif_verify_stream().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic371d3ccefbd5fe8147a948a624013be2702128e
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458329
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This patch makes spdk_dif_set_md_interleave_iovs() and
spdk_dif_generate_stream() process unaligned start of data segment
properly by using ctx->data_offset.
Separating this patch into two may be required but this patch is
small and aggregating into a patch is good to test.
UT code demonstrates how it is realized.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idb5250aba4e12a34102e5ce067d725c685681177
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment, and _dif_generate_split will have to process
partial data block, particularly the following types:
- start and end are both within a data block.
- start is within a data block, and end is at the end of a block
According to the refactoring done in the last patch, this patch
exposes offset_in_block, data_len, and guard as parameters of
_dif_generate_split() and make _dif_generate_split() process
the above two types of data block properly.
The next patch will utilize the updated _dif_generate_split in
spdk_dif_generate_stream().
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4211e65ead7fc256a40748412c670e46f83b1731
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457544
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
For NVMe/TCP target, data segments which correspond to H2C or C2H PDU
will have any alignment. spdk_dif_set_md_interleave_iovs() have allowed
reading data to have any alignment but had required data segment to
be a multiple of block size.
In other words, spdk_dif_set_md_interleave_iovs() had required that both
ctx->data_offset and (data_offset + data_len) must be a multiple of the
data block size.
This patch refines the algorithm to remove the latter requirement.
The update implies that spdk_dif_set_md_interleave_iovs support any
data buffer whose size is less than a single data block.
The update doesn't change parameters of spdk_dif_set_md_interleave_iovs
and existing UT should be passed.
This patch adds additional UT code to test these updates.
Change-Id: I88c7d2a80a8d92b54863b6ad1c3a9d2761a6195d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457542
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This patch changes the meaning of the data_len parameter of
spdk_dif_set_md_interleave_iovs from `Expected data length of the payload`
to `Expected length of the newly read data in the extended LBA payload`.
This change will align the parameters of spdk_dif_set_md_intereleave_iovs
to of spdk_dif_generate_stream.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7f9c45e78be977625713acb79d2ae82d4375f419
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457543
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Data offset are intended to correspond to DATAO in NVMe/TCP and
Buffer Offset in iSCSI.
Previously for iSCSI, buffer offset had been merged to start block
address, but passing buffer offset separately from start block address
clarifies the logic more.
On the other hand, for NVMe/TCP, passing DATAO separately from start
block address will be critically important because DATAO will bave any
alignment and will be necessary to use for not only reference tag
but also guard computation.
This patch adds data_offset to struct spdk_dif_ctx and adds it to the
parameters of spdk_dif_ctx_init(). ref_tag_offset is also added to struct
spdk_dif_ctx and it is computed by dividing data_offset by data_block_size
and is used to compute reference tag.
The next patch will use this change when getting DIF context in SCSI.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id0e12ca9b1dc75d0589787520feb0c2ee0f844a5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457540
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
DIF UT code had used numerics extensibly for complex DIF insert/strip
UTs. But numerics was error prone and difficult to follow the logic.
Hence this patch changes numerics to variables in DIF insert/strip UTs.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I40cb27167c068855dc5d1eb9e0f36818d39c73fa
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457539
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
data_offset to spdk_dif_generate_stream() was wrong but the function
worked as expected because the wrong data_offset was in the same
data block as the correct data_offset.
But the subsequent patches will refine spdk_dif_generate_stream()
and this bug will cause UT failure. Hence fix the bug up front.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I45f2302deaf377fda0ec5454c61fb463231a39db
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Data block size was specified by mistake, and this patch changes
to use block size instead.
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Icfb1df40438ef82211279b0b7c79036283744361
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456292
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Data digest computation should take extended LBA payload but
could not do yet.
This patch adds an new API spdk_dif_update_crc32c() to compute
CRC-32C value for extended LBA payload.
In the next patch, spdk_dif_update_crc32c will be used in iSCSI
target first.
Change-Id: I327f384bb7dfd8b68279b0acec0ee78a40264a26
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456171
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This patch allows multiple iovecs as argument in spdk_dif_generate_stream.
Subsequent patches will support DIF strip and insert in SPDK NVMe-TCP
target based on the patch series.
Change-Id: I1f3d6c5b9f924bb52525e1611db403846d087563
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
As a subsequent effort, this patch changes the interface of
spdk_dif_generate_stream to accept SGL data buffer.
This patch allows only a single iove. The next patch will allow
multiple iovecs.
Change-Id: I56f901d73ca3b9da4b56c213ebafcd7706b1fef8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453755
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This patch allows multiple iovecs as argument of
spdk_dif_set_md_interleave_iovs.
Subsequent patches will support SGL data buffer in
spdk_dif_generate_stream too. UT code tests only
spdk_dif_set_md_interleave until then.
Change-Id: I7ac03a3c8f7bcd922af4f29b404ebf3acc4b89e5
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453736
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Currently iSCSI target have used a single contiguous data buffer
both for read and write I/O. Hence spdk_dif_set_md_interleave_iovs
accepts a single contiguous data buffer and its size as arguments.
On the other hand, NVMe-TCP target recently has changed to use
SGL data buffer instead.
DIF strip and insert will be supported in NVMe-TCP target next,
and updating spdk_dif_set_md_interleave_iovs to accept SGL data
buffer will be helpful.
This patch changes the interface of spdk_dif_set_md_interleave_iovs,
but allows only a single iovec. The next patch will allow multiple
iovecs.
Change-Id: I31b09814f8ec920e463a5b1be8fb88cad7d277fb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453735
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This change unifies the DIF library to use dif_sgl throughout.
Change-Id: I60addcf05e75b823e4dfb216122bf46edbc42e78
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454528
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The struct _iov_iter has been used to iterate the passed iovec array.
Subsequent patches will share the struct among iteration and
creation. To clarify this update, rename the struct _iov_iter to
_dif_sgl. The name sgl has been already adopted widely in SPDK.
Change-Id: Iab81bcb0658fbd0e39305e045c3d0aadba8fc55f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454525
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Add an new API spdk_dif_generate_stream() to insert DIF into
the metadata space of newly read data block by stream fashion.
This API is tested by replacing the previous DIF generation such
that DIF is generated once all data was read.
Change-Id: I757b4e6f10fe2d9d643f56ebb678c731cdad63bb
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446594
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
This patch adds an API spdk_dif_set_md_interleave_iovs().
This function is used to leave a space for metadata for each block
when the network socket reads data, or to make the network socket
ignore a space for metadata for each block when the network socket
writes data. This function removes the necessity of data copy in
the SPDK application during DIF insertion and strip.
Change-Id: I018efd77bdadcaec4679eea4dc1e404f155b0879
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446216
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Previously, test data buffer was filled by one value, 0xAB, but
this may not be enough to detect future potential issues.
ut_data_pattern_verify() already did per-byte check, but size of
test data buffer is small and completion time of tests is not long.
So, even if we change ut_data_pattern_generate() to set per-byte
data instead of memset(), extra overhead of test completion time
will be negligible.
Change-Id: I35677b238f96a73c0c408f0818f080a92492dac6
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/445430
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Allow user to add seed value for guard compuation to DIF context.
This will avoid the guard being zero in case of all zero data.
NVMe controller doesn't support seed value for guard computation
explicitly, and hence if we want to use such a seed value in
NVMe controller, we have to format metadata more than 8 byte,
and add seed value into the reserved metadata field.
But some popular iSCSI/FC HBAs and SAS controllers have supported
seed value for guard computation, and so supporting seed value
in the SPDK DIF library is very helpful for some use cases.
Hence this patch makes the DIF library possible to specify seed
value for those use cases.
Change-Id: I7e9e87cb441bf263e64605c7820409fdc22dd977
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/444334
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
mk/spdk.unittest.mk already includes mk/spdk.common.mk, so it's
not needed. This also fixes an issue where touching an included
.mk file would not trigger unit tests to rebuild if they had
this duplicated mk/spdk.common.mk include.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I41a04eb77ce468849cb9b53bd1f76df6fec06e46
Reviewed-on: https://review.gerrithub.io/c/443980
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Next patch will introduce enum spdk_dif_check_type for user to
know easily if checking DIF field is enabled or not.
This patch renames bitmask macros from SPDK_DIF_*_CHECK to
SPDK_DIF_FLAGS_*_CHECK to avoid mis-interpretation .
Using FLAGS was derived from SPDK_NVME_IO_FLAGS_PRCHK_* in
include/spdk/nvme_spec.h.
Change-Id: I89e155d047352f54091c14b9251464cd3a72a162
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/443338
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Error check of strtol is left to users of it. But some use cases
of strtol in SPDK do not have enough error check yet.
For example, strtol returns 0 if there were no digits at all.
It should be avoided for each use case to add enough error checking
for strtol.
Hence spdk_strtol and spdk_strtoll do additional error checking
according to the description of manual of strtol.
Besides, there is no use case of negative number now, and to keep
simplicity, spdk_trtol and spdk_strtoll allows only strings that
is positive number or zero.
As a result of this policy, callers of them only have to check if
the return value is not negative.
Subsequent patches will replace atoi to spdk_strtol because atoi
does not have error check.
Change-Id: If3d549970595e53b1141674e47710fe4dd062bc5
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/441626
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
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>
Appending string by using sprintf with realloc will be generally
usable and add sprintf_append_realloc() and vsprintf_append_realloc()
to the utility.
These APIs follow realloc about buffer management, i.e., the original
buffer is left untouched if they fail.
Besides, the original buffer is NULL, they are equivalent to
sprintf_alloc() and vsprintf_alloc(), respectively.
Change-Id: I8b69d9640e86e1862ddd3917995bad6f59426b7e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/436913
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Because we have called _are_iovs_valid() to ensure that all blocks are
covered by iovec, and we process iovec compactly and orderly, so we
don't need to do _iov_iter_cont() check.
Since all callee are removed, so reomve definition of _iov_iter_cont()
as well.
While here, add an assertion in _iov_iter_advance() to detect
unexpected error.
Change-Id: I6b6077bafbf7ec18f14ee2835d3b99199b5e559b
Signed-off-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-on: https://review.gerrithub.io/c/439869
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
When all CPUs are set, formatted string overflows str buffer in the
spdk_cpuset structure with '\0'.
It may destroy CPUs bitmap when formatting is used, so additional
integrity checks are performed in UT.
Change-Id: I92ac790b2c215428cbe0ae89ab4b28570ddb9a0d
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440021
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
One of bugs wasn't catched because unit tests for util/cpuset wasn't
enabled.
This patch fixes bug and enables unit test.
Change-Id: I5a2d7ad76256439e3a13efc8ca51dd4b21a20e0a
Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440020
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
For separate metadata payload, Introduce a struct to collect DIF error
information and pass the reference to the struct to bit-flip error injection
and verification.
This change will make logging of DIF error and comparison between
injection and verification possible for separate metadata payload.
Merging this patch to the previous is possible but add this as a separate patch
to reduce the patch size.
Change-Id: Ifce2130e902bc090cbe205fa8df12559739ced57
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/435097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This patch adds APIs to generate and verify DIF for SGL
payload with separate metadata as byte alignment and granularity.
Change-Id: I4e553c9b6f8c96e576a69115002963d32379d439
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/434150
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
For copied extended LBA payload, Introduce a struct to collect DIF error
information and pass the reference to the struct to bit-flip error injection
and verification.
This change will make logging of DIF error and comparison between
injection and verification possible for copied extended LBA payload.
Merging this patch to the previous is possible but add this as a separate patch
to reduce the patch size.
Change-Id: I9f7ac1332fe63cb206c692d0876c8de41ef9286f
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/435227
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This patch adds APIs to copy data and generate and verify DIF
for internally created extended LBA payload.
This patch is for read strip and write insert operation to make
DIF transparent to the upper layer.
Change-Id: I025f35571490aa197aac5e7572549e31c2479b41
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/432987
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.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>
Introduce a struct to collect DIF error information and pass
the reference to the struct to bit-flip error injection and
verification.
This change will make logging of DIF error and comparison between
injection and verification possible.
Change-Id: I43941f1a7f4b0ad1e8ff324f2ac8fad9e195a100
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/438023
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This patch reduces the number of parameters of APIs by setting
necessary information to context struct and pass it to APIs.
This will simplify the code and will clarify the core logic.
Besides, by introducing context data, update of reference tag
is further consolidated.
Change-Id: I1b3eec596847eb4ef1cf43441035df21f746192a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/438021
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
The case that metadata is supported but DIF is not enabled was
handled as error. But the case is described as an normal case
in NVMe specification.
This patch changes the case to normal.
Besides a break was missing and added in this patch.
Change-Id: I784c36fed3b92da9ae5500d945f1dc20a2ca406b
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/438362
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
For DIF and DIX, read strip and write insert operation will copy
data together with DIF generation and verification.
This patch adds spdk_crc16_t10dif_copy for those cases.
Change-Id: I9a77fa8b367486fe0b6704d58dcdf95d5210c875
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/437461
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This patch adds APIs to inject bit flip error into any field
of the extended LBA payload.
Change-Id: I3ca601999e55ea6228bb525ac8c0744c7df32398
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/434292
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>