From 936d85621988359ba33bb035fb6d36e8f7fd4431 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Wed, 7 Aug 2019 21:46:05 -0400 Subject: [PATCH] nvme: eliminate global configuration 'spdk_nvme_retry_count' option with PCIe transport We have defined NVMe controller initialization 'transport_retry_count' option, so global 'spdk_nvme_retry_count' can be removed, we will remove the variable with PCIe transport first, and make the retry count can be configured via RPC. Change-Id: I4d54f78c8da2180d536635587e7291f44a57c4fb Signed-off-by: Changpeng Liu Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464472 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- include/spdk/nvme.h | 2 +- lib/nvme/nvme_ctrlr.c | 4 ++++ lib/nvme/nvme_pcie.c | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index 25dd04cbc..da1e72b34 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -94,7 +94,7 @@ struct spdk_nvme_ctrlr_opts { /** * Specify the retry number when there is issue with the transport */ - int transport_retry_count; + uint8_t transport_retry_count; /** * The queue depth of each NVMe I/O queue. diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 27b5731b7..9694eb248 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -119,6 +119,10 @@ spdk_nvme_ctrlr_get_default_ctrlr_opts(struct spdk_nvme_ctrlr_opts *opts, size_t opts->keep_alive_timeout_ms = MIN_KEEP_ALIVE_TIMEOUT_IN_MS; } + if (FIELD_OK(transport_retry_count)) { + opts->transport_retry_count = SPDK_NVME_DEFAULT_RETRY_COUNT; + } + if (FIELD_OK(io_queue_size)) { opts->io_queue_size = DEFAULT_IO_QUEUE_SIZE; } diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index 43e84c409..604936f6c 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -156,6 +156,8 @@ struct nvme_pcie_qpair { uint16_t num_entries; + uint8_t retry_count; + uint16_t max_completions_cap; uint16_t last_sq_tail; @@ -1013,6 +1015,8 @@ nvme_pcie_qpair_construct(struct spdk_nvme_qpair *qpair, cq_paddr = opts->cq.paddr; } + pqpair->retry_count = ctrlr->opts.transport_retry_count; + /* * Limit the maximum number of completions to return per call to prevent wraparound, * and calculate how many trackers can be submitted at once without overflowing the @@ -1316,7 +1320,7 @@ nvme_pcie_qpair_complete_tracker(struct spdk_nvme_qpair *qpair, struct nvme_trac error = spdk_nvme_cpl_is_error(cpl); retry = error && nvme_completion_is_retry(cpl) && - req->retries < spdk_nvme_retry_count; + req->retries < pqpair->retry_count; if (error && print_on_error && !qpair->ctrlr->opts.disable_error_logging) { spdk_nvme_qpair_print_command(qpair, &req->cmd);