From 19b8d9b10aff759e5fdf8051ebd0a0f6b456187b Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 14 Mar 2018 18:17:38 +0900 Subject: [PATCH] iscsi: Add the param MinConnectionPerSession to iSCSI options The static variable g_connections_per_lcore can be configured by .INI config file. However it had not been added in the iSCSI options because it was not iSCSI global parameter. This patch is necessary for JSON config file to configure it. Change-Id: I12aa1d94dd467969a6853b9fb3f8a627d0d70766 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/403623 Reviewed-by: Daniel Verkamp Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris --- lib/iscsi/conn.c | 3 +-- lib/iscsi/iscsi.h | 2 ++ lib/iscsi/iscsi_subsystem.c | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 438f968ed..7f12a06a4 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -56,9 +56,8 @@ memset(&(conn)->portal, 0, sizeof(*(conn)) - \ offsetof(struct spdk_iscsi_conn, portal)); -#define DEFAULT_CONNECTIONS_PER_LCORE 4 #define SPDK_MAX_POLLERS_PER_CORE 4096 -static int g_connections_per_lcore = DEFAULT_CONNECTIONS_PER_LCORE; +static int g_connections_per_lcore; static uint32_t *g_num_connections; struct spdk_iscsi_conn *g_conns_array; diff --git a/lib/iscsi/iscsi.h b/lib/iscsi/iscsi.h index 674754728..cbd162187 100644 --- a/lib/iscsi/iscsi.h +++ b/lib/iscsi/iscsi.h @@ -78,6 +78,7 @@ #define DEFAULT_TIMEOUT 60 #define MAX_NOPININTERVAL 60 #define DEFAULT_NOPININTERVAL 30 +#define DEFAULT_CONNECTIONS_PER_LCORE 4 /* * SPDK iSCSI target currently only supports 64KB as the maximum data segment length @@ -282,6 +283,7 @@ struct spdk_iscsi_opts { bool ImmediateData; uint32_t ErrorRecoveryLevel; bool AllowDuplicateIsid; + uint32_t min_connections_per_core; }; struct spdk_iscsi_globals { diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index 99bbe24a7..a34401a82 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -590,6 +590,7 @@ spdk_iscsi_opts_init(struct spdk_iscsi_opts *opts) opts->discovery_auth_group = 0; opts->authfile = strdup(SPDK_ISCSI_DEFAULT_AUTHFILE); opts->nodebase = strdup(SPDK_ISCSI_DEFAULT_NODEBASE); + opts->min_connections_per_core = DEFAULT_CONNECTIONS_PER_LCORE; } static void @@ -754,7 +755,7 @@ spdk_iscsi_read_config_file_params(struct spdk_conf_section *sp, } min_conn_per_core = spdk_conf_section_get_intval(sp, "MinConnectionsPerCore"); if (min_conn_per_core >= 0) { - spdk_iscsi_conn_set_min_per_core(min_conn_per_core); + opts->min_connections_per_core = min_conn_per_core; } } @@ -807,6 +808,8 @@ spdk_iscsi_initialize_iscsi_globals(struct spdk_iscsi_opts *opts) g_spdk_iscsi.req_discovery_auth_mutual = opts->req_discovery_auth; g_spdk_iscsi.discovery_auth_group = opts->discovery_auth_group; + spdk_iscsi_conn_set_min_per_core(opts->min_connections_per_core); + g_spdk_iscsi.session = spdk_dma_zmalloc(sizeof(void *) * g_spdk_iscsi.MaxSessions, 0, NULL); if (!g_spdk_iscsi.session) { SPDK_ERRLOG("spdk_dma_zmalloc() failed for session array\n");