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