rpc: added num_io_queues parameter to bdev_nvme_attach_controller

Fixes issue #2243

Signed-off-by: Adam Aronov <aaronov@infinidat.com>
Change-Id: Ia8739102dbff9f775abf8e91fa47ccf81533d2c0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10439
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Adam Aronov 2021-11-28 19:57:12 +02:00 committed by Tomasz Zawadzki
parent d2fe6d7d96
commit d39cbc1374
5 changed files with 22 additions and 2 deletions

View File

@ -7,6 +7,11 @@
API `spdk_nvme_trtype_is_fabrics` was added to return existing transport type
is fabric or not.
### bdev_nvme
Added `num_io_queues` to `bdev_nvme_attach_controller` RPC to allow specifying amount
of requested IO queues.
### bdev
The parameter `retry_count` of the RPC `bdev_nvme_set_options` was deprecated and will be

View File

@ -2898,6 +2898,7 @@ hdgst | Optional | bool | Enable TCP header digest
ddgst | Optional | bool | Enable TCP data digest
fabrics_connect_timeout_us | Optional | bool | Timeout for fabrics connect (in microseconds)
multipath | Optional | string | Multipathing behavior: disable, failover, multipath. Default is failover.
num_io_queues | Optional | uint32_t | The number of IO queues to request during initialization. Range: (0, UINT16_MAX + 1], Default is 1024.
#### Example

View File

@ -221,6 +221,7 @@ static const struct spdk_json_object_decoder rpc_bdev_nvme_attach_controller_dec
{"ddgst", offsetof(struct rpc_bdev_nvme_attach_controller, opts.data_digest), spdk_json_decode_bool, true},
{"fabrics_connect_timeout_us", offsetof(struct rpc_bdev_nvme_attach_controller, opts.fabrics_connect_timeout_us), spdk_json_decode_uint64, true},
{"multipath", offsetof(struct rpc_bdev_nvme_attach_controller, multipath), spdk_json_decode_string, true},
{"num_io_queues", offsetof(struct rpc_bdev_nvme_attach_controller, opts.num_io_queues), spdk_json_decode_uint32, true},
};
#define NVME_MAX_BDEVS_PER_RPC 128
@ -479,6 +480,13 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
multipath = true;
}
if (ctx->req.opts.num_io_queues == 0 || ctx->req.opts.num_io_queues > UINT16_MAX + 1) {
spdk_jsonrpc_send_error_response_fmt(request, -EINVAL,
"num_io_queues out of bounds, min: %u max: %u\n",
1, UINT16_MAX + 1);
goto cleanup;
}
ctx->request = request;
ctx->count = NVME_MAX_BDEVS_PER_RPC;
rc = bdev_nvme_create(&trid, ctx->req.name, ctx->names, ctx->count, prchk_flags,

View File

@ -537,7 +537,8 @@ if __name__ == "__main__":
hdgst=args.hdgst,
ddgst=args.ddgst,
fabrics_timeout=args.fabrics_timeout,
multipath=args.multipath))
multipath=args.multipath,
num_io_queues=args.num_io_queues))
p = subparsers.add_parser('bdev_nvme_attach_controller', aliases=['construct_nvme_bdev'],
help='Add bdevs with nvme backend')
@ -568,6 +569,7 @@ if __name__ == "__main__":
help='Enable TCP data digest.', action='store_true')
p.add_argument('--fabrics-timeout', type=int, help='Fabrics connect timeout in microseconds')
p.add_argument('-x', '--multipath', help='Set multipath behavior (disable, failover, multipath)')
p.add_argument('--num-io-queues', type=int, help='Set the number of IO queues to request during initialization.')
p.set_defaults(func=bdev_nvme_attach_controller)
def bdev_nvme_get_controllers(args):

View File

@ -523,7 +523,7 @@ def bdev_nvme_set_hotplug(client, enable, period_us=None):
def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvcid=None,
priority=None, subnqn=None, hostnqn=None, hostaddr=None,
hostsvcid=None, prchk_reftag=None, prchk_guard=None,
hdgst=None, ddgst=None, fabrics_timeout=None, multipath=None):
hdgst=None, ddgst=None, fabrics_timeout=None, multipath=None, num_io_queues=None):
"""Construct block device for each NVMe namespace in the attached controller.
Args:
@ -543,6 +543,7 @@ def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvc
ddgst: Enable TCP data digest (optional)
fabrics_timeout: Fabrics connect timeout in us (optional)
multipath: The behavior when multiple paths are created ("disable", "failover", or "multipath"; failover if not specified)
num_io_queues: The number of IO queues to request during initialization. (optional)
Returns:
Names of created block devices.
@ -590,6 +591,9 @@ def bdev_nvme_attach_controller(client, name, trtype, traddr, adrfam=None, trsvc
if multipath:
params['multipath'] = multipath
if num_io_queues:
params['num_io_queues'] = num_io_queues
return client.call('bdev_nvme_attach_controller', params)