From 031ba90fe1e064917440e99a0b2a879133d8cb3f Mon Sep 17 00:00:00 2001 From: Michael Haeuptle Date: Tue, 13 Dec 2022 20:56:40 +0000 Subject: [PATCH] perf: Support setting IPv4 type of service (TOS) New option --transport-tos to allow setting TOS value for RDMA transport. Signed-off-by: Michael Haeuptle Change-Id: I7747fac5c6641dfd18356314e8209bf5f3f35b7e Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15909 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris Community-CI: Mellanox Build Bot --- examples/nvme/perf/perf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 36269e3e3..3a7d130d2 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -254,6 +254,8 @@ static uint32_t g_io_queue_size = UINT16_MAX; static uint32_t g_sock_zcopy_threshold; static char *g_sock_threshold_impl; +static uint8_t g_transport_tos = 0; + /* When user specifies -Q, some error messages are rate limited. When rate * limited, we only print the error message every g_quiet_count times the * error occurs. @@ -1855,6 +1857,7 @@ usage(char *program_name) printf("\t[--psk-identity Default PSK ID, e.g. psk.spdk.io (only applies when sock_impl == ssl)]\n"); printf("\t[--zerocopy-threshold data is sent with MSG_ZEROCOPY if size is greater than this val. Default: 0 to disable it]\n"); printf("\t[--zerocopy-threshold-sock-impl specify the sock implementation to set zerocopy_threshold]\n"); + printf("\t[--transport-tos specify the type of service for RDMA transport. Default: 0 (disabled)]\n"); } static void @@ -2363,6 +2366,8 @@ static const struct option g_perf_cmdline_opts[] = { {"zerocopy-threshold", required_argument, NULL, PERF_ZEROCOPY_THRESHOLD}, #define PERF_SOCK_IMPL 266 {"zerocopy-threshold-sock-impl", required_argument, NULL, PERF_SOCK_IMPL}, +#define PERF_TRANSPORT_TOS 267 + {"transport-tos", required_argument, NULL, PERF_TRANSPORT_TOS}, /* Should be the last element */ {0, 0, 0, 0} }; @@ -2606,6 +2611,14 @@ parse_args(int argc, char **argv, struct spdk_env_opts *env_opts) case PERF_SOCK_IMPL: g_sock_threshold_impl = optarg; break; + case PERF_TRANSPORT_TOS: + val = spdk_strtol(optarg, 10); + if (val < 0) { + fprintf(stderr, "Invalid TOS value\n"); + return 1; + } + g_transport_tos = val; + break; default: usage(argv[0]); return 1; @@ -2790,6 +2803,8 @@ probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, opts->keep_alive_timeout_ms = g_keep_alive_timeout_in_ms; memcpy(opts->hostnqn, trid_entry->hostnqn, sizeof(opts->hostnqn)); + opts->transport_tos = g_transport_tos; + return true; }