From 01b6bd8a92548e0d6730b091d22c0b9a0054a0c2 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Thu, 20 Aug 2020 01:54:03 -0400 Subject: [PATCH] nvmf: fix the associate timeout value SPDK poller uses microsecond as the input parameter, so we need to change the correct value when opts.association_timeout is expressed by millisecond. Change-Id: Ia674f0115ea176b998e4c0c70b8ce75b28984701 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3861 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk/nvmf.h | 1 + lib/nvmf/ctrlr.c | 4 ++-- lib/nvmf/transport.c | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/spdk/nvmf.h b/include/spdk/nvmf.h index 27a6c3d97..99be1fcfe 100644 --- a/include/spdk/nvmf.h +++ b/include/spdk/nvmf.h @@ -86,6 +86,7 @@ struct spdk_nvmf_transport_opts { uint32_t sock_priority; int acceptor_backlog; uint32_t abort_timeout_sec; + /* ms */ uint32_t association_timeout; }; diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index b6592536e..f73d010c3 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -788,7 +788,7 @@ nvmf_ctrlr_cc_shn_done(struct spdk_io_channel_iter *i, int status) /* After CC.EN transitions to 0 (due to shutdown or reset), the association * between the host and controller shall be preserved for at least 2 minutes */ ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr, - ctrlr->admin_qpair->transport->opts.association_timeout); + ctrlr->admin_qpair->transport->opts.association_timeout * 1000); } static void @@ -808,7 +808,7 @@ nvmf_ctrlr_cc_reset_done(struct spdk_io_channel_iter *i, int status) /* After CC.EN transitions to 0 (due to shutdown or reset), the association * between the host and controller shall be preserved for at least 2 minutes */ ctrlr->association_timer = SPDK_POLLER_REGISTER(nvmf_ctrlr_association_remove, ctrlr, - ctrlr->admin_qpair->transport->opts.association_timeout); + ctrlr->admin_qpair->transport->opts.association_timeout * 1000); } const struct spdk_nvmf_registers * diff --git a/lib/nvmf/transport.c b/lib/nvmf/transport.c index 636cfa223..3574ef0e5 100644 --- a/lib/nvmf/transport.c +++ b/lib/nvmf/transport.c @@ -44,7 +44,7 @@ #include "spdk/util.h" #define MAX_MEMPOOL_NAME_LENGTH 40 -#define NVMF_TRANSPORT_DEFAULT_ASSOCIATION_TIMEOUT 120000 /* ms */ +#define NVMF_TRANSPORT_DEFAULT_ASSOCIATION_TIMEOUT_IN_MS 120000 struct nvmf_transport_ops_list_element { struct spdk_nvmf_transport_ops ops; @@ -500,7 +500,7 @@ spdk_nvmf_transport_opts_init(const char *transport_name, return false; } - opts->association_timeout = NVMF_TRANSPORT_DEFAULT_ASSOCIATION_TIMEOUT; + opts->association_timeout = NVMF_TRANSPORT_DEFAULT_ASSOCIATION_TIMEOUT_IN_MS; ops->opts_init(opts); return true; }