xref: /spdk/lib/accel/accel_internal.h (revision c65983c9f2000473107a4a5e01f98c1563e7334a)
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 	uint32_t			sequence_outstanding;
36 	uint32_t			task_outstanding;
37 
38 	struct {
39 		uint64_t task;
40 		uint64_t sequence;
41 		uint64_t iobuf;
42 		uint64_t bufdesc;
43 	} retry;
44 };
45 
46 typedef void (*_accel_for_each_module_fn)(struct module_info *info);
47 void _accel_for_each_module(struct module_info *info, _accel_for_each_module_fn fn);
48 void _accel_crypto_key_dump_param(struct spdk_json_write_ctx *w, struct spdk_accel_crypto_key *key);
49 void _accel_crypto_keys_dump_param(struct spdk_json_write_ctx *w);
50 typedef void (*accel_get_stats_cb)(struct accel_stats *stats, void *cb_arg);
51 int accel_get_stats(accel_get_stats_cb cb_fn, void *cb_arg);
52 
53 #endif
54