Skip to content

Commit

Permalink
app/compress-perf: fix remaining data for ops
Browse files Browse the repository at this point in the history
[ upstream commit cf8c0c65514a12d4f326417f7cf54433338ed226 ]

Individual variables are needed for tracking the remaining data for
compression and decompression.

Fixes: 83cc3b90ad7a ("app/compress-perf: fix testing single operation")

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
  • Loading branch information
arekk67 authored and bluca committed Mar 21, 2023
1 parent 4451959 commit 80f678d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions app/test-compress-perf/comp_perf_test_common.c
Expand Up @@ -366,6 +366,7 @@ int
prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
{
uint32_t remaining_data = test_data->input_data_sz;
uint32_t remaining_data_decomp = test_data->input_data_sz;
uint8_t *input_data_ptr = test_data->input_data;
size_t data_sz = 0;
uint8_t *data_addr;
Expand Down Expand Up @@ -482,7 +483,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
}

if (decompress_only)
data_sz = RTE_MIN(remaining_data, test_data->seg_sz);
data_sz = RTE_MIN(remaining_data_decomp, test_data->seg_sz);
else
data_sz = test_data->out_seg_sz;

Expand All @@ -496,11 +497,11 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
if (decompress_only) {
rte_memcpy(data_addr, input_data_ptr, data_sz);
input_data_ptr += data_sz;
remaining_data -= data_sz;
remaining_data_decomp -= data_sz;
}

/* Chain mbufs if needed for output mbufs */
for (j = 1; j < segs_per_mbuf && remaining_data > 0; j++) {
for (j = 1; j < segs_per_mbuf && remaining_data_decomp > 0; j++) {
struct rte_mbuf *next_seg =
rte_pktmbuf_alloc(mem->comp_buf_pool);

Expand All @@ -521,7 +522,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
}

if (decompress_only)
data_sz = RTE_MIN(remaining_data,
data_sz = RTE_MIN(remaining_data_decomp,
test_data->seg_sz);
else
data_sz = test_data->out_seg_sz;
Expand All @@ -536,7 +537,7 @@ prepare_bufs(struct comp_test_data *test_data, struct cperf_mem_resources *mem)
if (decompress_only) {
rte_memcpy(data_addr, input_data_ptr, data_sz);
input_data_ptr += data_sz;
remaining_data -= data_sz;
remaining_data_decomp -= data_sz;
}

if (rte_pktmbuf_chain(mem->comp_bufs[i],
Expand Down

0 comments on commit 80f678d

Please sign in to comment.