Skip to content

Commit

Permalink
app/crypto-perf: fix number of segments
Browse files Browse the repository at this point in the history
[ upstream commit e03ecc56edd72acb077e2b9bb95ae34f54172a0c ]

When segment size is provided, the total number of segments would be
calculated. Segment size updates due to headroom/tailroom need to be
accounted for when determining total number of segments required.

Fixes: c1670ae ("app/crypto-perf: honour min headroom/tailroom")

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
anoobj authored and bluca committed Feb 22, 2023
1 parent 60af5ed commit f500d1f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/test-crypto-perf/cperf_test_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,11 @@ cperf_alloc_common_memory(const struct cperf_options *options,
RTE_CACHE_LINE_ROUNDUP(crypto_op_total_size);
uint32_t mbuf_size = sizeof(struct rte_mbuf) + options->segment_sz;
uint32_t max_size = options->max_buffer_size + options->digest_sz;
uint16_t segments_nb = (max_size % options->segment_sz) ?
(max_size / options->segment_sz) + 1 :
max_size / options->segment_sz;
uint32_t segment_data_len = options->segment_sz - options->headroom_sz -
options->tailroom_sz;
uint16_t segments_nb = (max_size % segment_data_len) ?
(max_size / segment_data_len) + 1 :
(max_size / segment_data_len);
uint32_t obj_size = crypto_op_total_size_padded +
(mbuf_size * segments_nb);

Expand Down

0 comments on commit f500d1f

Please sign in to comment.