Skip to content

Commit

Permalink
app/crypto-perf: overwrite mbuf when verifying
Browse files Browse the repository at this point in the history
When running the verify test, mbufs in the pool were
populated with the test vector loaded from a file.
To avoid limiting the number of operations to the pool size,
mbufs will be rewritten with the test vector, before
linking them to the crypto operations.

Signed-off-by: Pablo de Lara <[email protected]>
Acked-by: Akhil Goyal <[email protected]>
  • Loading branch information
pablodelara committed Oct 12, 2017
1 parent 083de3e commit 5b2b0a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/test-crypto-perf/cperf_options_parsing.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,6 @@ cperf_options_check(struct cperf_options *options)
return -EINVAL;
}

if (options->test == CPERF_TEST_TYPE_VERIFY &&
options->total_ops > options->pool_sz) {
RTE_LOG(ERR, USER1, "Total number of ops must be less than or"
" equal to the pool size.\n");
return -EINVAL;
}

if (options->test == CPERF_TEST_TYPE_VERIFY &&
(options->inc_buffer_size != 0 ||
options->buffer_size_count > 1)) {
Expand Down
35 changes: 35 additions & 0 deletions app/test-crypto-perf/cperf_test_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,34 @@ cperf_verify_op(struct rte_crypto_op *op,
return !!res;
}

static void
cperf_mbuf_set(struct rte_mbuf *mbuf,
const struct cperf_options *options,
const struct cperf_test_vector *test_vector)
{
uint32_t segment_sz = options->segment_sz;
uint8_t *mbuf_data;
uint8_t *test_data =
(options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
test_vector->plaintext.data :
test_vector->ciphertext.data;
uint32_t remaining_bytes = options->max_buffer_size;

while (remaining_bytes) {
mbuf_data = rte_pktmbuf_mtod(mbuf, uint8_t *);

if (remaining_bytes <= segment_sz) {
memcpy(mbuf_data, test_data, remaining_bytes);
return;
}

memcpy(mbuf_data, test_data, segment_sz);
remaining_bytes -= segment_sz;
test_data += segment_sz;
mbuf = mbuf->next;
}
}

int
cperf_verify_test_runner(void *test_ctx)
{
Expand Down Expand Up @@ -299,6 +327,13 @@ cperf_verify_test_runner(void *test_ctx)
ops_needed, ctx->sess, ctx->options,
ctx->test_vector, iv_offset);


/* Populate the mbuf with the test vector, for verification */
for (i = 0; i < ops_needed; i++)
cperf_mbuf_set(ops[i]->sym->m_src,
ctx->options,
ctx->test_vector);

#ifdef CPERF_LINEARIZATION_ENABLE
if (linearize) {
/* PMD doesn't support scatter-gather and source buffer
Expand Down

0 comments on commit 5b2b0a7

Please sign in to comment.