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 *comp_perf_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 uint32_t total_segs; 60 61 enum rte_comp_huffman huffman_enc; 62 enum comp_operation test_op; 63 int window_sz; 64 struct range_list level_lst; 65 uint8_t level; 66 int use_external_mbufs; 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 84