From 32c6f860d5cf9a2d93b3fe40b967388492394f66 Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Thu, 23 Jan 2020 11:04:35 +0300 Subject: [PATCH] reconnect: Add transport ack_timeout and retry_count parameters These parameters can be enabled using -A (ack_timeout) and -R (retry_count) cli options Change-Id: I0c262f93c664a69aa952d6926fd7b0d02acf9e30 Signed-off-by: Alexey Marchuk Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/503 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto --- examples/nvme/reconnect/reconnect.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/examples/nvme/reconnect/reconnect.c b/examples/nvme/reconnect/reconnect.c index 6babd303a..fce65e253 100644 --- a/examples/nvme/reconnect/reconnect.c +++ b/examples/nvme/reconnect/reconnect.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2020 Mellanox Technologies LTD. All rights reserved. * * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * @@ -113,6 +113,8 @@ static uint32_t g_max_completions; static int g_dpdk_mem; static bool g_warn; static uint32_t g_keep_alive_timeout_in_ms = 0; +static uint8_t g_transport_retry_count = 4; +static uint8_t g_transport_ack_timeout = 0; /* disabled */ static const char *g_core_mask; @@ -609,6 +611,8 @@ static void usage(char *program_name) printf("\t[-m max completions per poll]\n"); printf("\t\t(default: 0 - unlimited)\n"); printf("\t[-i shared memory group ID]\n"); + printf("\t[-A transport ACK timeout]\n"); + printf("\t[-R transport retry count]\n"); printf("\t"); spdk_log_usage(stdout, "-T"); #ifdef DEBUG @@ -687,7 +691,7 @@ parse_args(int argc, char **argv) g_core_mask = NULL; g_max_completions = 0; - while ((op = getopt(argc, argv, "c:m:o:q:r:k:s:t:w:GM:T:")) != -1) { + while ((op = getopt(argc, argv, "c:m:o:q:r:k:s:t:w:A:GM:R:T:")) != -1) { switch (op) { case 'm': case 'o': @@ -695,7 +699,9 @@ parse_args(int argc, char **argv) case 'k': case 's': case 't': + case 'A': case 'M': + case 'R': val = spdk_strtol(optarg, 10); if (val < 0) { fprintf(stderr, "Converting a string to integer failed\n"); @@ -720,10 +726,16 @@ parse_args(int argc, char **argv) case 't': g_time_in_sec = val; break; + case 'A': + g_transport_ack_timeout = val; + break; case 'M': g_rw_percentage = val; mix_specified = true; break; + case 'R': + g_transport_retry_count = val; + break; } break; case 'c': @@ -919,6 +931,9 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, opts->keep_alive_timeout_ms = spdk_max(opts->keep_alive_timeout_ms, g_keep_alive_timeout_in_ms); + opts->transport_retry_count = g_transport_retry_count; + opts->transport_ack_timeout = g_transport_ack_timeout; + return true; }