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_LIST		32
9 #define MIN_COMPRESSED_BUF_SIZE 8
10 #define EXPANSE_RATIO 1.1
11 #define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM)
12 #define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO))
13 
14 extern const char *cperf_test_type_strs[];
15 
16 /* Cleanup state machine */
17 enum cleanup_st {
18 	ST_CLEAR = 0,
19 	ST_TEST_DATA,
20 	ST_COMPDEV,
21 	ST_INPUT_DATA,
22 	ST_MEMORY_ALLOC,
23 	ST_DURING_TEST
24 };
25 
26 enum cperf_test_type {
27 	CPERF_TEST_TYPE_BENCHMARK,
28 	CPERF_TEST_TYPE_VERIFY
29 };
30 
31 enum comp_operation {
32 	COMPRESS_ONLY,
33 	DECOMPRESS_ONLY,
34 	COMPRESS_DECOMPRESS
35 };
36 
37 struct range_list {
38 	uint8_t min;
39 	uint8_t max;
40 	uint8_t inc;
41 	uint8_t count;
42 	uint8_t list[MAX_LIST];
43 };
44 
45 struct comp_test_data {
46 	char driver_name[RTE_DEV_NAME_MAX_LEN];
47 	char input_file[PATH_MAX];
48 	enum cperf_test_type test;
49 
50 	uint8_t *input_data;
51 	size_t input_data_sz;
52 	uint16_t nb_qps;
53 	uint16_t seg_sz;
54 	uint16_t out_seg_sz;
55 	uint16_t burst_sz;
56 	uint32_t pool_sz;
57 	uint32_t num_iter;
58 	uint16_t max_sgl_segs;
59 
60 	enum rte_comp_huffman huffman_enc;
61 	enum comp_operation test_op;
62 	int window_sz;
63 	struct range_list level_lst;
64 	uint8_t level;
65 
66 	double ratio;
67 	enum cleanup_st cleanup;
68 	int perf_comp_force_stop;
69 };
70 
71 int
72 comp_perf_options_parse(struct comp_test_data *test_data, int argc,
73 			char **argv);
74 
75 void
76 comp_perf_options_default(struct comp_test_data *test_data);
77 
78 int
79 comp_perf_options_check(struct comp_test_data *test_data);
80 
81 #endif
82