lib/nvme: make fabrics connect timeout configurable.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: If829d399882ef948d95673c17e5689c91386c21d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3795
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Seth Howell 2020-08-14 14:29:43 -07:00 committed by Tomasz Zawadzki
parent b3bb3a1bbf
commit 518a1e013a
5 changed files with 22 additions and 8 deletions

View File

@ -248,6 +248,12 @@ struct spdk_nvme_ctrlr_opts {
* structure are valid. And the library will populate any remaining fields with default values.
*/
size_t opts_size;
/**
* The amount of time to spend before timing out during fabric connect on qpairs associated with
* this controller in microseconds.
*/
uint64_t fabrics_connect_timeout_us;
};
/**

View File

@ -206,6 +206,11 @@ spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t
if (FIELD_OK(admin_queue_size)) {
opts->admin_queue_size = DEFAULT_ADMIN_QUEUE_SIZE;
}
if (FIELD_OK(fabrics_connect_timeout_us)) {
opts->fabrics_connect_timeout_us = NVME_FABRIC_CONNECT_COMMAND_TIMEOUT;
}
#undef FIELD_OK
}

View File

@ -40,13 +40,6 @@
#include "spdk/endian.h"
#include "spdk/string.h"
#ifdef DEBUG
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 0
#else
/* 500 millisecond timeout. */
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 500000
#endif
static int
nvme_fabric_prop_set_cmd(struct spdk_nvme_ctrlr *ctrlr,
uint32_t offset, uint8_t size, uint64_t value)
@ -462,7 +455,7 @@ nvme_fabric_qpair_connect(struct spdk_nvme_qpair *qpair, uint32_t num_entries)
}
/* If we time out, the qpair will abort the request upon destruction. */
if (nvme_wait_for_completion_timeout(qpair, status, NVME_FABRIC_CONNECT_COMMAND_TIMEOUT)) {
if (nvme_wait_for_completion_timeout(qpair, status, ctrlr->opts.fabrics_connect_timeout_us)) {
SPDK_ERRLOG("Connect command failed\n");
spdk_free(nvmf_data);
if (!status->timed_out) {

View File

@ -183,6 +183,14 @@ extern pid_t g_spdk_nvme_pid;
sizeof(struct spdk_nvme_cmd), \
sizeof(struct spdk_nvme_cpl)))
/* Default timeout for fabrics connect commands. */
#ifdef DEBUG
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 0
#else
/* 500 millisecond timeout. */
#define NVME_FABRIC_CONNECT_COMMAND_TIMEOUT 500000
#endif
enum nvme_payload_type {
NVME_PAYLOAD_TYPE_INVALID = 0,

View File

@ -40,6 +40,8 @@ function confirm_abi_deps() {
name = spdk_nvme_ns_data
[suppress_type]
name = spdk_nvme_log_page
[suppress_type]
name = spdk_nvme_ctrlr_opts
EOF
for object in "$libdir"/libspdk_*.so; do