diff --git a/doc/jsonrpc.md b/doc/jsonrpc.md index 9ec5a756bb..74988bdfaf 100644 --- a/doc/jsonrpc.md +++ b/doc/jsonrpc.md @@ -279,7 +279,7 @@ Example response: "get_subsystems", "context_switch_monitor", "kill_instance", - "scan_ioat_copy_engine", + "ioat_scan_copy_engine", "bdev_virtio_attach_controller", "bdev_virtio_scsi_get_devices", "bdev_virtio_detach_controller", diff --git a/module/copy/ioat/copy_engine_ioat_rpc.c b/module/copy/ioat/copy_engine_ioat_rpc.c index f13aab18b5..8be2beda1a 100644 --- a/module/copy/ioat/copy_engine_ioat_rpc.c +++ b/module/copy/ioat/copy_engine_ioat_rpc.c @@ -61,33 +61,33 @@ free_rpc_pci_whitelist(struct rpc_pci_whitelist *list) } } -struct rpc_copy_engine_ioat { +struct rpc_ioat_scan_copy_engine { struct rpc_pci_whitelist pci_whitelist; }; static void -free_rpc_copy_engine_ioat(struct rpc_copy_engine_ioat *p) +free_rpc_ioat_scan_copy_engine(struct rpc_ioat_scan_copy_engine *p) { free_rpc_pci_whitelist(&p->pci_whitelist); } -static const struct spdk_json_object_decoder rpc_copy_engine_ioat_decoder[] = { - {"pci_whitelist", offsetof(struct rpc_copy_engine_ioat, pci_whitelist), decode_rpc_pci_whitelist}, +static const struct spdk_json_object_decoder rpc_ioat_scan_copy_engine_decoder[] = { + {"pci_whitelist", offsetof(struct rpc_ioat_scan_copy_engine, pci_whitelist), decode_rpc_pci_whitelist}, }; static void -spdk_rpc_scan_ioat_copy_engine(struct spdk_jsonrpc_request *request, +spdk_rpc_ioat_scan_copy_engine(struct spdk_jsonrpc_request *request, const struct spdk_json_val *params) { - struct rpc_copy_engine_ioat req = {}; + struct rpc_ioat_scan_copy_engine req = {}; struct spdk_json_write_ctx *w; int rc; if (params != NULL) { - if (spdk_json_decode_object(params, rpc_copy_engine_ioat_decoder, - SPDK_COUNTOF(rpc_copy_engine_ioat_decoder), + if (spdk_json_decode_object(params, rpc_ioat_scan_copy_engine_decoder, + SPDK_COUNTOF(rpc_ioat_scan_copy_engine_decoder), &req)) { - free_rpc_copy_engine_ioat(&req); + free_rpc_ioat_scan_copy_engine(&req); SPDK_ERRLOG("spdk_json_decode_object() failed\n"); spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid parameters"); @@ -96,7 +96,7 @@ spdk_rpc_scan_ioat_copy_engine(struct spdk_jsonrpc_request *request, rc = copy_engine_ioat_add_whitelist_devices((const char **)req.pci_whitelist.bdfs, req.pci_whitelist.num_bdfs); - free_rpc_copy_engine_ioat(&req); + free_rpc_ioat_scan_copy_engine(&req); if (rc < 0) { SPDK_ERRLOG("copy_engine_ioat_add_whitelist_devices() failed\n"); spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, @@ -111,4 +111,5 @@ spdk_rpc_scan_ioat_copy_engine(struct spdk_jsonrpc_request *request, spdk_json_write_bool(w, true); spdk_jsonrpc_end_result(request, w); } -SPDK_RPC_REGISTER("scan_ioat_copy_engine", spdk_rpc_scan_ioat_copy_engine, SPDK_RPC_STARTUP) +SPDK_RPC_REGISTER("ioat_scan_copy_engine", spdk_rpc_ioat_scan_copy_engine, SPDK_RPC_STARTUP) +SPDK_RPC_REGISTER_ALIAS_DEPRECATED(ioat_scan_copy_engine, scan_ioat_copy_engine) diff --git a/scripts/rpc.py b/scripts/rpc.py index 351f1203c7..b44e62f6c3 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -1922,17 +1922,18 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse p.set_defaults(func=bdev_virtio_detach_controller) # ioat - def scan_ioat_copy_engine(args): + def ioat_scan_copy_engine(args): pci_whitelist = [] if args.pci_whitelist: for w in args.pci_whitelist.strip().split(" "): pci_whitelist.append(w) - rpc.ioat.scan_ioat_copy_engine(args.client, pci_whitelist) + rpc.ioat.ioat_scan_copy_engine(args.client, pci_whitelist) - p = subparsers.add_parser('scan_ioat_copy_engine', help='Set scan and enable IOAT copy engine offload.') + p = subparsers.add_parser('ioat_scan_copy_engine', aliases=['scan_ioat_copy_engine'], + help='Set scan and enable IOAT copy engine offload.') p.add_argument('-w', '--pci-whitelist', help="""Whitespace-separated list of PCI addresses in domain:bus:device.function format or domain.bus.device.function format""") - p.set_defaults(func=scan_ioat_copy_engine) + p.set_defaults(func=ioat_scan_copy_engine) # bdev_nvme_send_cmd def bdev_nvme_send_cmd(args): diff --git a/scripts/rpc/ioat.py b/scripts/rpc/ioat.py index 958e18bb4d..27891c7500 100644 --- a/scripts/rpc/ioat.py +++ b/scripts/rpc/ioat.py @@ -1,4 +1,8 @@ -def scan_ioat_copy_engine(client, pci_whitelist): +from .helpers import deprecated_alias + + +@deprecated_alias('scan_ioat_copy_engine') +def ioat_scan_copy_engine(client, pci_whitelist): """Scan and enable IOAT copy engine. Args: @@ -9,4 +13,4 @@ def scan_ioat_copy_engine(client, pci_whitelist): params = {} if pci_whitelist: params['pci_whitelist'] = pci_whitelist - return client.call('scan_ioat_copy_engine', params) + return client.call('ioat_scan_copy_engine', params)