1e0b6287cSTomasz Jozwiak /* SPDX-License-Identifier: BSD-3-Clause 2e0b6287cSTomasz Jozwiak * Copyright(c) 2018 Intel Corporation 3e0b6287cSTomasz Jozwiak */ 4e0b6287cSTomasz Jozwiak 50bf1e98fSTomasz Jozwiak #ifndef _COMP_PERF_OPS_ 60bf1e98fSTomasz Jozwiak #define _COMP_PERF_OPS_ 70bf1e98fSTomasz Jozwiak 8770ebc06SDavid Marchand #include <rte_dev.h> 9770ebc06SDavid Marchand 10e0b6287cSTomasz Jozwiak #define MAX_LIST 32 1127cee417STomasz Jozwiak #define MIN_COMPRESSED_BUF_SIZE 8 12971d89f5SAdam Dybkowski #define EXPANSE_RATIO 1.1 1327cee417STomasz Jozwiak #define MAX_MBUF_DATA_SIZE (UINT16_MAX - RTE_PKTMBUF_HEADROOM) 1427cee417STomasz Jozwiak #define MAX_SEG_SIZE ((int)(MAX_MBUF_DATA_SIZE / EXPANSE_RATIO)) 15e0b6287cSTomasz Jozwiak 164fba6df9SLavanya Govindarajan extern const char *comp_perf_test_type_strs[]; 17424dd6c8STomasz Jozwiak 18424dd6c8STomasz Jozwiak /* Cleanup state machine */ 19424dd6c8STomasz Jozwiak enum cleanup_st { 20424dd6c8STomasz Jozwiak ST_CLEAR = 0, 21424dd6c8STomasz Jozwiak ST_TEST_DATA, 22424dd6c8STomasz Jozwiak ST_COMPDEV, 23424dd6c8STomasz Jozwiak ST_INPUT_DATA, 24424dd6c8STomasz Jozwiak ST_MEMORY_ALLOC, 25424dd6c8STomasz Jozwiak ST_DURING_TEST 26424dd6c8STomasz Jozwiak }; 27424dd6c8STomasz Jozwiak 288c7a3131SArtur Trybula enum cperf_test_type { 292695db95SArtur Trybula CPERF_TEST_TYPE_THROUGHPUT, 302695db95SArtur Trybula CPERF_TEST_TYPE_VERIFY, 312695db95SArtur Trybula CPERF_TEST_TYPE_PMDCC 32424dd6c8STomasz Jozwiak }; 33424dd6c8STomasz Jozwiak 34e0b6287cSTomasz Jozwiak enum comp_operation { 3583cc3b90SMichael Baum COMPRESS = (1 << 0), 3683cc3b90SMichael Baum DECOMPRESS = (1 << 1), 3783cc3b90SMichael Baum COMPRESS_DECOMPRESS = (COMPRESS | DECOMPRESS), 38e0b6287cSTomasz Jozwiak }; 39e0b6287cSTomasz Jozwiak 40e0b6287cSTomasz Jozwiak struct range_list { 41e0b6287cSTomasz Jozwiak uint8_t min; 42e0b6287cSTomasz Jozwiak uint8_t max; 43e0b6287cSTomasz Jozwiak uint8_t inc; 44e0b6287cSTomasz Jozwiak uint8_t count; 45e0b6287cSTomasz Jozwiak uint8_t list[MAX_LIST]; 46e0b6287cSTomasz Jozwiak }; 47e0b6287cSTomasz Jozwiak 48e0b6287cSTomasz Jozwiak struct comp_test_data { 498c7a3131SArtur Trybula char driver_name[RTE_DEV_NAME_MAX_LEN]; 508c7a3131SArtur Trybula char input_file[PATH_MAX]; 518c7a3131SArtur Trybula enum cperf_test_type test; 52424dd6c8STomasz Jozwiak 53e0b6287cSTomasz Jozwiak uint8_t *input_data; 54e0b6287cSTomasz Jozwiak size_t input_data_sz; 55424dd6c8STomasz Jozwiak uint16_t nb_qps; 56e0b6287cSTomasz Jozwiak uint16_t seg_sz; 5727cee417STomasz Jozwiak uint16_t out_seg_sz; 58e0b6287cSTomasz Jozwiak uint16_t burst_sz; 59e0b6287cSTomasz Jozwiak uint32_t pool_sz; 60e0b6287cSTomasz Jozwiak uint32_t num_iter; 61e0b6287cSTomasz Jozwiak uint16_t max_sgl_segs; 62c02e33b0SAdam Dybkowski uint32_t total_segs; 63424dd6c8STomasz Jozwiak 64*72c64a34SMichael Baum uint8_t lz4_flags; 65e0b6287cSTomasz Jozwiak enum rte_comp_huffman huffman_enc; 66e0b6287cSTomasz Jozwiak enum comp_operation test_op; 67*72c64a34SMichael Baum enum rte_comp_algorithm test_algo; 68*72c64a34SMichael Baum 69e0b6287cSTomasz Jozwiak int window_sz; 70424dd6c8STomasz Jozwiak struct range_list level_lst; 71424dd6c8STomasz Jozwiak uint8_t level; 72c02e33b0SAdam Dybkowski int use_external_mbufs; 73424dd6c8STomasz Jozwiak 740bf1e98fSTomasz Jozwiak double ratio; 75424dd6c8STomasz Jozwiak enum cleanup_st cleanup; 76d6cec113STomasz Jozwiak int perf_comp_force_stop; 772695db95SArtur Trybula 782695db95SArtur Trybula uint32_t cyclecount_delay; 79e0b6287cSTomasz Jozwiak }; 80e0b6287cSTomasz Jozwiak 81e0b6287cSTomasz Jozwiak int 82e0b6287cSTomasz Jozwiak comp_perf_options_parse(struct comp_test_data *test_data, int argc, 83e0b6287cSTomasz Jozwiak char **argv); 84e0b6287cSTomasz Jozwiak 85e0b6287cSTomasz Jozwiak void 86e0b6287cSTomasz Jozwiak comp_perf_options_default(struct comp_test_data *test_data); 87e0b6287cSTomasz Jozwiak 88e0b6287cSTomasz Jozwiak int 89e0b6287cSTomasz Jozwiak comp_perf_options_check(struct comp_test_data *test_data); 900bf1e98fSTomasz Jozwiak 910bf1e98fSTomasz Jozwiak #endif 92