xref: /dpdk/app/test-crypto-perf/cperf_options.h (revision 981a1ed32a7920bf0f5e2864ab1f78c296bdfaec)
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 #ifdef RTE_LIB_SECURITY
11 #include <rte_security.h>
12 #endif
13 
14 #define CPERF_PTEST_TYPE	("ptest")
15 #define CPERF_MODEX_LEN		("modex-len")
16 #define CPERF_SILENT		("silent")
17 #define CPERF_ENABLE_SDAP	("enable-sdap")
18 
19 #define CPERF_POOL_SIZE		("pool-sz")
20 #define CPERF_TOTAL_OPS		("total-ops")
21 #define CPERF_BURST_SIZE	("burst-sz")
22 #define CPERF_BUFFER_SIZE	("buffer-sz")
23 #define CPERF_SEGMENT_SIZE	("segment-sz")
24 #define CPERF_DESC_NB		("desc-nb")
25 #define CPERF_IMIX		("imix")
26 
27 #define CPERF_DEVTYPE		("devtype")
28 #define CPERF_OPTYPE		("optype")
29 #define CPERF_SESSIONLESS	("sessionless")
30 #define CPERF_SHARED_SESSION	("shared-session")
31 #define CPERF_OUT_OF_PLACE	("out-of-place")
32 #define CPERF_TEST_FILE		("test-file")
33 #define CPERF_TEST_NAME		("test-name")
34 
35 #define CPERF_LOW_PRIO_QP_MASK	("low-prio-qp-mask")
36 
37 #define CPERF_CIPHER_ALGO	("cipher-algo")
38 #define CPERF_CIPHER_OP		("cipher-op")
39 #define CPERF_CIPHER_KEY_SZ	("cipher-key-sz")
40 #define CPERF_CIPHER_IV_SZ	("cipher-iv-sz")
41 
42 #define CPERF_AUTH_ALGO		("auth-algo")
43 #define CPERF_AUTH_OP		("auth-op")
44 #define CPERF_AUTH_KEY_SZ	("auth-key-sz")
45 #define CPERF_AUTH_IV_SZ	("auth-iv-sz")
46 
47 #define CPERF_AEAD_ALGO		("aead-algo")
48 #define CPERF_AEAD_OP		("aead-op")
49 #define CPERF_AEAD_KEY_SZ	("aead-key-sz")
50 #define CPERF_AEAD_IV_SZ	("aead-iv-sz")
51 #define CPERF_AEAD_AAD_SZ	("aead-aad-sz")
52 
53 #define CPERF_DIGEST_SZ		("digest-sz")
54 
55 #define CPERF_ASYM_OP		("asym-op")
56 
57 #ifdef RTE_LIB_SECURITY
58 #define CPERF_PDCP_SN_SZ	("pdcp-sn-sz")
59 #define CPERF_PDCP_DOMAIN	("pdcp-domain")
60 #define CPERF_PDCP_SES_HFN_EN	("pdcp-ses-hfn-en")
61 #define PDCP_DEFAULT_HFN	0x1
62 #define CPERF_DOCSIS_HDR_SZ	("docsis-hdr-sz")
63 #define CPERF_TLS_VERSION	("tls-version")
64 #endif
65 
66 #define CPERF_CSV		("csv-friendly")
67 
68 /* benchmark-specific options */
69 #define CPERF_PMDCC_DELAY_MS	("pmd-cyclecount-delay-ms")
70 
71 #define MAX_LIST 32
72 
73 enum cperf_perf_test_type {
74 	CPERF_TEST_TYPE_THROUGHPUT,
75 	CPERF_TEST_TYPE_LATENCY,
76 	CPERF_TEST_TYPE_VERIFY,
77 	CPERF_TEST_TYPE_PMDCC
78 };
79 
80 
81 extern const char *cperf_test_type_strs[];
82 
83 enum cperf_op_type {
84 	CPERF_CIPHER_ONLY = 1,
85 	CPERF_AUTH_ONLY,
86 	CPERF_CIPHER_THEN_AUTH,
87 	CPERF_AUTH_THEN_CIPHER,
88 	CPERF_AEAD,
89 	CPERF_PDCP,
90 	CPERF_DOCSIS,
91 	CPERF_IPSEC,
92 	CPERF_ASYM_MODEX,
93 	CPERF_ASYM_SECP256R1,
94 	CPERF_ASYM_ED25519,
95 	CPERF_ASYM_SM2,
96 	CPERF_TLS,
97 };
98 
99 extern const char *cperf_op_type_strs[];
100 
101 struct cperf_options {
102 	enum cperf_perf_test_type test;
103 
104 	uint32_t pool_sz;
105 	uint32_t total_ops;
106 	uint32_t headroom_sz;
107 	uint32_t tailroom_sz;
108 	uint32_t segment_sz;
109 	uint32_t test_buffer_size;
110 	uint32_t *imix_buffer_sizes;
111 	uint32_t nb_descriptors;
112 	uint16_t nb_qps;
113 	uint64_t low_prio_qp_mask;
114 
115 	uint32_t sessionless:1;
116 	uint32_t shared_session:1;
117 	uint32_t out_of_place:1;
118 	uint32_t silent:1;
119 	uint32_t csv:1;
120 	uint32_t is_outbound:1;
121 
122 	enum rte_crypto_cipher_algorithm cipher_algo;
123 	enum rte_crypto_cipher_operation cipher_op;
124 
125 	uint16_t cipher_key_sz;
126 	uint16_t cipher_iv_sz;
127 
128 	enum rte_crypto_auth_algorithm auth_algo;
129 	enum rte_crypto_auth_operation auth_op;
130 
131 	uint16_t auth_key_sz;
132 	uint16_t auth_iv_sz;
133 
134 	enum rte_crypto_aead_algorithm aead_algo;
135 	enum rte_crypto_aead_operation aead_op;
136 
137 	uint16_t aead_key_sz;
138 	uint16_t aead_iv_sz;
139 	uint16_t aead_aad_sz;
140 
141 	uint16_t digest_sz;
142 
143 #ifdef RTE_LIB_SECURITY
144 	uint16_t pdcp_sn_sz;
145 	uint16_t pdcp_ses_hfn_en;
146 	uint16_t pdcp_sdap;
147 	enum rte_security_pdcp_domain pdcp_domain;
148 	uint16_t docsis_hdr_sz;
149 	enum rte_security_tls_version tls_version;
150 #endif
151 	char device_type[RTE_CRYPTODEV_NAME_MAX_LEN];
152 	enum cperf_op_type op_type;
153 
154 	char *test_file;
155 	char *test_name;
156 
157 	uint32_t buffer_size_list[MAX_LIST];
158 	uint8_t buffer_size_count;
159 	uint32_t max_buffer_size;
160 	uint32_t min_buffer_size;
161 	uint32_t inc_buffer_size;
162 
163 	uint32_t burst_size_list[MAX_LIST];
164 	uint8_t burst_size_count;
165 	uint32_t max_burst_size;
166 	uint32_t min_burst_size;
167 	uint32_t inc_burst_size;
168 
169 	/* pmd-cyclecount specific options */
170 	uint32_t pmdcc_delay;
171 	uint32_t imix_distribution_list[MAX_LIST];
172 	uint8_t imix_distribution_count;
173 	struct cperf_modex_test_data *modex_data;
174 	uint16_t modex_len;
175 	struct cperf_ecdsa_test_data *secp256r1_data;
176 	struct cperf_eddsa_test_data *eddsa_data;
177 	struct cperf_sm2_test_data *sm2_data;
178 	enum rte_crypto_asym_op_type asym_op_type;
179 	enum rte_crypto_auth_algorithm asym_hash_alg;
180 };
181 
182 void
183 cperf_options_default(struct cperf_options *options);
184 
185 int
186 cperf_options_parse(struct cperf_options *options,
187 		int argc, char **argv);
188 
189 int
190 cperf_options_check(struct cperf_options *options);
191 
192 void
193 cperf_options_dump(struct cperf_options *options);
194 
195 #endif
196