examples/nvme_reconnect: add single memory segment parameter support

Add one optional parameter to enable single memory segment, which
can be tested with libvfio-user NVMeoF target.

Change-Id: I6d77b0c33f13500e24266ca190d2ee797708a65e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5593
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Changpeng Liu 2020-12-16 16:39:15 +08:00 committed by Tomasz Zawadzki
parent 3048a49c29
commit 414b56600a

View File

@ -115,6 +115,7 @@ static bool g_warn;
static uint32_t g_keep_alive_timeout_in_ms = 0; static uint32_t g_keep_alive_timeout_in_ms = 0;
static uint8_t g_transport_retry_count = 4; static uint8_t g_transport_retry_count = 4;
static uint8_t g_transport_ack_timeout = 0; /* disabled */ static uint8_t g_transport_ack_timeout = 0; /* disabled */
static bool g_dpdk_mem_single_seg = false;
static const char *g_core_mask; static const char *g_core_mask;
@ -684,7 +685,7 @@ parse_args(int argc, char **argv)
g_core_mask = NULL; g_core_mask = NULL;
g_max_completions = 0; g_max_completions = 0;
while ((op = getopt(argc, argv, "c:m:o:q:r:k:s:t:w:A:GM:R:T:")) != -1) { while ((op = getopt(argc, argv, "c:gm:o:q:r:k:s:t:w:A:GM:R:T:")) != -1) {
switch (op) { switch (op) {
case 'm': case 'm':
case 'o': case 'o':
@ -734,6 +735,9 @@ parse_args(int argc, char **argv)
case 'c': case 'c':
g_core_mask = optarg; g_core_mask = optarg;
break; break;
case 'g':
g_dpdk_mem_single_seg = true;
break;
case 'r': case 'r':
if (add_trid(optarg)) { if (add_trid(optarg)) {
usage(argv[0]); usage(argv[0]);
@ -1085,6 +1089,7 @@ int main(int argc, char **argv)
if (g_dpdk_mem) { if (g_dpdk_mem) {
opts.mem_size = g_dpdk_mem; opts.mem_size = g_dpdk_mem;
} }
opts.hugepage_single_segments = g_dpdk_mem_single_seg;
if (spdk_env_init(&opts) < 0) { if (spdk_env_init(&opts) < 0) {
fprintf(stderr, "Unable to initialize SPDK env\n"); fprintf(stderr, "Unable to initialize SPDK env\n");
rc = 1; rc = 1;