nvme: change retry count can be configured via bdev nvme driver

Also eliminate 'spdk_nvme_retry_count' finally.

Change-Id: I2f3e390e4b8a49208a11b54bb82c4891cf3e1845
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464473
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Changpeng Liu 2019-08-07 22:30:27 -04:00
parent 936d856219
commit 62bb65289d
5 changed files with 5 additions and 15 deletions

View File

@ -49,9 +49,6 @@ extern "C" {
#include "spdk/nvmf_spec.h"
#define SPDK_NVME_DEFAULT_RETRY_COUNT (4)
extern int32_t spdk_nvme_retry_count;
/**
* Opaque handle to a controller. Returned by spdk_nvme_probe()'s attach_cb.

View File

@ -1297,6 +1297,7 @@ spdk_bdev_nvme_create(struct spdk_nvme_transport_id *trid,
ctx->trid = *trid;
spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->opts, sizeof(ctx->opts));
ctx->opts.transport_retry_count = g_opts.retry_count;
if (hostnqn) {
snprintf(ctx->opts.hostnqn, sizeof(ctx->opts.hostnqn), "%s", hostnqn);
@ -1504,6 +1505,7 @@ bdev_nvme_library_init(void)
}
spdk_nvme_ctrlr_get_default_ctrlr_opts(&opts, sizeof(opts));
opts.transport_retry_count = g_opts.retry_count;
if (probe_ctx->hostnqn != NULL) {
snprintf(opts.hostnqn, sizeof(opts.hostnqn), "%s", probe_ctx->hostnqn);
@ -1559,8 +1561,6 @@ bdev_nvme_library_init(void)
rc = -1;
}
end:
spdk_nvme_retry_count = g_opts.retry_count;
free(probe_ctx);
return rc;
}
@ -2054,7 +2054,7 @@ bdev_nvme_get_spdk_running_config(FILE *fp)
fprintf(fp, "\n"
"# The number of attempts per I/O when an I/O fails. Do not include\n"
"# this key to get the default behavior.\n");
fprintf(fp, "RetryCount %d\n", spdk_nvme_retry_count);
fprintf(fp, "RetryCount %d\n", g_opts.retry_count);
fprintf(fp, "\n"
"# Timeout for each command, in microseconds. If 0, don't track timeouts.\n");
fprintf(fp, "TimeoutUsec %"PRIu64"\n", g_opts.timeout_us);

View File

@ -39,8 +39,6 @@
struct nvme_driver *g_spdk_nvme_driver;
pid_t g_spdk_nvme_pid;
int32_t spdk_nvme_retry_count;
/* gross timeout of 180 seconds in milliseconds */
static int g_nvme_driver_timeout_ms = 3 * 60 * 1000;

View File

@ -610,13 +610,11 @@ associate_workers_with_ns(void)
}
static int
run_nvme_reset_cycle(int retry_count)
run_nvme_reset_cycle(void)
{
struct worker_thread *worker;
struct ns_worker_ctx *ns_ctx;
spdk_nvme_retry_count = retry_count;
if (work_fn(g_workers) != 0) {
return -1;
}
@ -700,7 +698,7 @@ int main(int argc, char **argv)
printf("Initialization complete. Launching workers.\n");
for (i = 2; i >= 0; i--) {
rc = run_nvme_reset_cycle(i);
rc = run_nvme_reset_cycle();
if (rc != 0) {
goto cleanup;
}

View File

@ -51,8 +51,6 @@ static struct nvme_driver _g_nvme_driver = {
};
struct nvme_driver *g_spdk_nvme_driver = &_g_nvme_driver;
int32_t spdk_nvme_retry_count = 1;
struct nvme_request *g_request = NULL;
extern bool ut_fail_vtophys;
@ -469,7 +467,6 @@ test_sgl_req(void)
req->cmd.opc = SPDK_NVME_OPC_WRITE;
req->cmd.cdw10 = 10000;
req->cmd.cdw12 = 7 | 0;
spdk_nvme_retry_count = 1;
fail_next_sge = true;
CU_ASSERT(nvme_qpair_submit_request(&qpair, req) != 0);