From 15b55dd751207bb3df4196baff49bc6c33b6d6dc Mon Sep 17 00:00:00 2001 From: Sergio Gonzalez Monroy Date: Fri, 30 Jun 2017 08:56:58 +0100 Subject: [PATCH] app/crypto-perf: return crypto ops to mempool in bulk Use rte_mempool_put_bulk for both latency and throughput tests instead of rte_crypto_op_free to improve application performance. Signed-off-by: Sergio Gonzalez Monroy Acked-by: Fiona Trahe --- app/test-crypto-perf/cperf_test_latency.c | 14 ++++++++------ app/test-crypto-perf/cperf_test_throughput.c | 8 ++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index e61ac97282..6b79735ac1 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -393,8 +393,10 @@ cperf_latency_test_runner(void *arg) tsc_end = rte_rdtsc_precise(); /* Free memory for not enqueued operations */ - for (i = ops_enqd; i < burst_size; i++) - rte_crypto_op_free(ops[i]); + if (ops_enqd != burst_size) + rte_mempool_put_bulk(ctx->crypto_op_pool, + (void **)&ops_processed[ops_enqd], + burst_size - ops_enqd); for (i = 0; i < ops_enqd; i++) { ctx->res[tsc_idx].tsc_start = tsc_start; @@ -414,9 +416,9 @@ cperf_latency_test_runner(void *arg) (ops_processed[i]->opaque_data); pres->status = ops_processed[i]->status; pres->tsc_end = tsc_end; - - rte_crypto_op_free(ops_processed[i]); } + rte_mempool_put_bulk(ctx->crypto_op_pool, + (void **)ops_processed, ops_deqd); deqd_tot += ops_deqd; deqd_max = max(ops_deqd, deqd_max); @@ -450,9 +452,9 @@ cperf_latency_test_runner(void *arg) (ops_processed[i]->opaque_data); pres->status = ops_processed[i]->status; pres->tsc_end = tsc_end; - - rte_crypto_op_free(ops_processed[i]); } + rte_mempool_put_bulk(ctx->crypto_op_pool, + (void **)ops_processed, ops_deqd); deqd_tot += ops_deqd; deqd_max = max(ops_deqd, deqd_max); diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c index 61b27ea5f3..b14808a1eb 100644 --- a/app/test-crypto-perf/cperf_test_throughput.c +++ b/app/test-crypto-perf/cperf_test_throughput.c @@ -396,8 +396,8 @@ cperf_throughput_test_runner(void *test_ctx) * the crypto operation will change the data and cause * failures. */ - for (i = 0; i < ops_deqd; i++) - rte_crypto_op_free(ops_processed[i]); + rte_mempool_put_bulk(ctx->crypto_op_pool, + (void **)ops_processed, ops_deqd); ops_deqd_total += ops_deqd; } else { @@ -426,8 +426,8 @@ cperf_throughput_test_runner(void *test_ctx) if (ops_deqd == 0) ops_deqd_failed++; else { - for (i = 0; i < ops_deqd; i++) - rte_crypto_op_free(ops_processed[i]); + rte_mempool_put_bulk(ctx->crypto_op_pool, + (void **)ops_processed, ops_deqd); ops_deqd_total += ops_deqd; } -- 2.20.1