* The main compression function. * * Function performs compression operation. * Operation(s) configuration, depending on CLI parameters. * Operation(s) processing. * * @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 container used for aggregation a
| 1186 | * - -1: On error. |
| 1187 | */ |
| 1188 | static int |
| 1189 | test_deflate_comp_run(const struct interim_data_params *int_data, |
| 1190 | const struct test_data_params *test_data, |
| 1191 | const struct test_private_arrays *test_priv_data) |
| 1192 | { |
| 1193 | /* local variables: */ |
| 1194 | struct priv_op_data *priv_data; |
| 1195 | unsigned int i; |
| 1196 | uint16_t num_priv_xforms = 0; |
| 1197 | int ret; |
| 1198 | int ret_status = 0; |
| 1199 | char *buf_ptr; |
| 1200 | |
| 1201 | struct comp_testsuite_params *ts_params = &testsuite_params; |
| 1202 | |
| 1203 | /* from test_data: */ |
| 1204 | enum rte_comp_op_type operation_type = test_data->compress_state; |
| 1205 | unsigned int zlib_compress = |
| 1206 | (test_data->zlib_dir == ZLIB_ALL || |
| 1207 | test_data->zlib_dir == ZLIB_COMPRESS); |
| 1208 | |
| 1209 | /* from int_data: */ |
| 1210 | struct rte_comp_xform **compress_xforms = int_data->compress_xforms; |
| 1211 | unsigned int num_xforms = int_data->num_xforms; |
| 1212 | unsigned int num_bufs = int_data->num_bufs; |
| 1213 | |
| 1214 | /* from test_priv_data: */ |
| 1215 | struct rte_mbuf **comp_bufs = test_priv_data->comp_bufs; |
| 1216 | struct rte_mbuf **uncomp_bufs = test_priv_data->uncomp_bufs; |
| 1217 | struct rte_comp_op **ops = test_priv_data->ops; |
| 1218 | struct rte_comp_op **ops_processed = test_priv_data->ops_processed; |
| 1219 | void **priv_xforms = test_priv_data->priv_xforms; |
| 1220 | |
| 1221 | const struct rte_compressdev_capabilities *capa = |
| 1222 | rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE); |
| 1223 | |
| 1224 | /* Build the compression operations */ |
| 1225 | ret = rte_comp_op_bulk_alloc(ts_params->op_pool, ops, num_bufs); |
| 1226 | if (ret < 0) { |
| 1227 | RTE_LOG(ERR, USER1, |
| 1228 | "Compress operations could not be allocated " |
| 1229 | "from the mempool\n"); |
| 1230 | ret_status = -1; |
| 1231 | goto exit; |
| 1232 | } |
| 1233 | |
| 1234 | for (i = 0; i < num_bufs; i++) { |
| 1235 | ops[i]->m_src = uncomp_bufs[i]; |
| 1236 | ops[i]->m_dst = comp_bufs[i]; |
| 1237 | ops[i]->src.offset = 0; |
| 1238 | ops[i]->src.length = rte_pktmbuf_pkt_len(uncomp_bufs[i]); |
| 1239 | ops[i]->dst.offset = 0; |
| 1240 | |
| 1241 | RTE_LOG(DEBUG, USER1, |
| 1242 | "Uncompressed buffer length = %u compressed buffer length = %u", |
| 1243 | rte_pktmbuf_pkt_len(uncomp_bufs[i]), |
| 1244 | rte_pktmbuf_pkt_len(comp_bufs[i])); |
| 1245 |
no test coverage detected