rpc/bdev_nvme: Deprecate retry_count and add transport_retry_count instead

retry_count of struct spdk_bdev_nvme_opts controls the number of retries
in the transport layer, and is set to transport_retry_count of struct
spdk_nvme_ctrlr_opts.

The next patch will add bdev_retry_count to struct spdk_bdev_nvme_opts
to control the number of retries in the bdev layer.

For clarification, rename retry_count to transport_retry_count of
struct spdk_bdev_nvme_opts. Then deprecate the retry_count parameter
and add and use an new parameter transport_retry_count instead for
the RPC bdev_nvme_set_options.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0689c54aa1c96ee99d24236e8ff1a594ad7208e4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9924
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-10-19 04:33:01 +09:00 committed by Tomasz Zawadzki
parent 9024562463
commit 4495bda43f
7 changed files with 27 additions and 11 deletions

View File

@ -2,6 +2,11 @@
## v22.01: (Upcoming Release)
### bdev
The parameter `retry_count` of the RPC `bdev_nvme_set_options` was deprecated and will be
removed in SPDK 22.01, and the parameter `transport_retry_count` is added and used instead.
## v21.10
Structure `spdk_nvmf_target_opts` has been extended with new member `discovery_filter` which allows to specify

View File

@ -2777,7 +2777,7 @@ action_on_timeout | Optional | string | Action to take on command
timeout_us | Optional | number | Timeout for each command, in microseconds. If 0, don't track timeouts
timeout_admin_us | Optional | number | Timeout for each admin command, in microseconds. If 0, treat same as io timeouts ('timeout_us')
keep_alive_timeout_ms | Optional | number | Keep alive timeout period in milliseconds, default is 10s
retry_count | Optional | number | The number of attempts per I/O before an I/O fails
retry_count | Optional | number | The number of attempts per I/O before an I/O fails. (Deprecated. Please use transport_retry_count instead.)
arbitration_burst | Optional | number | The value is expressed as a power of two, a value of 111b indicates no limit
low_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a low priority queue
medium_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a medium priority queue
@ -2786,6 +2786,7 @@ nvme_adminq_poll_period_us | Optional | number | How often the admin queue
nvme_ioq_poll_period_us | Optional | number | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
io_queue_requests | Optional | number | The number of requests allocated for each NVMe I/O queue. Default: 512.
delay_cmd_submit | Optional | boolean | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`.
transport_retry_count | Optional | number | The number of attempts per I/O in the transport layer before an I/O fails.
#### Example
@ -2795,7 +2796,7 @@ Example request:
request:
{
"params": {
"retry_count": 5,
"transport_retry_count": 5,
"arbitration_burst": 3,
"low_priority_weight": 8,
"medium_priority_weight":8,

View File

@ -131,7 +131,7 @@ static struct spdk_bdev_nvme_opts g_opts = {
.timeout_us = 0,
.timeout_admin_us = 0,
.keep_alive_timeout_ms = SPDK_BDEV_NVME_DEFAULT_KEEP_ALIVE_TIMEOUT_IN_MS,
.retry_count = 4,
.transport_retry_count = 4,
.arbitration_burst = 0,
.low_priority_weight = 0,
.medium_priority_weight = 0,
@ -3531,7 +3531,7 @@ bdev_nvme_create(struct spdk_nvme_transport_id *trid,
spdk_nvme_ctrlr_get_default_ctrlr_opts(&ctx->opts, sizeof(ctx->opts));
}
ctx->opts.transport_retry_count = g_opts.retry_count;
ctx->opts.transport_retry_count = g_opts.transport_retry_count;
ctx->opts.keep_alive_timeout_ms = g_opts.keep_alive_timeout_ms;
ctx->opts.disable_read_ana_log_page = true;
@ -4653,7 +4653,7 @@ bdev_nvme_opts_config_json(struct spdk_json_write_ctx *w)
spdk_json_write_named_uint64(w, "timeout_us", g_opts.timeout_us);
spdk_json_write_named_uint64(w, "timeout_admin_us", g_opts.timeout_admin_us);
spdk_json_write_named_uint32(w, "keep_alive_timeout_ms", g_opts.keep_alive_timeout_ms);
spdk_json_write_named_uint32(w, "retry_count", g_opts.retry_count);
spdk_json_write_named_uint32(w, "transport_retry_count", g_opts.transport_retry_count);
spdk_json_write_named_uint32(w, "arbitration_burst", g_opts.arbitration_burst);
spdk_json_write_named_uint32(w, "low_priority_weight", g_opts.low_priority_weight);
spdk_json_write_named_uint32(w, "medium_priority_weight", g_opts.medium_priority_weight);

View File

@ -213,7 +213,8 @@ struct spdk_bdev_nvme_opts {
uint64_t timeout_us;
uint64_t timeout_admin_us;
uint32_t keep_alive_timeout_ms;
uint32_t retry_count;
/* The number of attempts per I/O in the transport layer before an I/O fails. */
uint32_t transport_retry_count;
uint32_t arbitration_burst;
uint32_t low_priority_weight;
uint32_t medium_priority_weight;

View File

@ -79,7 +79,7 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_options_decoders[] =
{"timeout_us", offsetof(struct spdk_bdev_nvme_opts, timeout_us), spdk_json_decode_uint64, true},
{"timeout_admin_us", offsetof(struct spdk_bdev_nvme_opts, timeout_admin_us), spdk_json_decode_uint64, true},
{"keep_alive_timeout_ms", offsetof(struct spdk_bdev_nvme_opts, keep_alive_timeout_ms), spdk_json_decode_uint32, true},
{"retry_count", offsetof(struct spdk_bdev_nvme_opts, retry_count), spdk_json_decode_uint32, true},
{"retry_count", offsetof(struct spdk_bdev_nvme_opts, transport_retry_count), spdk_json_decode_uint32, true},
{"arbitration_burst", offsetof(struct spdk_bdev_nvme_opts, arbitration_burst), spdk_json_decode_uint32, true},
{"low_priority_weight", offsetof(struct spdk_bdev_nvme_opts, low_priority_weight), spdk_json_decode_uint32, true},
{"medium_priority_weight", offsetof(struct spdk_bdev_nvme_opts, medium_priority_weight), spdk_json_decode_uint32, true},
@ -88,6 +88,7 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_options_decoders[] =
{"nvme_ioq_poll_period_us", offsetof(struct spdk_bdev_nvme_opts, nvme_ioq_poll_period_us), spdk_json_decode_uint64, true},
{"io_queue_requests", offsetof(struct spdk_bdev_nvme_opts, io_queue_requests), spdk_json_decode_uint32, true},
{"delay_cmd_submit", offsetof(struct spdk_bdev_nvme_opts, delay_cmd_submit), spdk_json_decode_bool, true},
{"transport_retry_count", offsetof(struct spdk_bdev_nvme_opts, transport_retry_count), spdk_json_decode_uint32, true},
};
static void

View File

@ -466,7 +466,8 @@ if __name__ == "__main__":
nvme_adminq_poll_period_us=args.nvme_adminq_poll_period_us,
nvme_ioq_poll_period_us=args.nvme_ioq_poll_period_us,
io_queue_requests=args.io_queue_requests,
delay_cmd_submit=args.delay_cmd_submit)
delay_cmd_submit=args.delay_cmd_submit,
transport_retry_count=args.transport_retry_count)
p = subparsers.add_parser('bdev_nvme_set_options', aliases=['set_bdev_nvme_options'],
help='Set options for the bdev nvme type. This is startup command.')
@ -479,7 +480,7 @@ if __name__ == "__main__":
p.add_argument('-k', '--keep-alive-timeout-ms',
help="Keep alive timeout period in millisecond. If 0, disable keep-alive.", type=int)
p.add_argument('-n', '--retry-count',
help='the number of attempts per I/O when an I/O fails', type=int)
help='the number of attempts per I/O when an I/O fails. (deprecated, please use --transport-retry-count.)', type=int)
p.add_argument('--arbitration-burst',
help='the value is expressed as a power of two', type=int)
p.add_argument('--low-priority-weight',
@ -497,6 +498,8 @@ if __name__ == "__main__":
p.add_argument('-d', '--disable-delay-cmd-submit',
help='Disable delaying NVMe command submission, i.e. no batching of multiple commands',
action='store_false', dest='delay_cmd_submit', default=True)
p.add_argument('-c', '--transport-retry-count',
help='the number of attempts per I/O in the transport layer when an I/O fails.', type=int)
p.set_defaults(func=bdev_nvme_set_options)
def bdev_nvme_set_hotplug(args):

View File

@ -429,7 +429,7 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
keep_alive_timeout_ms=None, retry_count=None, arbitration_burst=None,
low_priority_weight=None, medium_priority_weight=None, high_priority_weight=None,
nvme_adminq_poll_period_us=None, nvme_ioq_poll_period_us=None, io_queue_requests=None,
delay_cmd_submit=None):
delay_cmd_submit=None, transport_retry_count=None):
"""Set options for the bdev nvme. This is startup command.
Args:
@ -437,7 +437,7 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
timeout_us: Timeout for each command, in microseconds. If 0, don't track timeouts (optional)
timeout_admin_us: Timeout for each admin command, in microseconds. If 0, treat same as io timeouts (optional)
keep_alive_timeout_ms: Keep alive timeout period in millisecond, default is 10s (optional)
retry_count: The number of attempts per I/O when an I/O fails (optional)
retry_count: The number of attempts per I/O when an I/O fails (deprecated) (optional)
arbitration_burst: The value is expressed as a power of two (optional)
low_prioity_weight: The number of commands that may be executed from the low priority queue at one time (optional)
medium_prioity_weight: The number of commands that may be executed from the medium priority queue at one time (optional)
@ -446,6 +446,7 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
nvme_ioq_poll_period_us: How often to poll I/O queues for completions in microseconds (optional)
io_queue_requests: The number of requests allocated for each NVMe I/O queue. Default: 512 (optional)
delay_cmd_submit: Enable delayed NVMe command submission to allow batching of multiple commands (optional)
transport_retry_count: The number of attempts per I/O in the transport layer when an I/O fails (optional)
"""
params = {}
@ -462,6 +463,7 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
params['keep_alive_timeout_ms'] = keep_alive_timeout_ms
if retry_count is not None:
print("WARNING: retry_count is deprecated, please use transport_retry_count.")
params['retry_count'] = retry_count
if arbitration_burst is not None:
@ -488,6 +490,9 @@ def bdev_nvme_set_options(client, action_on_timeout=None, timeout_us=None, timeo
if delay_cmd_submit is not None:
params['delay_cmd_submit'] = delay_cmd_submit
if transport_retry_count is not None:
params['transport_retry_count'] = transport_retry_count
return client.call('bdev_nvme_set_options', params)