example/nvme/arbitration: add vfio-user transport support

Change-Id: I4aff5ec209de46e4e5e279cd84ce4968df568a60
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10464
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Mao Jiang 2021-11-30 03:17:39 +00:00 committed by Tomasz Zawadzki
parent 5c0e1c2663
commit 74dcf4aa58
2 changed files with 21 additions and 2 deletions

View File

@ -37,6 +37,7 @@
#include "spdk/env.h"
#include "spdk/string.h"
#include "spdk/nvme_intel.h"
#include "spdk/string.h"
struct ctrlr_entry {
struct spdk_nvme_ctrlr *ctrlr;
@ -89,6 +90,7 @@ struct arb_context {
int queue_depth;
int time_in_sec;
int io_count;
bool hugepage_single_segments;
uint8_t latency_tracking_enable;
uint8_t arbitration_mechanism;
uint8_t arbitration_config;
@ -111,6 +113,7 @@ static TAILQ_HEAD(, ns_entry) g_namespaces = TAILQ_HEAD_INITIALIZER(g_namespaces
static TAILQ_HEAD(, worker_thread) g_workers = TAILQ_HEAD_INITIALIZER(g_workers);
static struct feature features[SPDK_NVME_FEAT_ARBITRATION + 1] = {};
static struct spdk_nvme_transport_id g_trid = {};
static struct arb_context g_arbitration = {
.shm_id = -1,
@ -498,6 +501,8 @@ usage(char *program_name)
printf("\t\t(0 - disabled; 1 - enabled)\n");
printf("\t[-n subjected IOs for performance comparison]\n");
printf("\t[-i shared memory group ID]\n");
printf("\t[-r remote NVMe over Fabrics target address]\n");
printf("\t[-g use single file descriptor for DPDK memory segments]\n");
}
static const char *
@ -650,7 +655,10 @@ parse_args(int argc, char **argv)
bool mix_specified = false;
long int val;
while ((op = getopt(argc, argv, "c:l:i:m:q:s:t:w:M:a:b:n:h")) != -1) {
spdk_nvme_trid_populate_transport(&g_trid, SPDK_NVME_TRANSPORT_PCIE);
snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
while ((op = getopt(argc, argv, "a:b:c:ghi:l:m:n:q:r:s:t:w:M:")) != -1) {
switch (op) {
case 'c':
g_arbitration.core_mask = optarg;
@ -658,6 +666,15 @@ parse_args(int argc, char **argv)
case 'w':
g_arbitration.workload_type = optarg;
break;
case 'r':
if (spdk_nvme_transport_id_parse(&g_trid, optarg) != 0) {
fprintf(stderr, "Error parsing transport address\n");
return 1;
}
break;
case 'g':
g_arbitration.hugepage_single_segments = true;
break;
case 'h':
case '?':
usage(argv[0]);
@ -850,7 +867,7 @@ register_controllers(void)
{
printf("Initializing NVMe Controllers\n");
if (spdk_nvme_probe(NULL, NULL, probe_cb, attach_cb, NULL) != 0) {
if (spdk_nvme_probe(&g_trid, NULL, probe_cb, attach_cb, NULL) != 0) {
fprintf(stderr, "spdk_nvme_probe() failed\n");
return 1;
}

View File

@ -49,6 +49,8 @@ for i in $(seq 1 $NUM_DEVICES); do
sleep 1
$SPDK_EXAMPLE_DIR/reconnect -r "trtype:$TEST_TRANSPORT traddr:$test_traddr subnqn:$test_subnqn" -g -q 32 -o 4096 -w randrw -M 50 -t 5 -c 0xE
sleep 1
$SPDK_EXAMPLE_DIR/arbitration -t 3 -r "trtype:$TEST_TRANSPORT traddr:$test_traddr subnqn:$test_subnqn" -g
sleep 1
done
killprocess $nvmfpid