From 20cd4841f14e2f674277bb8069640f3f185054c4 Mon Sep 17 00:00:00 2001 From: BinYang0 Date: Tue, 12 Jul 2022 16:57:45 +0800 Subject: [PATCH] lib/nvmf: set low water mark in NVMe/TCP target to 1 byte In NVMe/TCP target, the socket low water mark is set to sizeof(struct spdk_nvme_tcp_common_pdu_hdr), which is 8 bytes. In corner test, there might be 4 bytes data packet sent to NVMe/TCP target, after that, if there is no more data sent to the same socket, the 4 bytes won't be read by NVMe/TCP target qpair thread. Because of this, there is a IO request didn't complete in initiator. Then, if manual call the readv function to read the 4 bytes for the pdu in target, the io request complete normally in initiator. It seems like the pdu might be split, and in the situation, the IO request will not complete until new IO request reach. After set low water mark in NVMe/TCP target to 1 byte, just like iscsi target done, the issue disappear immediately. Signed-off-by: BinYang0 Change-Id: I59d3d900f0b25632d786ef25ab096eabe43476bd Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13633 Reviewed-by: Reviewed-by: Qingmin Liu Reviewed-by: Changpeng Liu Reviewed-by: Aleksey Marchuk Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins --- lib/nvmf/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index c705ec783..3b86d802a 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -1146,7 +1146,7 @@ nvmf_tcp_qpair_sock_init(struct spdk_nvmf_tcp_qpair *tqpair) spdk_trace_record(TRACE_TCP_QP_SOCK_INIT, 0, 0, (uintptr_t)tqpair); /* set low water mark */ - rc = spdk_sock_set_recvlowat(tqpair->sock, sizeof(struct spdk_nvme_tcp_common_pdu_hdr)); + rc = spdk_sock_set_recvlowat(tqpair->sock, 1); if (rc != 0) { SPDK_ERRLOG("spdk_sock_set_recvlowat() failed\n"); return rc;