xref: /spdk/module/accel/iaa/accel_iaa_rpc.c (revision 8a01b4d6366393ba157b7c42f076389b9cebaafa)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2022 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 #include "accel_iaa.h"
7 
8 #include "spdk/rpc.h"
9 #include "spdk/util.h"
10 #include "spdk/event.h"
11 #include "spdk/stdinc.h"
12 #include "spdk/env.h"
13 #include "spdk/string.h"
14 
15 static void
16 rpc_iaa_scan_accel_module(struct spdk_jsonrpc_request *request,
17 			  const struct spdk_json_val *params)
18 {
19 	int rc;
20 
21 	if (params != NULL) {
22 		spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
23 						 "iaa_scan_accel_module requires no parameters");
24 		return;
25 	}
26 
27 	rc = accel_iaa_enable_probe();
28 	if (rc != 0) {
29 		spdk_jsonrpc_send_error_response(request, rc, spdk_strerror(-rc));
30 		return;
31 	}
32 
33 	SPDK_NOTICELOG("Enabled IAA user-mode\n");
34 	spdk_jsonrpc_send_bool_response(request, true);
35 }
36 SPDK_RPC_REGISTER("iaa_scan_accel_module", rpc_iaa_scan_accel_module, SPDK_RPC_STARTUP)
37 SPDK_RPC_REGISTER_ALIAS_DEPRECATED(iaa_scan_accel_module, iaa_scan_accel_engine)
38