* Prints out the test report. Memory freeing. * * Called after successful compression. * Operation(s) status validation and decompression buffers freeing. * -1 returned if function fail. * * @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
| 1400 | * - -1: On error. |
| 1401 | */ |
| 1402 | static int |
| 1403 | test_deflate_comp_finalize(const struct interim_data_params *int_data, |
| 1404 | const struct test_data_params *test_data, |
| 1405 | const struct test_private_arrays *test_priv_data) |
| 1406 | { |
| 1407 | /* local variables: */ |
| 1408 | unsigned int i; |
| 1409 | struct priv_op_data *priv_data; |
| 1410 | |
| 1411 | /* from int_data: */ |
| 1412 | unsigned int num_xforms = int_data->num_xforms; |
| 1413 | struct rte_comp_xform **compress_xforms = int_data->compress_xforms; |
| 1414 | unsigned int num_bufs = int_data->num_bufs; |
| 1415 | |
| 1416 | /* from test_priv_data: */ |
| 1417 | struct rte_comp_op **ops_processed = test_priv_data->ops_processed; |
| 1418 | uint64_t *compress_checksum = test_priv_data->compress_checksum; |
| 1419 | struct rte_mbuf **uncomp_bufs = test_priv_data->uncomp_bufs; |
| 1420 | struct rte_comp_op **ops = test_priv_data->ops; |
| 1421 | |
| 1422 | /* from test_data: */ |
| 1423 | unsigned int out_of_space = test_data->out_of_space; |
| 1424 | unsigned int zlib_compress = |
| 1425 | (test_data->zlib_dir == ZLIB_ALL || |
| 1426 | test_data->zlib_dir == ZLIB_COMPRESS); |
| 1427 | unsigned int zlib_decompress = |
| 1428 | (test_data->zlib_dir == ZLIB_ALL || |
| 1429 | test_data->zlib_dir == ZLIB_DECOMPRESS); |
| 1430 | |
| 1431 | for (i = 0; i < num_bufs; i++) { |
| 1432 | priv_data = (struct priv_op_data *)(ops_processed[i] + 1); |
| 1433 | uint16_t xform_idx = priv_data->orig_idx % num_xforms; |
| 1434 | const struct rte_comp_compress_xform *compress_xform = |
| 1435 | &compress_xforms[xform_idx]->compress; |
| 1436 | enum rte_comp_huffman huffman_type = |
| 1437 | compress_xform->deflate.huffman; |
| 1438 | char engine[] = "zlib (directly, not PMD)"; |
| 1439 | if (zlib_decompress) |
| 1440 | strlcpy(engine, "PMD", sizeof(engine)); |
| 1441 | |
| 1442 | RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to" |
| 1443 | " %u bytes (level = %d, huffman = %s)\n", |
| 1444 | i, engine, |
| 1445 | ops_processed[i]->consumed, ops_processed[i]->produced, |
| 1446 | compress_xform->level, |
| 1447 | huffman_type_strings[huffman_type]); |
| 1448 | RTE_LOG(DEBUG, USER1, "Compression ratio = %.2f\n", |
| 1449 | ops_processed[i]->consumed == 0 ? 0 : |
| 1450 | (float)ops_processed[i]->produced / |
| 1451 | ops_processed[i]->consumed * 100); |
| 1452 | if (compress_xform->chksum != RTE_COMP_CHECKSUM_NONE) |
| 1453 | compress_checksum[i] = ops_processed[i]->output_chksum; |
| 1454 | ops[i] = NULL; |
| 1455 | } |
| 1456 | |
| 1457 | /* |
| 1458 | * Check operation status and free source mbufs (destination mbuf and |
| 1459 | * compress operation information is needed for the decompression stage) |
no test coverage detected