532fb964e5bdca1c2b1758f72155e9f3899e9bf3
[dpdk.git] / app / test-compress-perf / comp_perf_options.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation
3  */
4
5 #ifndef _COMP_PERF_OPS_
6 #define _COMP_PERF_OPS_
7
8 #define MAX_DRIVER_NAME         64
9 #define MAX_INPUT_FILE_NAME     64
10 #define MAX_LIST                32
11 #define MIN_COMPRESSED_BUF_SIZE 8
12 #define EXPANSE_RATIO 1.05
13 #define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
14 #define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
15
16 extern const char *cperf_test_type_strs[];
17
18 /* Cleanup state machine */
19 enum cleanup_st {
20         ST_CLEAR = 0,
21         ST_TEST_DATA,
22         ST_COMPDEV,
23         ST_INPUT_DATA,
24         ST_MEMORY_ALLOC,
25         ST_DURING_TEST
26 };
27
28 enum cperf_perf_test_type {
29         CPERF_TEST_TYPE_BENCHMARK,
30         CPERF_TEST_TYPE_VERIFY
31 };
32
33 enum comp_operation {
34         COMPRESS_ONLY,
35         DECOMPRESS_ONLY,
36         COMPRESS_DECOMPRESS
37 };
38
39 struct range_list {
40         uint8_t min;
41         uint8_t max;
42         uint8_t inc;
43         uint8_t count;
44         uint8_t list[MAX_LIST];
45 };
46
47 struct comp_test_data {
48         char driver_name[64];
49         char input_file[64];
50         enum cperf_perf_test_type test;
51
52         uint8_t *input_data;
53         size_t input_data_sz;
54         uint16_t nb_qps;
55         uint16_t seg_sz;
56         uint16_t out_seg_sz;
57         uint16_t burst_sz;
58         uint32_t pool_sz;
59         uint32_t num_iter;
60         uint16_t max_sgl_segs;
61
62         enum rte_comp_huffman huffman_enc;
63         enum comp_operation test_op;
64         int window_sz;
65         struct range_list level_lst;
66         uint8_t level;
67
68         double ratio;
69         enum cleanup_st cleanup;
70         int perf_comp_force_stop;
71 };
72
73 int
74 comp_perf_options_parse(struct comp_test_data *test_data, int argc,
75                         char **argv);
76
77 void
78 comp_perf_options_default(struct comp_test_data *test_data);
79
80 int
81 comp_perf_options_check(struct comp_test_data *test_data);
82
83 #endif