Commit 32c6f860 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

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: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/503


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 94966468
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
/*-
 *   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;
}