* Memory buffers preparation (for both compression and decompression). * * Function allocates output buffers to perform compression * or decompression operations depending on value of op_type. * * @param op_type * Operation type: compress or decompress * @param out_of_space_and_zlib * Boolean value to switch into "out of space" buffer if set. * To test "out-of-space" data size, zlib
| 1053 | * - -1: On error. |
| 1054 | */ |
| 1055 | static int |
| 1056 | test_setup_output_bufs( |
| 1057 | enum operation_type op_type, |
| 1058 | unsigned int out_of_space_and_zlib, |
| 1059 | const struct test_private_arrays *test_priv_data, |
| 1060 | const struct interim_data_params *int_data, |
| 1061 | const struct test_data_params *test_data, |
| 1062 | struct rte_mbuf_ext_shared_info *current_extbuf_info) |
| 1063 | { |
| 1064 | /* local variables: */ |
| 1065 | unsigned int i; |
| 1066 | uint32_t data_size; |
| 1067 | int ret; |
| 1068 | char *buf_ptr; |
| 1069 | |
| 1070 | /* from test_priv_data: */ |
| 1071 | struct rte_mbuf **current_bufs; |
| 1072 | |
| 1073 | /* from int_data: */ |
| 1074 | unsigned int num_bufs = int_data->num_bufs; |
| 1075 | |
| 1076 | /* from test_data: */ |
| 1077 | unsigned int buff_type = test_data->buff_type; |
| 1078 | unsigned int big_data = test_data->big_data; |
| 1079 | const struct rte_memzone *current_memzone; |
| 1080 | |
| 1081 | struct comp_testsuite_params *ts_params = &testsuite_params; |
| 1082 | struct rte_mempool *buf_pool; |
| 1083 | |
| 1084 | if (big_data) |
| 1085 | buf_pool = ts_params->big_mbuf_pool; |
| 1086 | else if (buff_type == SGL_BOTH) |
| 1087 | buf_pool = ts_params->small_mbuf_pool; |
| 1088 | else |
| 1089 | buf_pool = ts_params->large_mbuf_pool; |
| 1090 | |
| 1091 | if (op_type == OPERATION_COMPRESSION) |
| 1092 | current_bufs = test_priv_data->comp_bufs; |
| 1093 | else |
| 1094 | current_bufs = test_priv_data->uncomp_bufs; |
| 1095 | |
| 1096 | /* the mbufs allocation*/ |
| 1097 | ret = rte_pktmbuf_alloc_bulk(buf_pool, current_bufs, num_bufs); |
| 1098 | if (ret < 0) { |
| 1099 | RTE_LOG(ERR, USER1, |
| 1100 | "Destination mbufs could not be allocated " |
| 1101 | "from the mempool\n"); |
| 1102 | return -1; |
| 1103 | } |
| 1104 | |
| 1105 | if (test_data->use_external_mbufs) { |
| 1106 | current_extbuf_info->free_cb = extbuf_free_callback; |
| 1107 | current_extbuf_info->fcb_opaque = NULL; |
| 1108 | rte_mbuf_ext_refcnt_set(current_extbuf_info, 1); |
| 1109 | if (op_type == OPERATION_COMPRESSION) |
| 1110 | current_memzone = test_data->compbuf_memzone; |
| 1111 | else |
| 1112 | current_memzone = test_data->uncompbuf_memzone; |
no test coverage detected