xref: /spdk/lib/accel/accel_internal.h (revision 60982c759db49b4f4579f16e3b24df0725ba4b94)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2022 Intel Corporation.
3  *   Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES.
4  *   All rights reserved.
5  */
6 
7 #ifndef SPDK_INTERNAL_ACCEL_INTERNAL_H
8 #define SPDK_INTERNAL_ACCEL_INTERNAL_H
9 
10 #include "spdk/stdinc.h"
11 
12 #include "spdk/accel.h"
13 #include "spdk/queue.h"
14 #include "spdk/config.h"
15 
16 #define ACCEL_AES_XTS "AES_XTS"
17 
18 struct module_info {
19 	struct spdk_json_write_ctx *w;
20 	const char *name;
21 	enum accel_opcode ops[ACCEL_OPC_LAST];
22 	uint32_t num_ops;
23 };
24 
25 struct accel_operation_stats {
26 	uint64_t executed;
27 	uint64_t failed;
28 	uint64_t num_bytes;
29 };
30 
31 struct accel_stats {
32 	struct accel_operation_stats	operations[ACCEL_OPC_LAST];
33 	uint64_t			sequence_executed;
34 	uint64_t			sequence_failed;
35 };
36 
37 typedef void (*_accel_for_each_module_fn)(struct module_info *info);
38 void _accel_for_each_module(struct module_info *info, _accel_for_each_module_fn fn);
39 int _accel_get_opc_name(enum accel_opcode opcode, const char **opcode_name);
40 void _accel_crypto_key_dump_param(struct spdk_json_write_ctx *w, struct spdk_accel_crypto_key *key);
41 void _accel_crypto_keys_dump_param(struct spdk_json_write_ctx *w);
42 typedef void (*accel_get_stats_cb)(struct accel_stats *stats, void *cb_arg);
43 int accel_get_stats(accel_get_stats_cb cb_fn, void *cb_arg);
44 
45 #endif
46