bdev_nvme: Support for transport_tos in RPC

Added transport_tos parameter to bdev_nvme_set_options and
corresponding rpc.py command line.

Signed-off-by: Michael Haeuptle <michael.haeuptle@hpe.com>
Change-Id: If95eafbd9963fee8d7b230e91ec84dae8713df23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15949
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Michael Haeuptle 2022-12-14 20:24:27 +00:00 committed by Jim Harris
parent 031ba90fe1
commit 990cd38a8c
6 changed files with 22 additions and 2 deletions

View File

@ -115,6 +115,10 @@ tag that was logged at least once.
Added `transport_tos` to `spdk_nvme_ctrlr_opts` to support setting of the "type of service"
value in the IPv4 header. Only RDMA is supported at this time.
### bdev_nvme
Updated `bdev_nvme_set_options` RPC (and rpc.py) to support the new `transport_tos` parameter.
## v22.09
### accel

View File

@ -123,6 +123,7 @@ static struct spdk_bdev_nvme_opts g_opts = {
.fast_io_fail_timeout_sec = 0,
.disable_auto_failback = false,
.generate_uuids = false,
.transport_tos = 0,
};
#define NVME_HOTPLUG_POLL_PERIOD_MAX 10000000ULL
@ -4892,6 +4893,7 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
ctx->drv_opts.transport_ack_timeout = g_opts.transport_ack_timeout;
ctx->drv_opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms;
ctx->drv_opts.disable_read_ana_log_page = true;
ctx->drv_opts.transport_tos = g_opts.transport_tos;
if (nvme_bdev_ctrlr_get_by_name(base_name) == NULL || multipath) {
attach_cb = connect_attach_cb;
@ -6706,6 +6708,7 @@ bdev_nvme_opts_config_json(struct spdk_json_write_ctx *w)
spdk_json_write_named_uint32(w, "reconnect_delay_sec", g_opts.reconnect_delay_sec);
spdk_json_write_named_uint32(w, "fast_io_fail_timeout_sec", g_opts.fast_io_fail_timeout_sec);
spdk_json_write_named_bool(w, "generate_uuids", g_opts.generate_uuids);
spdk_json_write_named_uint8(w, "transport_tos", g_opts.transport_tos);
spdk_json_write_object_end(w);
spdk_json_write_object_end(w);

View File

@ -252,6 +252,8 @@ struct spdk_bdev_nvme_opts {
uint32_t fast_io_fail_timeout_sec;
bool disable_auto_failback;
bool generate_uuids;
/* Type of Service - RDMA only */
uint8_t transport_tos;
};
struct spdk_nvme_qpair *bdev_nvme_get_io_qpair(struct spdk_io_channel *ctrlr_io_ch);

View File

@ -69,6 +69,7 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_options_decoders[] =
{"fast_io_fail_timeout_sec", offsetof(struct spdk_bdev_nvme_opts, fast_io_fail_timeout_sec), spdk_json_decode_uint32, true},
{"disable_auto_failback", offsetof(struct spdk_bdev_nvme_opts, disable_auto_failback), spdk_json_decode_bool, true},
{"generate_uuids", offsetof(struct spdk_bdev_nvme_opts, generate_uuids), spdk_json_decode_bool, true},
{"transport_tos", offsetof(struct spdk_bdev_nvme_opts, transport_tos), spdk_json_decode_uint8, true},
};
static void

View File

@ -531,7 +531,8 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
nvme_adminq_poll_period_us=None, nvme_ioq_poll_period_us=None, io_queue_requests=None,
delay_cmd_submit=None, transport_retry_count=None, bdev_retry_count=None,
transport_ack_timeout=None, ctrlr_loss_timeout_sec=None, reconnect_delay_sec=None,
fast_io_fail_timeout_sec=None, disable_auto_failback=None, generate_uuids=None):
fast_io_fail_timeout_sec=None, disable_auto_failback=None, generate_uuids=None,
transport_tos=None):
"""Set options for the bdev nvme. This is startup command.
Args:
@ -571,6 +572,8 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
By default, immediately failback to the preferred I/O path if it is restored. (optional)
generate_uuids: Enable generation of unique identifiers for NVMe bdevs only if they do not provide UUID themselves.
These strings are based on device serial number and namespace ID and will always be the same for that device.
transport_tos: IPv4 Type of Service value. Only applicable for RDMA transports.
The default is 0 which means no TOS is applied. (optional)
"""
params = {}
@ -639,6 +642,9 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
if generate_uuids is not None:
params['generate_uuids'] = generate_uuids
if transport_tos is not None:
params['transport_tos'] = transport_tos
return client.call('bdev_nvme_set_options', params)

View File

@ -558,7 +558,8 @@ if __name__ == "__main__":
reconnect_delay_sec=args.reconnect_delay_sec,
fast_io_fail_timeout_sec=args.fast_io_fail_timeout_sec,
disable_auto_failback=args.disable_auto_failback,
generate_uuids=args.generate_uuids)
generate_uuids=args.generate_uuids,
transport_tos=args.transport_tos)
p = subparsers.add_parser('bdev_nvme_set_options',
help='Set options for the bdev nvme type. This is startup command.')
@ -627,6 +628,9 @@ if __name__ == "__main__":
help="""Enable generation of unique identifiers for NVMe bdevs only if they do
not provide UUID themselves. These strings are based on device serial number and
namespace ID and will always be the same for that device.""", action='store_true')
p.add_argument('--transport-tos',
help="""IPv4 Type of Service value. Only applicable for RDMA transports.
The default is 0 which means no TOS is applied.""", type=int)
p.set_defaults(func=bdev_nvme_set_options)