Skip to content

Commit

Permalink
app/test-crypto-perf: add throughput OOP decryption
Browse files Browse the repository at this point in the history
During throughput running, re-filling the test data will
impact the performance test result. So for now, to run
decrypt throughput testing is not supported since the
test data is not filled.

But if user requires OOP(out-of-place) mode, the test
data from source mbuf will never be modified, and if
the test data can be prepared out of the running loop,
the decryption test should be fine.

This commit adds the support of out-of-place decryption
testing for throughput.

[1]:
http://mails.dpdk.org/archives/dev/2023-July/273328.html

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
smou-mlnx authored and ovsrobot committed Jan 5, 2024
1 parent 6ef0715 commit 552c854
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/test-crypto-perf/cperf_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,10 @@ cperf_set_ops_aead(struct rte_crypto_op **ops,
}

if ((options->test == CPERF_TEST_TYPE_VERIFY) ||
(options->test == CPERF_TEST_TYPE_LATENCY)) {
(options->test == CPERF_TEST_TYPE_LATENCY) ||
(options->test == CPERF_TEST_TYPE_THROUGHPUT &&
(options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT))) {
for (i = 0; i < nb_ops; i++) {
uint8_t *iv_ptr = rte_crypto_op_ctod_offset(ops[i],
uint8_t *, iv_offset);
Expand Down
8 changes: 8 additions & 0 deletions app/test-crypto-perf/cperf_options_parsing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,14 @@ cperf_options_check(struct cperf_options *options)
}
}

if (options->test == CPERF_TEST_TYPE_THROUGHPUT &&
(options->aead_op == RTE_CRYPTO_AEAD_OP_DECRYPT ||
options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT) &&
!options->out_of_place) {
RTE_LOG(ERR, USER1, "Only out-of-place is allowed in throughput decryption.\n");
return -EINVAL;
}

if (options->op_type == CPERF_CIPHER_ONLY ||
options->op_type == CPERF_CIPHER_THEN_AUTH ||
options->op_type == CPERF_AUTH_THEN_CIPHER) {
Expand Down
37 changes: 32 additions & 5 deletions app/test-crypto-perf/cperf_test_throughput.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,29 @@ cperf_throughput_test_constructor(struct rte_mempool *sess_mp,
return NULL;
}

static void
cperf_verify_init_ops(struct rte_mempool *mp __rte_unused,
void *opaque_arg,
void *obj,
__rte_unused unsigned int i)
{
uint16_t iv_offset = sizeof(struct rte_crypto_op) +
sizeof(struct rte_crypto_sym_op);
uint32_t imix_idx = 0;
struct cperf_throughput_ctx *ctx = opaque_arg;
struct rte_crypto_op *op = obj;

(ctx->populate_ops)(&op, ctx->src_buf_offset,
ctx->dst_buf_offset,
1, ctx->sess, ctx->options,
ctx->test_vector, iv_offset, &imix_idx, NULL);

cperf_mbuf_set(op->sym->m_src,
ctx->options,
ctx->test_vector);

}

int
cperf_throughput_test_runner(void *test_ctx)
{
Expand Down Expand Up @@ -143,6 +166,9 @@ cperf_throughput_test_runner(void *test_ctx)
uint16_t iv_offset = sizeof(struct rte_crypto_op) +
sizeof(struct rte_crypto_sym_op);

if (ctx->options->out_of_place)
rte_mempool_obj_iter(ctx->pool, cperf_verify_init_ops, (void *)ctx);

while (test_burst_size <= ctx->options->max_burst_size) {
uint64_t ops_enqd = 0, ops_enqd_total = 0, ops_enqd_failed = 0;
uint64_t ops_deqd = 0, ops_deqd_total = 0, ops_deqd_failed = 0;
Expand Down Expand Up @@ -175,11 +201,12 @@ cperf_throughput_test_runner(void *test_ctx)
}

/* Setup crypto op, attach mbuf etc */
(ctx->populate_ops)(ops, ctx->src_buf_offset,
ctx->dst_buf_offset,
ops_needed, ctx->sess,
ctx->options, ctx->test_vector,
iv_offset, &imix_idx, &tsc_start);
if (!ctx->options->out_of_place)
(ctx->populate_ops)(ops, ctx->src_buf_offset,
ctx->dst_buf_offset,
ops_needed, ctx->sess,
ctx->options, ctx->test_vector,
iv_offset, &imix_idx, &tsc_start);

/**
* When ops_needed is smaller than ops_enqd, the
Expand Down

0 comments on commit 552c854

Please sign in to comment.