MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_setup_com_bufs

Function test_setup_com_bufs

dpdk/app/test/test_compressdev.c:849–956  ·  view source on GitHub ↗

* Arrays initialization. Input buffers preparation for compression. * * API that initializes all the private arrays to NULL * and allocates input buffers to perform compression operations. * * @param int_data * Interim data containing session/transformation objects. * @param test_data * The test parameters set by users (command line parameters). * @param test_priv_data * A containe

Source from the content-addressed store, hash-verified

847 * - -1: On error.
848 */
849static int
850test_setup_com_bufs(const struct interim_data_params *int_data,
851 const struct test_data_params *test_data,
852 const struct test_private_arrays *test_priv_data)
853{
854 /* local variables: */
855 unsigned int i;
856 uint32_t data_size;
857 char *buf_ptr;
858 int ret;
859 char **all_decomp_data = test_priv_data->all_decomp_data;
860
861 struct comp_testsuite_params *ts_params = &testsuite_params;
862
863 /* from int_data: */
864 const char * const *test_bufs = int_data->test_bufs;
865 unsigned int num_bufs = int_data->num_bufs;
866
867 /* from test_data: */
868 unsigned int buff_type = test_data->buff_type;
869 unsigned int big_data = test_data->big_data;
870
871 /* from test_priv_data: */
872 struct rte_mbuf **uncomp_bufs = test_priv_data->uncomp_bufs;
873 struct rte_mempool *buf_pool;
874
875 static struct rte_mbuf_ext_shared_info inbuf_info;
876
877 size_t array_size = sizeof(void *) * num_bufs;
878
879 /* Initialize all arrays to NULL */
880 memset(test_priv_data->uncomp_bufs, 0, array_size);
881 memset(test_priv_data->comp_bufs, 0, array_size);
882 memset(test_priv_data->ops, 0, array_size);
883 memset(test_priv_data->ops_processed, 0, array_size);
884 memset(test_priv_data->priv_xforms, 0, array_size);
885 memset(test_priv_data->compressed_data_size,
886 0, sizeof(uint32_t) * num_bufs);
887
888 if (test_data->decompress_state == RTE_COMP_OP_STATEFUL) {
889 data_size = strlen(test_bufs[0]) + 1;
890 *all_decomp_data = rte_malloc(NULL, data_size,
891 RTE_CACHE_LINE_SIZE);
892 }
893
894 if (big_data)
895 buf_pool = ts_params->big_mbuf_pool;
896 else if (buff_type == SGL_BOTH)
897 buf_pool = ts_params->small_mbuf_pool;
898 else
899 buf_pool = ts_params->large_mbuf_pool;
900
901 /* for compression uncomp_bufs is used as a source buffer */
902 /* allocation from buf_pool (mempool type) */
903 ret = rte_pktmbuf_alloc_bulk(buf_pool,
904 uncomp_bufs, num_bufs);
905 if (ret < 0) {
906 RTE_LOG(ERR, USER1,

Callers 1

test_deflate_comp_decompFunction · 0.85

Calls 8

memsetFunction · 0.85
rte_mallocFunction · 0.85
rte_pktmbuf_alloc_bulkFunction · 0.85
rte_mbuf_ext_refcnt_setFunction · 0.85
rte_pktmbuf_appendFunction · 0.85
prepare_sgl_bufsFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected