app/test-crypto-perf: support PDCP
PATCH v2 1/1 app/test-crypto-perf: support PDCP
test-crypto-perf app is updated to calculate PDCP
throughput numbers.
2 new params are added for PDCP
--pdcp-sn-sz <5/7/12/15/18>
--pdcp-domain <control/user>
./dpdk-test-crypto-perf --master-lcore 0 -l 0,1 --log-level=8 -- --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo null --auth-op generate --auth-key-sz 16 --ptest throughput --total-ops 100000 --burst-sz 64 --buffer-sz 64,390,1512 --pool-sz 4096 --silent --pdcp-sn-sz 12 --pdcp-domain control
Signed-off-by Manish Tomar <[email protected]>
Signed-off-by Akhil Goyal <[email protected]>
---
changes in v2:
fixed checkpatch warning.
app/test-crypto-perf/cperf_ops.c | 112 +++++++++++++++++++ app/test-crypto-perf/cperf_options.h | 9 +- app/test-crypto-perf/cperf_options_parsing.c | 66 +++++++++++ app/test-crypto-perf/cperf_test_common.c | 1 + app/test-crypto-perf/cperf_test_throughput.c | 22 ++-- app/test-crypto-perf/cperf_test_vectors.c | 55 +++++++++ app/test-crypto-perf/main.c | 3 +- app/test-crypto-perf/meson.build | 2 + doc/guides/rel_notes/release_19_11.rst | 2 +- doc/guides/tools/cryptoperf.rst | 10 ++ 10 files changed, 272 insertions(+), 10 deletions(-)
app/test-crypto-perf/cperf_ops.c +112 -0
@@ -3,10 +3,47 @@*/ #include <rte_cryptodev.h> +#include <rte_security.h> #include "cperf_ops.h" #include "cperf_test_vectors.h" +static int +cperf_set_ops_security (struct rte_crypto_op **ops, + uint32_t src_buf_offset __rte_unused, + uint32_t dst_buf_offset __rte_unused, +uint16_t nb_ops,struct rte_cryptodev_sym_session *sess, + const struct cperf_options *options __rte_unused, + const struct cperf_test_vector *test_vector __rte_unused, + uint16_t iv_offset __rte_unused, + uint32_t *imix_idx __rte_unused) +{ +uint16_t i; + +for (i =0 ; i < nb_ops; i++) { +struct rte_crypto_sym_op *sym_op = ops[i]->sym; +struct rte_security_session *sec_sess = + (struct rte_security_session *)sess; + + ops[i]->status =RTE_CRYPTO_OP_STATUS_NOT_PROCESSED ; +rte_security_attach_session (ops[i], sec_sess); + sym_op->m_src = (struct rte_mbuf *)((uint8_t *)ops[i] + + src_buf_offset); + sym_op->m_src->buf_len = options->segment_sz; + sym_op->m_src->data_len = options->test_buffer_size; + sym_op->m_src->pkt_len = sym_op->m_src->data_len; + +/* Set dest mbuf to NULL if out-of-place (dst_buf_offset = 0) */ +if (dst_buf_offset ==0 ) + sym_op->m_dst =NULL ; +else + sym_op->m_dst = (struct rte_mbuf *)((uint8_t *)ops[i] + + dst_buf_offset); + } + +return 0 ; +} + static int cperf_set_ops_null_cipher(struct rte_crypto_op **ops, uint32_t src_buf_offset, uint32_t dst_buf_offset,
@@ -480,6 +517,77 @@ cperf_create_session(struct rte_mempool *sess_mp,struct rte_crypto_sym_xform aead_xform;struct rte_cryptodev_sym_session *sess =NULL ; +/* +* security only +*/ +if (options->op_type ==CPERF_PDCP ) { +/* Setup Cipher Parameters */ + cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cipher_xform.next =NULL ; + cipher_xform.cipher.algo = options->cipher_algo; + cipher_xform.cipher.op = options->cipher_op; + cipher_xform.cipher.iv.offset = iv_offset; + +/* cipher different than null */ +if (options->cipher_algo !=RTE_CRYPTO_CIPHER_NULL ) { + cipher_xform.cipher.key.data = test_vector->cipher_key.data; + cipher_xform.cipher.key.length = test_vector->cipher_key.length; + cipher_xform.cipher.iv.length = test_vector->cipher_iv.length; + }else { + cipher_xform.cipher.key.data =NULL ; + cipher_xform.cipher.key.length =0 ; + cipher_xform.cipher.iv.length =0 ; + } + +/* Setup Auth Parameters */ +if (options->auth_algo !=0 ) { + auth_xform.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + auth_xform.next =NULL ; + auth_xform.auth.algo = options->auth_algo; + auth_xform.auth.op = options->auth_op; + auth_xform.auth.iv.offset = iv_offset + + cipher_xform.cipher.iv.length; + +/* auth different than null */ +if (options->auth_algo !=RTE_CRYPTO_AUTH_NULL ) { + auth_xform.auth.digest_length = options->digest_sz; + auth_xform.auth.key.length = test_vector->auth_key.length; + auth_xform.auth.key.data = test_vector->auth_key.data; + auth_xform.auth.iv.length = test_vector->auth_iv.length; + }else { + auth_xform.auth.digest_length =0 ; + auth_xform.auth.key.length =0 ; + auth_xform.auth.key.data =NULL ; + auth_xform.auth.iv.length =0 ; + } + + cipher_xform.next = &auth_xform; + }else { + cipher_xform.next =NULL ; + } + +struct rte_security_session_conf sess_conf = { + .action_type =RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL , + .protocol =RTE_SECURITY_PROTOCOL_PDCP , + {.pdcp = { + .bearer =0x16 , + .domain = options->pdcp_domain, + .pkt_dir =0 , + .sn_size = options->pdcp_sn_sz, + .hfn =0x1 , + .hfn_threshold =0x70C0A , + } }, + .crypto_xform = &cipher_xform + }; + +struct rte_security_ctx *ctx = (struct rte_security_ctx *) +rte_cryptodev_get_sec_ctx (dev_id); + +/* Create security session */ +return (void *)rte_security_session_create (ctx, + &sess_conf, sess_mp); + } + sess =rte_cryptodev_sym_session_create (sess_mp);/* * cipher only
@@ -657,6 +765,10 @@ cperf_get_op_functions(const struct cperf_options *options, op_fns->populate_ops = cperf_set_ops_cipher;return 0 ; } +if (options->op_type ==CPERF_PDCP ) { + op_fns->populate_ops = cperf_set_ops_security; +return 0 ; + }return -1 ; }
app/test-crypto-perf/cperf_options.h +8 -1
@@ -7,6 +7,7 @@#include <rte_crypto.h> #include <rte_cryptodev.h> +#include <rte_security.h> #define CPERF_PTEST_TYPE ("ptest")#define CPERF_SILENT ("silent")
@@ -43,6 +44,8 @@#define CPERF_AEAD_AAD_SZ ("aead-aad-sz")#define CPERF_DIGEST_SZ ("digest-sz") +#define CPERF_PDCP_SN_SZ ("pdcp-sn-sz") +#define CPERF_PDCP_DOMAIN ("pdcp-domain")#define CPERF_CSV ("csv-friendly")
@@ -66,7 +69,8 @@ enum cperf_op_type {CPERF_AUTH_ONLY ,CPERF_CIPHER_THEN_AUTH ,CPERF_AUTH_THEN_CIPHER , - CPERF_AEAD +CPERF_AEAD , + CPERF_PDCP };extern const char *cperf_op_type_strs[];
@@ -110,6 +114,9 @@ struct cperf_options {uint16_t digest_sz; +uint16_t pdcp_sn_sz; +enum rte_security_pdcp_domain pdcp_domain; +char device_type[RTE_CRYPTODEV_NAME_MAX_LEN ];enum cperf_op_type op_type;
app/test-crypto-perf/cperf_options_parsing.c +66 -0
102 lines not on this page · raw message
app/test-crypto-perf/cperf_test_common.c +1 -0
@@ -30,6 +30,7 @@ fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp, mbuf_offset + mbuf_hdr_size; m->buf_len = segment_sz; m->data_len = data_len; + m->pkt_len = data_len;/* Use headroom specified for the buffer */ m->data_off = headroom;
app/test-crypto-perf/cperf_test_throughput.c +15 -7
@@ -5,6 +5,7 @@#include <rte_malloc.h> #include <rte_cycles.h> #include <rte_crypto.h> +#include <rte_security.h> #include <rte_cryptodev.h> #include "cperf_test_throughput.h"
@@ -32,17 +33,24 @@ struct cperf_throughput_ctx {static void cperf_throughput_test_free (struct cperf_throughput_ctx *ctx) { -if (ctx) { -if (ctx->sess) { +if (!ctx) +return ; +if (ctx->sess) { +if (ctx->options->op_type ==CPERF_PDCP ) { +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 {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); - -rte_free (ctx); } +if (ctx->pool) +rte_mempool_free (ctx->pool); + +rte_free (ctx); } void *
app/test-crypto-perf/cperf_test_vectors.c +55 -0
61 lines not on this page · raw message
app/test-crypto-perf/main.c +2 -1
@@ -38,7 +38,8 @@ const char *cperf_op_type_strs[] = { [CPERF_AUTH_ONLY] = "auth-only", [CPERF_CIPHER_THEN_AUTH] = "cipher-then-auth", [CPERF_AUTH_THEN_CIPHER] = "auth-then-cipher", - [CPERF_AEAD ] ="aead" + [CPERF_AEAD] = "aead", + [CPERF_PDCP ] ="pdcp" };const struct cperf_test cperf_testmap[] = {
app/test-crypto-perf/meson.build +2 -0
@@ -2,6 +2,8 @@ # Copyright(c) 2018 Intel Corporation allow_experimental_apis = true + +deps += ['security'] sources = files('cperf_ops.c', 'cperf_options_parsing.c', 'cperf_test_common.c',
doc/guides/rel_notes/release_19_11.rst +1 -1
@@ -189,7 +189,7 @@ New Features PDCP support is added to DPAA_SEC and DPAA2_SEC PMDs using rte_security APIs. Support is added for all sequence number sizes for control and user plane. - Test application is updated for unit testing. + Test and test-crypto-perf application is updated for unit testing. * **Enabled Single Pass GCM acceleration on QAT GEN3.**
doc/guides/tools/cryptoperf.rst +10 -0
@@ -192,6 +192,7 @@ The following are the application command-line options: cipher-then-auth auth-then-cipher aead + pdcp For GCM/CCM algorithms you should use aead flag.
@@ -332,6 +333,15 @@ The following are the application command-line options: Enable test result output CSV friendly rather than human friendly. +* ``--pdcp-sn-sz <n>`` + + Set PDCP sequence number size(n) in bits. Valid values of n will + be 5/7/12/15/18. + +* ``--pdcp-domain <control/user>`` + + Set PDCP domain to specify Control/user plane. + Test Vector File ~~~~~~~~~~~~~~~~
Signature · 1 line
2.17.1
Acked-by Hemant Agrawal <[email protected]>