From: Tomasz Jozwiak Date: Thu, 26 Apr 2018 09:05:49 +0000 (+0200) Subject: app/crypto-perf: fix burst size calculation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3356083a775c816cb1efa41019fa6ddbbec023c8;p=dpdk.git app/crypto-perf: fix burst size calculation This patch fixes segmentation fault in pmd_cyclecount_bench_ops function in case when state->opts->nb_descriptors is not natural multiple of burst size. To reproduce run: dpdk-test-crypto-perf with params: --ptest pmd-cyclecount --pmd-cyclecount-delay-ms 5 \ --devtype crypto_qat --optype cipher-then-auth \ --cipher-algo aes-cbc --cipher-op encrypt \ --cipher-key-sz 16 --cipher-iv-sz 16 \ --auth-algo sha2-256-hmac \ --auth-op generate --auth-key-sz 64 --digest-sz 32 \ --total-ops 10000 --burst-sz 255 --buffer-sz 1024 --silent Fixes: 96dfeb609be1 ("app/crypto-perf: add new PMD benchmarking mode") Cc: stable@dpdk.org Signed-off-by: Tomasz Jozwiak Acked-by: Pablo de Lara --- diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c index 8f76160819..c8d16db6d9 100644 --- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c @@ -145,7 +145,7 @@ pmd_cyclecount_bench_ops(struct pmd_cyclecount_state *state, uint32_t cur_op, for (cur_iter_op = 0; cur_iter_op < iter_ops_needed; cur_iter_op += test_burst_size) { - uint32_t burst_size = RTE_MIN(state->opts->total_ops - cur_op, + uint32_t burst_size = RTE_MIN(iter_ops_needed - cur_iter_op, test_burst_size); struct rte_crypto_op **ops = &state->ctx->ops[cur_iter_op];