nvmf/tcp: Align recv_buf_size to MIN_SOC_PIPE_SIZE

If the user decided to disable ICD then we have several side effects:
1. SPDK prints several warnings/errors
2. SPDK doesn't create recv pipe and doesn't set SO_RCVBUF socket option.

I think that we should not rely on ICD only when we create recv pipe or
set SO_RCVBUF since data may be transferred in sgls via R2T/H2C and
we still need recv_pipe and SO_RCVBUF for better performance.
Alternative option is to set recv_buf_size as a maximum between
ICD and io_unit_size

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4755 (master)

(cherry picked from commit c1fbbfbe56)
Change-Id: Ida71ecc099f9a9355e4617f13315a341872d1cb3
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4920
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Alexey Marchuk 2020-10-16 19:33:22 +03:00 committed by Tomasz Zawadzki
parent bf602f12ca
commit 839af8867e

View File

@ -37,14 +37,14 @@
#include "spdk/assert.h" #include "spdk/assert.h"
#include "spdk/thread.h" #include "spdk/thread.h"
#include "spdk/nvmf_transport.h" #include "spdk/nvmf_transport.h"
#include "spdk/sock.h"
#include "spdk/string.h" #include "spdk/string.h"
#include "spdk/trace.h" #include "spdk/trace.h"
#include "spdk/util.h" #include "spdk/util.h"
#include "spdk/log.h"
#include "spdk_internal/assert.h" #include "spdk_internal/assert.h"
#include "spdk/log.h"
#include "spdk_internal/nvme_tcp.h" #include "spdk_internal/nvme_tcp.h"
#include "spdk_internal/sock.h"
#include "nvmf_internal.h" #include "nvmf_internal.h"
@ -1624,6 +1624,7 @@ nvmf_tcp_icreq_handle(struct spdk_nvmf_tcp_transport *ttransport,
tqpair->recv_buf_size -= SPDK_NVME_TCP_DIGEST_LEN * SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR; tqpair->recv_buf_size -= SPDK_NVME_TCP_DIGEST_LEN * SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR;
} }
tqpair->recv_buf_size = spdk_max(tqpair->recv_buf_size, MIN_SOCK_PIPE_SIZE);
/* Now that we know whether digests are enabled, properly size the receive buffer */ /* Now that we know whether digests are enabled, properly size the receive buffer */
if (spdk_sock_set_recvbuf(tqpair->sock, tqpair->recv_buf_size) < 0) { if (spdk_sock_set_recvbuf(tqpair->sock, tqpair->recv_buf_size) < 0) {
SPDK_WARNLOG("Unable to allocate enough memory for receive buffer on tqpair=%p with size=%d\n", SPDK_WARNLOG("Unable to allocate enough memory for receive buffer on tqpair=%p with size=%d\n",