numam-spdk/lib
Ziye Yang 34c901e308 nvme/tcp: Fix tcp_req->datao calculation issue.
When data digest is enabled for a nvme tcp qpair, we can use accel_fw
to calculate the data crc32c. Then if there are multiple
c2h pdus are coming, we can use both CPU resource directly
and accel_fw framework to caculate the checksum. Then the datao value compare
will not match since we will not update "datao" in the pdu coming order.

For example, if we receive 4 pdus, named as A, B, C, D.
   offset   data_len (in bytes)
A:  0       8192
B:  8192    4096
C:  12288   8192
D:  20480   4096

For receving the pdu, we hope that we can continue exeution even if
we use the offloading engine in accel_fw. Then in this situation,
if Pdu(C) is offloaded by accel_fw. Then our logic will continue receving
PDU(D). And according to the logic in our code, this time we leverage CPU
to calculate crc32c (Because we only have one active pdu to receive data).
Then we find the expected data offset is still 12288. Because "datao" in tcp_req will
only be updated after calling nvme_tcp_c2h_data_payload_handle function. So
while we enter nvme_tcp_c2h_data_hdr_handle function, we will find the
expected datao value is not as expected compared with the data offset value
contained in Pdu(D).

So the solution is that we create a new variable "expected_datao"
in tcp_req to do the comparation because we want to comply with the tp8000 spec
and do the offset check.

We still need use "datao" to count whether we receive the whole data or not.
So we cannot reuse "datao" variable in an early way. Otherwise, we will
release tcp_req structure early and cause another bug.

PS: This bug was not found early because previously the sw path in accel_fw
directly calculated the crc32c and called the user callback. Now we use a list and the
poller to handle,  then it triggers this issue. Definitely, it will be much easier to
trigger this issue if we use real hardware engine.

Fixes #2098

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I10f5938a6342028d08d90820b2c14e4260134d77
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9612
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-09-27 10:53:04 +00:00
..
accel accel: Fix the data copy issue for copy+crc32c in vector mode. 2021-09-01 07:34:02 +00:00
bdev lib/bdev: added spdk_bdev_module_fini_done() 2021-08-23 08:49:56 +00:00
blob blobstore: calculate correct num_md_clusters in bs_recover 2021-08-09 08:39:42 +00:00
blobfs lib/trace: record string arguments as (const char *) 2021-06-28 16:17:35 +00:00
conf so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
dma dma: Introduce memory domain 2021-08-20 07:26:10 +00:00
env_dpdk env/dpdk: revert 8f7d9ec "env/dpdk: Use the DPDK device count for IOMMU mapping" 2021-09-24 07:40:21 +00:00
env_ocf lib/ocf_env: Force struct list 64 bytes alignment 2021-07-28 07:02:14 +00:00
event event: add disable_signal_handlers to the spdk_app_opts struct 2021-09-15 07:11:42 +00:00
ftl lib/trace: don't format arg's name while registering a tpoint 2021-06-10 10:58:05 +00:00
idxd idxd: move header file to include dir 2021-09-22 07:00:10 +00:00
init util: Add macro SPDK_SIZEOF_MEMBER to get size of a member of a struct 2021-07-15 07:16:22 +00:00
ioat ioat: fix potential double free problem in ioat_channel_start() 2021-06-16 09:00:37 +00:00
iscsi net: Remove library 2021-07-13 08:57:58 +00:00
json json: add the spdk_json_write_uint128 function 2021-07-22 13:46:50 +00:00
jsonrpc jsonrpc: use SOCK_NONBLOCK in socket() calls 2021-05-05 13:31:10 +00:00
log log: add an API to return syslog level based on SPDK's log level 2021-08-12 12:57:39 +00:00
lvol so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
nbd lib/nbd: hot remove will be correctly handled 2021-07-26 08:56:23 +00:00
notify so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
nvme nvme/tcp: Fix tcp_req->datao calculation issue. 2021-09-27 10:53:04 +00:00
nvmf nvmf/vfio-user: fix race condition when free_ctrlr() 2021-09-24 07:43:12 +00:00
rdma include: remove util.h include from queue_extras.h 2021-04-14 07:25:21 +00:00
reduce util: Add macro SPDK_SIZEOF_MEMBER to get size of a member of a struct 2021-07-15 07:16:22 +00:00
rocksdb rocksdb: fix thread name typo 2021-09-03 08:08:20 +00:00
rpc so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
scsi util: Add macro SPDK_SIZEOF_MEMBER to get size of a member of a struct 2021-07-15 07:16:22 +00:00
sock socket: Remove deprecated enable_zerocopy_send 2021-07-23 10:30:25 +00:00
thread lib/thread: improve error message for wrong thread context 2021-09-24 04:45:11 +00:00
trace trace: fix the snprintf warning issue. 2021-07-12 14:06:43 +00:00
ut_mock so_ver: increase all major versions 2021-02-05 14:43:47 +00:00
util lib/util: optimize base64 encode and decode using ARM SVE intrinsics 2021-08-06 07:31:06 +00:00
vfio_user libvfio-user: update submodule 2021-06-22 23:42:02 +00:00
vhost vhost-blk: fix interrupt names 2021-09-02 07:43:37 +00:00
virtio env: only pass failing address to spdk_pci_error_handler 2021-06-15 08:34:28 +00:00
vmd vmd: update for changes in IceLake platform 2021-08-31 08:39:37 +00:00
Makefile dma: Introduce memory domain 2021-08-20 07:26:10 +00:00