Commit 518a1e01 authored by Seth Howell's avatar Seth Howell Committed by Tomasz Zawadzki
Browse files

lib/nvme: make fabrics connect timeout configurable.



Signed-off-by: default avatarSeth 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: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent b3bb3a1b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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;
};

/**
+5 −0
Original line number Diff line number Diff line
@@ -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
}

+1 −8
Original line number Diff line number Diff line
@@ -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) {
+8 −0
Original line number Diff line number Diff line
@@ -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,

+2 −0
Original line number Diff line number Diff line
@@ -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