xref: /spdk/lib/accel/accel_internal.h (revision 12fbe739a31b09aff0d05f354d4f3bbef99afc55)
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 spdk_accel_opcode ops[SPDK_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[SPDK_ACCEL_OPC_LAST];
33 	uint64_t			sequence_executed;
34 	uint64_t			sequence_failed;
35 
36 	struct {
37 		uint64_t task;
38 		uint64_t sequence;
39 		uint64_t iobuf;
40 		uint64_t bufdesc;
41 	} retry;
42 };
43 
44 typedef void (*_accel_for_each_module_fn)(struct module_info *info);
45 void _accel_for_each_module(struct module_info *info, _accel_for_each_module_fn fn);
46 int _accel_get_opc_name(enum spdk_accel_opcode opcode, const char **opcode_name);
47 void _accel_crypto_key_dump_param(struct spdk_json_write_ctx *w, struct spdk_accel_crypto_key *key);
48 void _accel_crypto_keys_dump_param(struct spdk_json_write_ctx *w);
49 typedef void (*accel_get_stats_cb)(struct accel_stats *stats, void *cb_arg);
50 int accel_get_stats(accel_get_stats_cb cb_fn, void *cb_arg);
51 
52 #endif
53