nvme_tcp: Move the default buffer factor size in nvme_tcp.h

1 Change the default factor from 4 to 8, which can be used
to improve the performance.

2 Change the base buffer size in nvme_tcp.c,
we should not use sizeof(struct spdk_nvme_tcp_cmd),
it is 72 bytes. Normally, the initiator will receive
C2h pdus and R2T Pdus by most, so set the size of using
sizeof(struct spdk_nvme_tcp_c2h_data_hdr) is enough.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I384f4cb026cb8d83e75b639f7256ee8cb8ed1df1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3283
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ziye Yang 2020-07-11 01:03:06 +08:00 committed by Tomasz Zawadzki
parent f0be991330
commit 1da44e0604
3 changed files with 5 additions and 4 deletions

View File

@ -42,6 +42,7 @@
#define SPDK_NVME_TCP_DIGEST_LEN 4
#define SPDK_NVME_TCP_DIGEST_ALIGNMENT 4
#define SPDK_NVME_TCP_QPAIR_EXIT_TIMEOUT 30
#define SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR 8
/*
* Maximum number of SGL elements.

View File

@ -974,8 +974,9 @@ nvme_tcp_icresp_handle(struct nvme_tcp_qpair *tqpair,
SPDK_DEBUGLOG(SPDK_LOG_NVME, "host_ddgst_enable: %u\n", tqpair->host_ddgst_enable);
/* Now that we know whether digests are enabled, properly size the receive buffer to
* handle 4 incoming 4K read commands. */
recv_buf_size = 0x1000 + sizeof(struct spdk_nvme_tcp_cmd);
* handle several incoming 4K read commands according to SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR
* parameter. */
recv_buf_size = 0x1000 + sizeof(struct spdk_nvme_tcp_c2h_data_hdr);
if (tqpair->host_hdgst_enable) {
recv_buf_size += SPDK_NVME_TCP_DIGEST_LEN;
@ -985,7 +986,7 @@ nvme_tcp_icresp_handle(struct nvme_tcp_qpair *tqpair,
recv_buf_size += SPDK_NVME_TCP_DIGEST_LEN;
}
if (spdk_sock_set_recvbuf(tqpair->sock, recv_buf_size * 4) < 0) {
if (spdk_sock_set_recvbuf(tqpair->sock, recv_buf_size * SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR) < 0) {
SPDK_WARNLOG("Unable to allocate enough memory for receive buffer on tqpair=%p with size=%d\n",
tqpair,
recv_buf_size);

View File

@ -50,7 +50,6 @@
#define NVMF_TCP_MAX_ACCEPT_SOCK_ONE_TIME 16
#define SPDK_NVMF_TCP_DEFAULT_MAX_SOCK_PRIORITY 6
#define SPDK_NVMF_TCP_RECV_BUF_SIZE_FACTOR 4
const struct spdk_nvmf_transport_ops spdk_nvmf_transport_tcp;