numam-spdk/lib/nvme
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
..
Makefile nvme: asynchronous create io qpair 2021-08-13 07:27:07 +00:00
nvme_ctrlr_cmd.c nvme: rename nvme_qpair_abort_reqs to *_with_cbarg 2021-09-22 06:55:28 +00:00
nvme_ctrlr_ocssd_cmd.c nvme: Move nsdata to namespace structure 2021-03-02 08:06:15 +00:00
nvme_ctrlr.c nvme: abort queued admin requests during init 2021-09-24 07:38:57 +00:00
nvme_cuse.c nvme: No longer allocate arrays of size NN in cuse handling 2021-09-03 08:07:25 +00:00
nvme_cuse.h lib/nvme: add RPC for interacting with CUSE devices 2019-10-24 23:43:59 +00:00
nvme_fabric.c nvme/fabric: implement async register get/set functions 2021-09-16 07:16:52 +00:00
nvme_internal.h nvme: abort queued admin requests during init 2021-09-24 07:38:57 +00:00
nvme_io_msg.c nvme: only process io_msg in primary process 2021-04-22 01:06:02 +00:00
nvme_io_msg.h lib/nvme: update io msg producers on ns manage 2020-06-05 09:01:44 +00:00
nvme_ns_cmd.c nvme: Add functions spdk_nvme_ns_cmd_readv/writev_ext 2021-08-20 07:26:10 +00:00
nvme_ns_ocssd_cmd.c nvme: save separate metadata size to nvme request 2020-04-02 07:02:38 +00:00
nvme_ns.c util: Add macro SPDK_SIZEOF_MEMBER to get size of a member of a struct 2021-07-15 07:16:22 +00:00
nvme_opal_internal.h nvme/opal: deprecate spdk_opal_supported() 2020-05-20 14:16:44 +00:00
nvme_opal.c nvme/opal: check Security Protocol 00h before sending TCG SP 2021-06-04 19:57:36 +00:00
nvme_pcie_common.c nvme: add tracing to pcie request path 2021-09-08 08:03:20 +00:00
nvme_pcie_internal.h nvme: add spdk_nvme_ctrlr_prepare_for_reset() 2021-09-07 07:33:41 +00:00
nvme_pcie.c nvme: Fix remove event processing bug 2021-07-13 09:07:23 +00:00
nvme_poll_group.c nvme: Add functions to get/free poll group statistics 2021-04-13 21:30:52 +00:00
nvme_qpair.c nvme: abort queued admin requests during init 2021-09-24 07:38:57 +00:00
nvme_quirks.c nvme: add quirks for new RedHat QEMU NVMe dev/vendor ID 2021-06-11 07:22:10 +00:00
nvme_rdma.c nvme: Update spdk_nvme_ctrlr_get_memory_domain 2021-09-24 07:37:45 +00:00
nvme_tcp.c nvme/tcp: Fix tcp_req->datao calculation issue. 2021-09-27 10:53:04 +00:00
nvme_transport.c nvme: Update spdk_nvme_ctrlr_get_memory_domain 2021-09-24 07:37:45 +00:00
nvme_vfio_user.c nvme/vfio-user: use the common request submission function 2021-06-09 07:21:31 +00:00
nvme_zns.c lib/nvme: NVMe ZNS - Zone Descriptor Extension support 2021-09-16 07:21:40 +00:00
nvme.c nvme: store fabrics connect data ptr in status structure 2021-08-31 08:38:16 +00:00
spdk_nvme.map nvme: Update spdk_nvme_ctrlr_get_memory_domain 2021-09-24 07:37:45 +00:00