613d6d31e2df5c4aeda1e07b5e5f33094d0108ac
[dpdk.git] / app / test-crypto-perf / cperf_options.h
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_OUT_OF_PLACE      ("out-of-place")
31 #define CPERF_TEST_FILE         ("test-file")
32 #define CPERF_TEST_NAME         ("test-name")
33
34 #define CPERF_CIPHER_ALGO       ("cipher-algo")
35 #define CPERF_CIPHER_OP         ("cipher-op")
36 #define CPERF_CIPHER_KEY_SZ     ("cipher-key-sz")
37 #define CPERF_CIPHER_IV_SZ      ("cipher-iv-sz")
38
39 #define CPERF_AUTH_ALGO         ("auth-algo")
40 #define CPERF_AUTH_OP           ("auth-op")
41 #define CPERF_AUTH_KEY_SZ       ("auth-key-sz")
42 #define CPERF_AUTH_IV_SZ        ("auth-iv-sz")
43
44 #define CPERF_AEAD_ALGO         ("aead-algo")
45 #define CPERF_AEAD_OP           ("aead-op")
46 #define CPERF_AEAD_KEY_SZ       ("aead-key-sz")
47 #define CPERF_AEAD_IV_SZ        ("aead-iv-sz")
48 #define CPERF_AEAD_AAD_SZ       ("aead-aad-sz")
49
50 #define CPERF_DIGEST_SZ         ("digest-sz")
51
52 #ifdef RTE_LIB_SECURITY
53 #define CPERF_PDCP_SN_SZ        ("pdcp-sn-sz")
54 #define CPERF_PDCP_DOMAIN       ("pdcp-domain")
55 #define CPERF_PDCP_SES_HFN_EN   ("pdcp-ses-hfn-en")
56 #define PDCP_DEFAULT_HFN        0x1
57 #define CPERF_DOCSIS_HDR_SZ     ("docsis-hdr-sz")
58 #endif
59
60 #define CPERF_CSV               ("csv-friendly")
61
62 /* benchmark-specific options */
63 #define CPERF_PMDCC_DELAY_MS    ("pmd-cyclecount-delay-ms")
64
65 #define MAX_LIST 32
66
67 enum cperf_perf_test_type {
68         CPERF_TEST_TYPE_THROUGHPUT,
69         CPERF_TEST_TYPE_LATENCY,
70         CPERF_TEST_TYPE_VERIFY,
71         CPERF_TEST_TYPE_PMDCC
72 };
73
74
75 extern const char *cperf_test_type_strs[];
76
77 enum cperf_op_type {
78         CPERF_CIPHER_ONLY = 1,
79         CPERF_AUTH_ONLY,
80         CPERF_CIPHER_THEN_AUTH,
81         CPERF_AUTH_THEN_CIPHER,
82         CPERF_AEAD,
83         CPERF_PDCP,
84         CPERF_DOCSIS,
85         CPERF_IPSEC,
86         CPERF_ASYM_MODEX
87 };
88
89 extern const char *cperf_op_type_strs[];
90
91 struct cperf_options {
92         enum cperf_perf_test_type test;
93
94         uint32_t pool_sz;
95         uint32_t total_ops;
96         uint32_t headroom_sz;
97         uint32_t tailroom_sz;
98         uint32_t segment_sz;
99         uint32_t test_buffer_size;
100         uint32_t *imix_buffer_sizes;
101         uint32_t nb_descriptors;
102         uint16_t nb_qps;
103
104         uint32_t sessionless:1;
105         uint32_t out_of_place:1;
106         uint32_t silent:1;
107         uint32_t csv:1;
108
109         enum rte_crypto_cipher_algorithm cipher_algo;
110         enum rte_crypto_cipher_operation cipher_op;
111
112         uint16_t cipher_key_sz;
113         uint16_t cipher_iv_sz;
114
115         enum rte_crypto_auth_algorithm auth_algo;
116         enum rte_crypto_auth_operation auth_op;
117
118         uint16_t auth_key_sz;
119         uint16_t auth_iv_sz;
120
121         enum rte_crypto_aead_algorithm aead_algo;
122         enum rte_crypto_aead_operation aead_op;
123
124         uint16_t aead_key_sz;
125         uint16_t aead_iv_sz;
126         uint16_t aead_aad_sz;
127
128         uint16_t digest_sz;
129
130 #ifdef RTE_LIB_SECURITY
131         uint16_t pdcp_sn_sz;
132         uint16_t pdcp_ses_hfn_en;
133         uint16_t pdcp_sdap;
134         enum rte_security_pdcp_domain pdcp_domain;
135         uint16_t docsis_hdr_sz;
136 #endif
137         char device_type[RTE_CRYPTODEV_NAME_MAX_LEN];
138         enum cperf_op_type op_type;
139
140         char *test_file;
141         char *test_name;
142
143         uint32_t buffer_size_list[MAX_LIST];
144         uint8_t buffer_size_count;
145         uint32_t max_buffer_size;
146         uint32_t min_buffer_size;
147         uint32_t inc_buffer_size;
148
149         uint32_t burst_size_list[MAX_LIST];
150         uint8_t burst_size_count;
151         uint32_t max_burst_size;
152         uint32_t min_burst_size;
153         uint32_t inc_burst_size;
154
155         /* pmd-cyclecount specific options */
156         uint32_t pmdcc_delay;
157         uint32_t imix_distribution_list[MAX_LIST];
158         uint8_t imix_distribution_count;
159         struct cperf_modex_test_data *modex_data;
160         uint16_t modex_len;
161 };
162
163 void
164 cperf_options_default(struct cperf_options *options);
165
166 int
167 cperf_options_parse(struct cperf_options *options,
168                 int argc, char **argv);
169
170 int
171 cperf_options_check(struct cperf_options *options);
172
173 void
174 cperf_options_dump(struct cperf_options *options);
175
176 #endif