Commit 5288c4df authored by Matt Dumm's avatar Matt Dumm Committed by Tomasz Zawadzki
Browse files

nvme: separate admin timeout vs. io timeout



Signed-off-by: default avatarMatt Dumm <matt.dumm@hpe.com>
Change-Id: Ia1f105fdf154aae034ccfca2f0dc3b4c43c9fc84
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8072


Reviewed-by: default avatarMichael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarZiye Yang <ziye.yang@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent a6e45885
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ the spdk_nvme_ctrlr_opts structure prior to controller attach.
Add a new function `spdk_nvme_detach_poll` to simplify a common use case to continue
polling until all detachments complete.

Added new argument 'timeout_admin_us' to 'spdk_nvme_ctrlr_register_timeout_callback' so callers
can specify a different timeout for admin commands vs. io commands.

An existing function `spdk_nvme_detach_async` was updated to add one or more detachments
to an active context while it is being polled.

+2 −1
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ register_dev(struct spdk_nvme_ctrlr *ctrlr)
	dev->is_removed = false;
	dev->is_draining = false;

	spdk_nvme_ctrlr_register_timeout_callback(ctrlr, g_timeout_in_us, timeout_cb, NULL);
	spdk_nvme_ctrlr_register_timeout_callback(ctrlr, g_timeout_in_us, g_timeout_in_us, timeout_cb,
			NULL);

	dev->ns = spdk_nvme_ctrlr_get_ns(ctrlr, 1);

+4 −2
Original line number Diff line number Diff line
@@ -1294,12 +1294,14 @@ typedef void (*spdk_nvme_timeout_cb)(void *cb_arg,
 * for timeout callback.
 *
 * \param ctrlr NVMe controller on which to monitor for timeout.
 * \param timeout_us Timeout value in microseconds.
 * \param timeout_io_us Timeout value in microseconds for io commands.
 * \param timeout_admin_us Timeout value in microseconds for admin commands.
 * \param cb_fn A function pointer that points to the callback function.
 * \param cb_arg Argument to the callback function.
 */
void spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr,
		uint64_t timeout_us, spdk_nvme_timeout_cb cb_fn, void *cb_arg);
		uint64_t timeout_io_us, uint64_t timeout_admin_us,
		spdk_nvme_timeout_cb cb_fn, void *cb_arg);

/**
 * NVMe I/O queue pair initialization options.
+3 −1
Original line number Diff line number Diff line
@@ -476,6 +476,8 @@ nvme_request_check_timeout(struct nvme_request *req, uint16_t cid,
{
	struct spdk_nvme_qpair *qpair = req->qpair;
	struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
	uint64_t timeout_ticks = nvme_qpair_is_admin_queue(qpair) ?
				 active_proc->timeout_admin_ticks : active_proc->timeout_io_ticks;

	assert(active_proc->timeout_cb_fn != NULL);

@@ -492,7 +494,7 @@ nvme_request_check_timeout(struct nvme_request *req, uint16_t cid,
		return 0;
	}

	if (req->submit_tick + active_proc->timeout_ticks > now_tick) {
	if (req->submit_tick + timeout_ticks > now_tick) {
		return 1;
	}

+4 −2
Original line number Diff line number Diff line
@@ -3854,7 +3854,8 @@ spdk_nvme_ctrlr_register_aer_callback(struct spdk_nvme_ctrlr *ctrlr,

void
spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr,
		uint64_t timeout_us, spdk_nvme_timeout_cb cb_fn, void *cb_arg)
		uint64_t timeout_io_us, uint64_t timeout_admin_us,
		spdk_nvme_timeout_cb cb_fn, void *cb_arg)
{
	struct spdk_nvme_ctrlr_process	*active_proc;

@@ -3862,7 +3863,8 @@ spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr *ctrlr,

	active_proc = nvme_ctrlr_get_current_process(ctrlr);
	if (active_proc) {
		active_proc->timeout_ticks = timeout_us * spdk_get_ticks_hz() / 1000000ULL;
		active_proc->timeout_io_ticks = timeout_io_us * spdk_get_ticks_hz() / 1000000ULL;
		active_proc->timeout_admin_ticks = timeout_admin_us * spdk_get_ticks_hz() / 1000000ULL;
		active_proc->timeout_cb_fn = cb_fn;
		active_proc->timeout_cb_arg = cb_arg;
	}
Loading