1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4 
5 #ifndef _CPERF_OPTIONS_
6 #define _CPERF_OPTIONS_
7 
8 #include <rte_crypto.h>
9 #include <rte_cryptodev.h>
10 
11 #define CPERF_PTEST_TYPE	("ptest")
12 #define CPERF_SILENT		("silent")
13 
14 #define CPERF_POOL_SIZE		("pool-sz")
15 #define CPERF_TOTAL_OPS		("total-ops")
16 #define CPERF_BURST_SIZE	("burst-sz")
17 #define CPERF_BUFFER_SIZE	("buffer-sz")
18 #define CPERF_SEGMENT_SIZE	("segment-sz")
19 #define CPERF_DESC_NB		("desc-nb")
20 #define CPERF_IMIX		("imix")
21 
22 #define CPERF_DEVTYPE		("devtype")
23 #define CPERF_OPTYPE		("optype")
24 #define CPERF_SESSIONLESS	("sessionless")
25 #define CPERF_OUT_OF_PLACE	("out-of-place")
26 #define CPERF_TEST_FILE		("test-file")
27 #define CPERF_TEST_NAME		("test-name")
28 
29 #define CPERF_CIPHER_ALGO	("cipher-algo")
30 #define CPERF_CIPHER_OP		("cipher-op")
31 #define CPERF_CIPHER_KEY_SZ	("cipher-key-sz")
32 #define CPERF_CIPHER_IV_SZ	("cipher-iv-sz")
33 
34 #define CPERF_AUTH_ALGO		("auth-algo")
35 #define CPERF_AUTH_OP		("auth-op")
36 #define CPERF_AUTH_KEY_SZ	("auth-key-sz")
37 #define CPERF_AUTH_IV_SZ	("auth-iv-sz")
38 
39 #define CPERF_AEAD_ALGO		("aead-algo")
40 #define CPERF_AEAD_OP		("aead-op")
41 #define CPERF_AEAD_KEY_SZ	("aead-key-sz")
42 #define CPERF_AEAD_IV_SZ	("aead-iv-sz")
43 #define CPERF_AEAD_AAD_SZ	("aead-aad-sz")
44 
45 #define CPERF_DIGEST_SZ		("digest-sz")
46 
47 #define CPERF_CSV		("csv-friendly")
48 
49 /* benchmark-specific options */
50 #define CPERF_PMDCC_DELAY_MS	("pmd-cyclecount-delay-ms")
51 
52 #define MAX_LIST 32
53 
54 enum cperf_perf_test_type {
55 	CPERF_TEST_TYPE_THROUGHPUT,
56 	CPERF_TEST_TYPE_LATENCY,
57 	CPERF_TEST_TYPE_VERIFY,
58 	CPERF_TEST_TYPE_PMDCC
59 };
60 
61 
62 extern const char *cperf_test_type_strs[];
63 
64 enum cperf_op_type {
65 	CPERF_CIPHER_ONLY = 1,
66 	CPERF_AUTH_ONLY,
67 	CPERF_CIPHER_THEN_AUTH,
68 	CPERF_AUTH_THEN_CIPHER,
69 	CPERF_AEAD
70 };
71 
72 extern const char *cperf_op_type_strs[];
73 
74 struct cperf_options {
75 	enum cperf_perf_test_type test;
76 
77 	uint32_t pool_sz;
78 	uint32_t total_ops;
79 	uint32_t headroom_sz;
80 	uint32_t tailroom_sz;
81 	uint32_t segment_sz;
82 	uint32_t test_buffer_size;
83 	uint32_t *imix_buffer_sizes;
84 	uint32_t nb_descriptors;
85 	uint16_t nb_qps;
86 
87 	uint32_t sessionless:1;
88 	uint32_t out_of_place:1;
89 	uint32_t silent:1;
90 	uint32_t csv:1;
91 
92 	enum rte_crypto_cipher_algorithm cipher_algo;
93 	enum rte_crypto_cipher_operation cipher_op;
94 
95 	uint16_t cipher_key_sz;
96 	uint16_t cipher_iv_sz;
97 
98 	enum rte_crypto_auth_algorithm auth_algo;
99 	enum rte_crypto_auth_operation auth_op;
100 
101 	uint16_t auth_key_sz;
102 	uint16_t auth_iv_sz;
103 
104 	enum rte_crypto_aead_algorithm aead_algo;
105 	enum rte_crypto_aead_operation aead_op;
106 
107 	uint16_t aead_key_sz;
108 	uint16_t aead_iv_sz;
109 	uint16_t aead_aad_sz;
110 
111 	uint16_t digest_sz;
112 
113 	char device_type[RTE_CRYPTODEV_NAME_MAX_LEN];
114 	enum cperf_op_type op_type;
115 
116 	char *test_file;
117 	char *test_name;
118 
119 	uint32_t buffer_size_list[MAX_LIST];
120 	uint8_t buffer_size_count;
121 	uint32_t max_buffer_size;
122 	uint32_t min_buffer_size;
123 	uint32_t inc_buffer_size;
124 
125 	uint32_t burst_size_list[MAX_LIST];
126 	uint8_t burst_size_count;
127 	uint32_t max_burst_size;
128 	uint32_t min_burst_size;
129 	uint32_t inc_burst_size;
130 
131 	/* pmd-cyclecount specific options */
132 	uint32_t pmdcc_delay;
133 	uint32_t imix_distribution_list[MAX_LIST];
134 	uint8_t imix_distribution_count;
135 };
136 
137 void
138 cperf_options_default(struct cperf_options *options);
139 
140 int
141 cperf_options_parse(struct cperf_options *options,
142 		int argc, char **argv);
143 
144 int
145 cperf_options_check(struct cperf_options *options);
146 
147 void
148 cperf_options_dump(struct cperf_options *options);
149 
150 #endif
151