numam-spdk/lib
Alexey Marchuk d296fcd8d9 nvme_tcp: Fix icreq/icresp handing with zcopy enabled.
There is a problem with TCP zcopy enabled:
1. TCP initiator sends icreq and start polling a qpair. Polling of qpair
actively calls nvme_tcp_read_pdu function
2. nvme_tcp_read_pdu: qpair is in NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_CH state,
it reads 8 bytes of common PDU header. It determines the type of the PDU
and finds the size of PDU_PSH header.
3. nvme_tcp_read_pdu: qpair is in NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PSH state.
It should read 120 bytes of icresp PDU. The number of bytes which needs to be
read is pdu->psh_len - pdu->psh_valid_bytes. qpair receives 120 bytes
(the full PDU) and calls nvme_tcp_pdu_psh_handle -> nvme_tcp_icresp_handle.
Here we check that we haven't yet received buffer reclaim notification and
simply return from this function. At the same time we continue to poll the qpair.
4. nvme_tcp_read_pdu: qpair is in NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PSH state
and tries to read data from a socket again. The number of bytes is
pdu->psh_len - pdu->psh_valid_bytes. But now pdu->psh_len == pdu->psh_valid_bytes,
so we call nvme_tcp_read_data with zero length.
readv with zero length is commonly used to check errors on the socket,
but in our case there is no errors and readv returns 0.
5. nvme_tcp_read_data treats zero as error and return NVME_TCP_CONNECTION_FATAL.

Fix is to handle icresp, but leave qpair in INITIALIZING state until
we receive acknowledgement for icreqsend_ack. We also move qpair to
NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_READY recv_state so recv_pdu
will be zerofied and qpair will try to read a common PDU header.
But since it is not initialized yet, it won't receive anything
from the target.

Fixes issue #1633

Change-Id: I22cedefe530a8ac3b51495988ed6265d8fad15bb
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4969
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-10-30 09:05:35 +00:00
..
accel accel: Move non-engine specific batch to the accel_fw layer 2020-10-22 22:43:28 +00:00
bdev bdev_module: remove config_text 2020-10-21 02:25:45 +00:00
blob lib/blob: extent_page shall never occupy md page 0 2020-10-16 08:15:16 +00:00
blobfs lib/blobfs: remove legacy config support 2020-10-20 02:42:16 +00:00
conf lib/event: remove legacy configuration from event framework 2020-10-22 17:08:41 +00:00
env_dpdk env_dpdk: add rte_rcu library dependency 2020-10-29 10:39:05 +00:00
env_ocf log: remove internal log.h header 2020-10-15 08:23:39 +00:00
event reactor: check calloc failure in gather_metrics 2020-10-27 16:20:32 +00:00
ftl log: remove internal log.h header 2020-10-15 08:23:39 +00:00
idxd lib/idxd: small code cleanup 2020-10-22 22:43:28 +00:00
ioat log: remove internal log.h header 2020-10-15 08:23:39 +00:00
iscsi subsystem/iscsi: remove legacy config support 2020-10-20 08:53:53 +00:00
json json: add spdk_json_free_object() 2020-10-19 10:02:10 +00:00
jsonrpc log: remove internal log.h header 2020-10-15 08:23:39 +00:00
log log: remove internal log.h header 2020-10-15 08:23:39 +00:00
lvol log: remove internal log.h header 2020-10-15 08:23:39 +00:00
nbd nbd: apply interrupt 2020-10-23 16:23:48 +00:00
net log: remove internal log.h header 2020-10-15 08:23:39 +00:00
notify log: remove internal log.h header 2020-10-15 08:23:39 +00:00
nvme nvme_tcp: Fix icreq/icresp handing with zcopy enabled. 2020-10-30 09:05:35 +00:00
nvmf nvmf: Fixes double triggering of association timer 2020-10-29 08:11:12 +00:00
rdma log: remove internal log.h header 2020-10-15 08:23:39 +00:00
reduce log: remove internal log.h header 2020-10-15 08:23:39 +00:00
rocksdb rocksdb/env_spdk: Fix unused warning. 2020-10-28 12:49:10 +00:00
rpc RPC: update the error message for current RPC state 2020-07-31 08:21:37 +00:00
scsi log: remove internal log.h header 2020-10-15 08:23:39 +00:00
sock log: remove internal log.h header 2020-10-15 08:23:39 +00:00
thread thread: fix warning caused by intr 2020-10-26 11:49:03 +00:00
trace log: remove internal log.h header 2020-10-15 08:23:39 +00:00
ut_mock mk/lib: add a check that major and minor version is set for libs. 2020-05-21 09:19:00 +00:00
util interrupt: new fd_group in lib/util 2020-10-23 16:23:48 +00:00
vhost vhost-blk: extract per queue vdev worker 2020-10-27 08:40:28 +00:00
virtio vhost: deprecate internal vhost library support 2020-10-20 02:42:16 +00:00
vmd log: remove internal log.h header 2020-10-15 08:23:39 +00:00
Makefile vhost: deprecate internal vhost library support 2020-10-20 02:42:16 +00:00