X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-crypto-perf%2Fcperf_test_pmd_cyclecount.c;h=5842f29d43e23ebc4e30d8ded5fdbf8dd36a6450;hb=1835a22f342f23ae31e1fd778a997139ae4d2ca9;hp=8f761608196c6cc9a5ff5c9fc531739ad3edcc4e;hpb=27c2e74719614df32e5358b9adfbed013ac7991c;p=dpdk.git diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c index 8f76160819..5842f29d43 100644 --- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c @@ -16,7 +16,7 @@ #define PRETTY_HDR_FMT "%12s%12s%12s%12s%12s%12s%12s%12s%12s%12s\n\n" #define PRETTY_LINE_FMT "%12u%12u%12u%12u%12u%12u%12u%12.0f%12.0f%12.0f\n" #define CSV_HDR_FMT "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n" -#define CSV_LINE_FMT "%10u;%10u;%u;%u;%u;%u;%u;%.f3;%.f3;%.f3\n" +#define CSV_LINE_FMT "%10u,%10u,%u,%u,%u,%u,%u,%.3f,%.3f,%.3f\n" struct cperf_pmd_cyclecount_ctx { uint8_t dev_id; @@ -59,27 +59,41 @@ static const uint16_t iv_offset = static void cperf_pmd_cyclecount_test_free(struct cperf_pmd_cyclecount_ctx *ctx) { - if (ctx) { - if (ctx->sess) { + if (!ctx) + return; + + if (ctx->sess) { +#ifdef RTE_LIB_SECURITY + if (ctx->options->op_type == CPERF_PDCP || + ctx->options->op_type == CPERF_DOCSIS) { + struct rte_security_ctx *sec_ctx = + (struct rte_security_ctx *) + rte_cryptodev_get_sec_ctx(ctx->dev_id); + rte_security_session_destroy(sec_ctx, + (struct rte_security_session *)ctx->sess); + } else +#endif + { rte_cryptodev_sym_session_clear(ctx->dev_id, ctx->sess); rte_cryptodev_sym_session_free(ctx->sess); } + } - if (ctx->pool) - rte_mempool_free(ctx->pool); + if (ctx->pool) + rte_mempool_free(ctx->pool); - if (ctx->ops) - rte_free(ctx->ops); + if (ctx->ops) + rte_free(ctx->ops); - if (ctx->ops_processed) - rte_free(ctx->ops_processed); + if (ctx->ops_processed) + rte_free(ctx->ops_processed); - rte_free(ctx); - } + rte_free(ctx); } void * cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp, + struct rte_mempool *sess_priv_mp, uint8_t dev_id, uint16_t qp_id, const struct cperf_options *options, const struct cperf_test_vector *test_vector, @@ -106,8 +120,8 @@ cperf_pmd_cyclecount_test_constructor(struct rte_mempool *sess_mp, uint16_t iv_offset = sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op); - ctx->sess = op_fns->sess_create( - sess_mp, dev_id, options, test_vector, iv_offset); + ctx->sess = op_fns->sess_create(sess_mp, sess_priv_mp, dev_id, options, + test_vector, iv_offset); if (ctx->sess == NULL) goto err; @@ -145,7 +159,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]; @@ -167,7 +181,7 @@ pmd_cyclecount_bench_ops(struct pmd_cyclecount_state *state, uint32_t cur_op, burst_size, state->ctx->sess, state->opts, state->ctx->test_vector, iv_offset, - &imix_idx); + &imix_idx, NULL); #ifdef CPERF_LINEARIZATION_ENABLE /* Check if source mbufs require coalescing */ @@ -218,7 +232,7 @@ pmd_cyclecount_build_ops(struct pmd_cyclecount_state *state, burst_size, state->ctx->sess, state->opts, state->ctx->test_vector, iv_offset, - &imix_idx); + &imix_idx, NULL); } return 0; } @@ -320,7 +334,7 @@ pmd_cyclecount_bench_burst_sz( * queue, so we never get any failed enqs unless the driver won't accept * the exact number of descriptors we requested, or the driver won't * wrap around the end of the TX ring. However, since we're only - * dequeueing once we've filled up the queue, we have to benchmark it + * dequeuing once we've filled up the queue, we have to benchmark it * piecemeal and then average out the results. */ cur_op = 0; @@ -390,7 +404,7 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) state.lcore = rte_lcore_id(); state.linearize = 0; - static int only_once; + static uint16_t display_once; static bool warmup = true; /* @@ -435,14 +449,15 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) continue; } + uint16_t exp = 0; if (!opts->csv) { - if (!only_once) + if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) printf(PRETTY_HDR_FMT, "lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", "Deq Retries", "Cycles/Op", "Cycles/Enq", "Cycles/Deq"); - only_once = 1; printf(PRETTY_LINE_FMT, state.ctx->lcore_id, opts->test_buffer_size, test_burst_size, @@ -453,13 +468,13 @@ cperf_pmd_cyclecount_test_runner(void *test_ctx) state.cycles_per_enq, state.cycles_per_deq); } else { - if (!only_once) + if (__atomic_compare_exchange_n(&display_once, &exp, 1, 0, + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) printf(CSV_HDR_FMT, "# lcore id", "Buf Size", "Burst Size", "Enqueued", "Dequeued", "Enq Retries", "Deq Retries", "Cycles/Op", "Cycles/Enq", "Cycles/Deq"); - only_once = 1; printf(CSV_LINE_FMT, state.ctx->lcore_id, opts->test_buffer_size, test_burst_size,