diff --git a/app/nvmf_tgt/conf.c b/app/nvmf_tgt/conf.c index d5bb7f9561..258e661d2b 100644 --- a/app/nvmf_tgt/conf.c +++ b/app/nvmf_tgt/conf.c @@ -55,6 +55,8 @@ #define PORTNUMSTRLEN 32 +#define ACCEPT_TIMEOUT_US 1000 /* 1ms */ + struct spdk_nvmf_probe_ctx { struct spdk_nvmf_subsystem *subsystem; bool any; @@ -158,6 +160,7 @@ spdk_nvmf_parse_nvmf_tgt(void) int in_capsule_data_size; int max_io_size; int acceptor_lcore; + int acceptor_poll_rate; int rc; sp = spdk_conf_find_section(NULL, "Nvmf"); @@ -206,6 +209,12 @@ spdk_nvmf_parse_nvmf_tgt(void) } g_spdk_nvmf_tgt_conf.acceptor_lcore = acceptor_lcore; + acceptor_poll_rate = spdk_conf_section_get_intval(sp, "AcceptorPollRate"); + if (acceptor_poll_rate < 0) { + acceptor_poll_rate = ACCEPT_TIMEOUT_US; + } + g_spdk_nvmf_tgt_conf.acceptor_poll_rate = acceptor_poll_rate; + rc = nvmf_tgt_init(max_queue_depth, max_queues_per_sess, in_capsule_data_size, max_io_size); if (rc != 0) { SPDK_ERRLOG("nvmf_tgt_init() failed\n"); diff --git a/app/nvmf_tgt/nvmf_tgt.c b/app/nvmf_tgt/nvmf_tgt.c index 119fb4cf15..0fb8cd5594 100644 --- a/app/nvmf_tgt/nvmf_tgt.c +++ b/app/nvmf_tgt/nvmf_tgt.c @@ -58,8 +58,6 @@ #define SPDK_NVMF_BUILD_ETC "/usr/local/etc/nvmf" #define SPDK_NVMF_DEFAULT_CONFIG SPDK_NVMF_BUILD_ETC "/nvmf.conf" -#define ACCEPT_TIMEOUT_US 10000 /* 10ms */ - static struct spdk_poller *g_acceptor_poller = NULL; static TAILQ_HEAD(, nvmf_tgt_subsystem) g_subsystems = TAILQ_HEAD_INITIALIZER(g_subsystems); @@ -333,7 +331,8 @@ spdk_nvmf_startup(spdk_event_t event) } spdk_poller_register(&g_acceptor_poller, acceptor_poll, NULL, - g_spdk_nvmf_tgt_conf.acceptor_lcore, NULL, ACCEPT_TIMEOUT_US); + g_spdk_nvmf_tgt_conf.acceptor_lcore, NULL, + g_spdk_nvmf_tgt_conf.acceptor_poll_rate); SPDK_NOTICELOG("Acceptor running on core %u\n", g_spdk_nvmf_tgt_conf.acceptor_lcore); diff --git a/app/nvmf_tgt/nvmf_tgt.h b/app/nvmf_tgt/nvmf_tgt.h index ff53b02786..26dbb1caa5 100644 --- a/app/nvmf_tgt/nvmf_tgt.h +++ b/app/nvmf_tgt/nvmf_tgt.h @@ -47,6 +47,7 @@ struct rpc_listen_address { struct spdk_nvmf_tgt_conf { uint32_t acceptor_lcore; + uint32_t acceptor_poll_rate; }; struct nvmf_tgt_subsystem { diff --git a/etc/spdk/nvmf.conf.in b/etc/spdk/nvmf.conf.in index d5c684b3c8..b48aa73e38 100644 --- a/etc/spdk/nvmf.conf.in +++ b/etc/spdk/nvmf.conf.in @@ -52,6 +52,11 @@ # Set the global acceptor lcore ID, lcores are numbered starting at 0. #AcceptorCore 0 + # Set how often the acceptor polls for incoming connections. The acceptor is also + # responsible for polling existing connections that have gone idle. 0 means continuously + # poll. Units in microseconds. + AcceptorPollRate 1000 + # Define an NVMf Subsystem. # - NQN is required and must be unique. # - Core may be set or not. If set, the specified subsystem will run on