app/test-crypto-perf: improve dequeue logic
PATCH 1/8 app/test-crypto-perf: improve dequeue logic
Issue more dequeue commands if the gap between enqueued and dequeued packets is more than burst size *8
--- app/test-crypto-perf/cperf_test_throughput.c | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-)
app/test-crypto-perf/cperf_test_throughput.c +23 -19
@@ -223,26 +223,30 @@ cperf_throughput_test_runner(void *test_ctx) ops_unused = burst_size - ops_enqd; ops_enqd_total += ops_enqd; -/* Dequeue processed burst of ops from crypto device */ - ops_deqd =rte_cryptodev_dequeue_burst (ctx->dev_id, ctx->qp_id, - ops_processed, test_burst_size); - -if (likely (ops_deqd)) { -/* Free crypto ops so they can be reused. */ -rte_mempool_put_bulk (ctx->pool, - (void **)ops_processed, ops_deqd); - - ops_deqd_total += ops_deqd; - }else { -/** -* Count dequeue polls which didn't return any -* processed operations. This statistic is mainly -* relevant to hw accelerators. -*/ - ops_deqd_failed++; - } - +do { + ops_deqd =rte_cryptodev_dequeue_burst ( + ctx->dev_id, ctx->qp_id, + ops_processed, test_burst_size); + +if (likely (ops_deqd)) { +/* Free crypto ops for reuse */ +rte_mempool_put_bulk (ctx->pool, + (void **)ops_processed, + ops_deqd); + + ops_deqd_total += ops_deqd; + }else { +/** +* Count dequeue polls which didn't +* return any processed operations. +* This statistic is mainly relevant +* to hw accelerators. +*/ + ops_deqd_failed++; + } + }while (ops_enqd_total - ops_deqd_total > + test_burst_size *8 ); }/* Dequeue any operations still in the crypto device */
Signature · 1 line
2.25.1
PATCH 2/8 app/test-crypto-perf: support SDAP for PDCP operations
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c 0xc --log-level=8 -- --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ 3 files changed, 15 insertions(+)
app/test-crypto-perf/cperf_ops.c +1 -0
@@ -860,6 +860,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xform
app/test-crypto-perf/cperf_options.h +2 -0
@@ -13,6 +13,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")
@@ -128,6 +129,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif
app/test-crypto-perf/cperf_options_parsing.c +12 -0
@@ -61,6 +61,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",
@@ -535,6 +536,15 @@ parse_silent(struct cperf_options *opts,return 0 ; } +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +} +static int parse_cipher_algo (struct cperf_options *opts,const char *arg) {
@@ -865,6 +875,7 @@ static struct option lgopts[] = { { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, + { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, #endif { CPERF_CSV, no_argument, 0, 0},
@@ -978,6 +989,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, + { CPERF_ENABLE_SDAP, parse_enable_sdap }, { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, #endif { CPERF_CSV, parse_csv_friendly},
Signature · 1 line
2.25.1
RE: [EXT] [PATCH 2/8] app/test-crypto-perf: support SDAP for PDCP operations
Quoted 11 lines
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c0xc--log-level=8 -- --devtypecrypto_dpaa2_sec--optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
Quoted 6 lines
Signed-off-by Gagandeep Singh <[email protected]>--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ 3 files changed, 15 insertions(+)
Missing documentation update for the new option added.
Quoted 72 lines
app/test-crypto-perf/cperf_ops.c +1
-0@@ -860,6 +860,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xformapp/test-crypto- renamed from app/test-crypto-perf/cperf_options.h +0
-0
perf/cperf_options.h
index031b238b20..fffa6a2162100644app/test-crypto-perf/cperf_options.h +2
-0@@ -13,6 +13,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")@@ -128,6 +129,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif app/test-crypto- renamed from app/test-crypto-perf/cperf_options_parsing.c +0
-0
perf/cperf_options_parsing.c
index59a9dc596a..48cd1b5ba2100644app/test-crypto-perf/cperf_options_parsing.c +11
-0@@ -61,6 +61,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",@@ -535,6 +536,15 @@ parse_silent(struct cperf_options *opts,return 0 ; } +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +} +static int parse_cipher_algo (struct cperf_options *opts,const char *arg) {@@ -865,6 +875,7 @@ static struct option lgopts[] = { { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, + { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, #endif { CPERF_CSV, no_argument, 0, 0},
app/test-crypto-perf/cperf_options_parsing.c cperf_opts_parse_long(int opt_idx, struct cperf_options · line 993
Quoted 5 lines
app/test-crypto-perf/cperf_options_parsing.c +1
-0@@ -978,6 +989,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, + { CPERF_ENABLE_SDAP, parse_enable_sdap },
Follow similar formatting as other options.
Quoted 5 lines
app/test-crypto-perf/cperf_options_parsing.c +0
-0{ CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, #endif{
CPERF_CSV,parse_csv_friendly},
--
2.25.1
PATCH 3/8 examples/ipsec-secgw: support XCBC-MAC/DES-CBC
In reply to Gagandeep Singhipsec-secgw application is updated to support
DES-CBC ciphering and XCBC-MAC authentication
based IPsec functionality.
--- examples/ipsec-secgw/esp.c | 5 +++++ examples/ipsec-secgw/sa.c | 8 ++++++++ 2 files changed, 13 insertions(+)
examples/ipsec-secgw/esp.c +5 -0
@@ -100,6 +100,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :/* Copy IV at the end of crypto operation */
@@ -121,6 +122,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + payload_len;
@@ -336,6 +338,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :memset (iv,0 , sa->iv_len);
@@ -399,6 +402,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC : sym_cop->cipher.data.offset = ip_hdr_len +
@@ -431,6 +435,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + pad_payload_len;
examples/ipsec-secgw/sa.c +8 -0
@@ -119,6 +119,13 @@ const struct supported_cipher_algo cipher_algos[] = { .iv_len = 8, .block_size = 8, .key_len = 24 + }, + { + .keyword = "des-cbc", + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .iv_len = 8, + .block_size = 8, + .key_len = 8 } };
@@ -1301,6 +1308,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :
Signature · 1 line
2.25.1
RE: [EXT] [PATCH 3/8] examples/ipsec-secgw: support XCBC-MAC/DES-CBC
Quoted 9 lines
ipsec-secgw application is updated to support
DES-CBC ciphering and XCBC-MAC authentication
based IPsec functionality.Signed-off-by Gagandeep Singh <[email protected]>--- examples/ipsec-secgw/esp.c | 5 +++++ examples/ipsec-secgw/sa.c | 8 ++++++++ 2 files changed, 13 insertions(+)
Documentation updates missing for new algos
"doc/guides/sample_app_ug/ipsec_secgw.rst"
Quoted 76 lines
examples/ipsec-secgw/esp.c +7
-0@@ -100,6 +100,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :/* Copy IV at the end of crypto operation */ @@ -121,6 +122,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + payload_len;@@ -336,6 +338,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :memset (iv,0 , sa->iv_len);@@ -399,6 +402,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC : sym_cop->cipher.data.offset = ip_hdr_len +@@ -431,6 +435,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + pad_payload_len;examples/ipsec-secgw/sa.c +8
-0@@ -119,6 +119,13 @@ const struct supported_cipher_algo cipher_algos[] = { .iv_len = 8, .block_size = 8, .key_len = 24 + }, + { + .keyword = "des-cbc", + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .iv_len = 8, + .block_size = 8, + .key_len = 8 } };@@ -1301,6 +1308,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :case
RTE_CRYPTO_CIPHER_AES_CTR:
--
2.25.1
RE: [EXT] [PATCH 3/8] examples/ipsec-secgw: support XCBC-MAC/DES-CBC
Quoted 12 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 3:24 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH 3/8] examples/ipsec-secgw: support XCBC-MAC/DES- CBCQuoted 3 lines
ipsec-secgw application is updated to support DES-CBC ciphering and XCBC-MAC authentication based IPsec functionality.
Quoted 7 lines
Quoted 5 lines
Signed-off-by Gagandeep Singh <[email protected]>--- examples/ipsec-secgw/esp.c | 5 +++++ examples/ipsec-secgw/sa.c | 8 ++++++++ 2 files changed, 13 insertions(+)Documentation updates missing for new algos
"doc/guides/sample_app_ug/ipsec_secgw.rst"
Ok, It appears algo SHA256_HMAC is also missing in the document.
Quoted 81 lines
Quoted 14 lines
examples/ipsec-secgw/esp.c +1
-0@@ -100,6 +100,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :Quoted 1 line
/* Copy IV at the end of crypto operation */ @@ -121,6
+122,7 @@
Quoted 18 lines
esp_inbound(struct
rte_mbuf*m, structipsec_sa*sa,examples/ipsec-secgw/esp.c +3
-0case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + payload_len;@@ -336,6 +338,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :memset (iv,0 , sa->iv_len);examples/ipsec-secgw/esp.c esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, · line 408
Quoted 7 lines
examples/ipsec-secgw/esp.c +1
-0@@ -399,6 +402,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC : sym_cop->cipher.data.offset = ip_hdr_len + @@ -431,6+435,7 @@
examples/ipsec-secgw/sa.c const struct supported_cipher_algo cipher_algos[] =
Quoted 14 lines
esp_outbound(struct
rte_mbuf*m, structipsec_sa*sa,examples/ipsec-secgw/esp.c +2
-0case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + pad_payload_len;examples/ipsec-secgw/sa.c +0
-0@@ -119,6 +119,13 @@ const struct supported_cipher_algo cipher_algos[] ={
Quoted 24 lines
examples/ipsec-secgw/sa.c +8
-0.iv_len = 8, .block_size = 8, .key_len = 24 + }, + { + .keyword = "des-cbc", + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .iv_len = 8, + .block_size = 8, + .key_len = 8 } };@@ -1301,6 +1308,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :case
RTE_CRYPTO_CIPHER_AES_CTR:
--
2.25.1
PATCH 4/8 examples/l2fwd-crypto: add signal handler for exit
In reply to Gagandeep SinghHandle SIGINT and SIGTERM signals.
--- examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
examples/l2fwd-crypto/main.c +16 -0
@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h>
@@ -258,6 +259,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];/* default period is 10 seconds */ static int64_t timer_period =10 *TIMER_MILLISECOND *1000 ; +/* Global signal */ +unsigned int signal_received; +/* Print out statistics on packets dropped */ static void print_stats (void )
@@ -925,6 +929,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) nb_rx =rte_eth_rx_burst (portid,0 , pkts_burst,MAX_PKT_BURST ); +if (unlikely (signal_received)) +return ; port_statistics[portid].rx += nb_rx;
@@ -2762,6 +2768,13 @@ reserve_key_memory(struct l2fwd_crypto_options *options) options->aad.phys_addr =rte_malloc_virt2iova (options->aad.data); } +static void +raise_signal (int signum) +{ + signal_received =1 ; +printf ("Exiting on signal (%d)\n" , signum); +} +int main (int argc,char **argv) {
@@ -2774,6 +2787,9 @@ main(int argc, char **argv)int ret, enabled_cdevcount, enabled_portcount;uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS ] = {0 }; +signal (SIGINT , raise_signal); +signal (SIGTERM , raise_signal); +/* init EAL */ ret =rte_eal_init (argc, argv);if (ret <0 )
Signature · 1 line
2.25.1
PATCH 5/8 test/crypto: fix pmd name for dpaa raw buffer crypto driver
In reply to Gagandeep SinghPMD name for DPAA raw buffer crypto driver test cases is updated with correct name.
--- app/test/test_cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev.c +1 -1
@@ -16588,7 +16588,7 @@ test_cryptodev_dpaa2_sec_raw_api(void)static int test_cryptodev_dpaa_sec_raw_api (void ) { -static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA2_SEC_PMD ); +static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD );int ret; ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP,
Signature · 1 line
2.25.1
PATCH 6/8 test/crypto: support raw buffer APIs for PDCP
In reply to Gagandeep SinghThis patch supports raw buffer APIs testing for
PDCP test cases.
--- app/test/test_cryptodev.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
app/test/test_cryptodev.c +20 -2
@@ -8370,6 +8370,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,struct rte_security_ctx *ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx ( ts_params->valid_devs[0 ]); +struct rte_cryptodev_info dev_info; +uint64_t feat_flags; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); + feat_flags = dev_info.feature_flags;/* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx;
@@ -8391,6 +8396,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, input_vec_len);memcpy (plaintext, input_vec, input_vec_len); +if ((global_api_test_type ==CRYPTODEV_RAW_API_TEST ) && + (!(feat_flags &RTE_CRYPTODEV_FF_SYM_RAW_DP ))) { +printf ("Device does not support RAW data-path APIs.\n" ); +return TEST_SKIPPED ; + }/* Out of place support */ if (oop) {/*
@@ -8483,8 +8493,16 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, ut_params->op->sym->m_dst = ut_params->obuf;/* Process crypto operation */ -if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) - ==NULL ) { +if (global_api_test_type ==CRYPTODEV_RAW_API_TEST ) { +/* filling lengths */ + ut_params->op->sym->cipher.data.length = ut_params->op->sym->m_src->pkt_len; + ut_params->op->sym->auth.data.length = ut_params->op->sym->m_src->pkt_len; +process_sym_raw_dp_op (ts_params->valid_devs[0 ],0 , + ut_params->op,1 ,1 ,0 ,0 ); + }else { + ut_params->op =process_crypto_request (ts_params->valid_devs[0 ], ut_params->op); + } +if (ut_params->op ==NULL ) {printf ("TestCase %s()-%d line %d failed %s: " , __func__, i, __LINE__,"failed to process sym crypto op" );
Signature · 1 line
2.25.1
PATCH 7/8 test/crypto: add external buffer test case
In reply to Gagandeep SinghAdd a test case to verify crypto functionality
with external buffer.
--- app/test/test_cryptodev.c | 163 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+)
app/test/test_cryptodev.c +163 -0
@@ -2270,6 +2270,167 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)return TEST_SUCCESS ; } +static inline void +ext_buf_free_callback_fn (void *addr, + void *ext_buf_ptr __rte_unused) +{ +rte_free (addr); +} + +static int +test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer (void ) +{ +struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +int status; +void *buf; +rte_iova_t iova; +uint16_t buf_len =QUOTE_1024_BYTES ; +struct rte_mbuf_ext_shared_info *shinfo =NULL ; +struct rte_mbuf *m; + + +/* Verify the capabilities */ +struct rte_cryptodev_sym_capability_idx cap_idx; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + cap_idx.algo.auth =RTE_CRYPTO_AUTH_SHA1_HMAC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cap_idx.algo.cipher =RTE_CRYPTO_CIPHER_AES_CBC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ; + + buf =rte_malloc (NULL , buf_len,RTE_CACHE_LINE_SIZE ); +if (buf ==NULL ) +return TEST_SKIPPED ; + +rte_memcpy (buf, catch_22_quote,QUOTE_512_BYTES ); + shinfo =rte_pktmbuf_ext_shinfo_init_helper (buf, &buf_len, + ext_buf_free_callback_fn,NULL ); +if (unlikely (shinfo ==NULL )) { +rte_free (buf); +return -1 ; + } + iova =rte_malloc_virt2iova (buf); + m =rte_pktmbuf_alloc (ts_params->mbuf_pool); +if (m ==NULL ) +return TEST_SKIPPED ; +rte_pktmbuf_attach_extbuf (m, buf, iova, buf_len, shinfo); +rte_pktmbuf_reset_headroom (m); + m->pkt_len =QUOTE_512_BYTES ; + m->data_len =QUOTE_512_BYTES ; + m->data_off =0 ; + + ut_params->ibuf = m; + + ut_params->digest = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, +DIGEST_BYTE_LENGTH_SHA1 ); +TEST_ASSERT_NOT_NULL (ut_params->digest,"no room to append digest" ); + +/* Setup Cipher Parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_CBC ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length =CIPHER_KEY_LENGTH_AES_CBC ; + ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.cipher.iv.length =CIPHER_IV_LENGTH_AES_CBC ; + +/* Setup HMAC Parameters */ + ut_params->auth_xform.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + + ut_params->auth_xform.next =NULL ; + + ut_params->auth_xform.auth.op =RTE_CRYPTO_AUTH_OP_GENERATE ; + ut_params->auth_xform.auth.algo =RTE_CRYPTO_AUTH_SHA1_HMAC ; + ut_params->auth_xform.auth.key.length =HMAC_KEY_LENGTH_SHA1 ; + ut_params->auth_xform.auth.key.data = hmac_sha1_key; + ut_params->auth_xform.auth.digest_length =DIGEST_BYTE_LENGTH_SHA1 ; + + ut_params->sess =rte_cryptodev_sym_session_create ( + ts_params->session_mpool); +TEST_ASSERT_NOT_NULL (ut_params->sess,"Session creation failed" ); + +/* Create crypto session*/ + status =rte_cryptodev_sym_session_init (ts_params->valid_devs[0 ], + ut_params->sess, &ut_params->cipher_xform, + ts_params->session_priv_mpool); + +if (status == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_EQUAL (status,0 ,"Session init failed" ); + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +TEST_ASSERT_NOT_NULL (ut_params->op, +"Failed to allocate symmetric crypto operation struct" ); + +rte_crypto_op_attach_sym_session (ut_params->op, ut_params->sess); + +struct rte_crypto_sym_op *sym_op = ut_params->op->sym; + +/* set crypto operation source mbuf */ + sym_op->m_src = ut_params->ibuf; + +/* Set crypto operation authentication parameters */ + sym_op->auth.digest.data = ut_params->digest; + sym_op->auth.digest.phys_addr =rte_pktmbuf_iova_offset ( + ut_params->ibuf,QUOTE_512_BYTES ); + + sym_op->auth.data.offset =0 ; + sym_op->auth.data.length =QUOTE_512_BYTES ; + +/* Copy IV at the end of the crypto operation */ + rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), + aes_cbc_iv,CIPHER_IV_LENGTH_AES_CBC ); + +/* Set crypto operation cipher parameters */ + sym_op->cipher.data.offset =0 ; + sym_op->cipher.data.length =QUOTE_512_BYTES ; + +/* Process crypto operation */ +if (gbl_action_type ==RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ) +process_cpu_crypt_auth_op (ts_params->valid_devs[0 ], + ut_params->op); +else +TEST_ASSERT_NOT_NULL ( +process_crypto_request (ts_params->valid_devs[0 ], + ut_params->op), +"failed to process sym crypto op" ); + +TEST_ASSERT_EQUAL (ut_params->op->status,RTE_CRYPTO_OP_STATUS_SUCCESS , +"crypto op processing failed" ); + +/* Validate obuf */ +uint8_t *ciphertext =rte_pktmbuf_mtod (ut_params->op->sym->m_src, + uint8_t *); + +TEST_ASSERT_BUFFERS_ARE_EQUAL (ciphertext, + catch_22_quote_2_512_bytes_AES_CBC_ciphertext, +QUOTE_512_BYTES , +"ciphertext data not as expected" ); + +uint8_t *digest = ciphertext +QUOTE_512_BYTES ; + +TEST_ASSERT_BUFFERS_ARE_EQUAL (digest, + catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest, + gbl_driver_id ==rte_cryptodev_driver_id_get ( +RTE_STR (CRYPTODEV_NAME_AESNI_MB_PMD )) ? +TRUNCATED_DIGEST_BYTE_LENGTH_SHA1 : +DIGEST_BYTE_LENGTH_SHA1 , +"Generated digest data not as expected" ); + +return TEST_SUCCESS ; +} + +/* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */ #define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512)
@@ -15458,6 +15619,8 @@ static struct unit_test_suite cryptodev_gen_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_stats),TEST_CASE_ST (ut_setup, ut_teardown, test_enq_callback_setup),TEST_CASE_ST (ut_setup, ut_teardown, test_deq_callback_setup), +TEST_CASE_ST (ut_setup, ut_teardown, + test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer), TEST_CASES_END() /**< NULL terminate unit test array */ } };
Signature · 1 line
2.25.1
RE: [EXT] [PATCH 7/8] test/crypto: add external buffer test case
Quoted 26 lines
Add a test case to verify crypto functionality
with external buffer.Signed-off-by Gagandeep Singh <[email protected]>--- app/test/test_cryptodev.c | 163 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+)app/test/test_cryptodev.c +10
-0@@ -2270,6 +2270,167 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)return TEST_SUCCESS ; } +static inline void +ext_buf_free_callback_fn (void *addr, + void *ext_buf_ptr __rte_unused) +{ +rte_free (addr); +} + +static int +test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer (void ) +{
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2292
Quoted 10 lines
app/test/test_cryptodev.c +10
-0+struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +int status; +void *buf; +rte_iova_t iova; +uint16_t buf_len =QUOTE_1024_BYTES ; +struct rte_mbuf_ext_shared_info *shinfo =NULL ; +struct rte_mbuf *m; + +
Extra line
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2304
Quoted 12 lines
app/test/test_cryptodev.c +12
-0+/* Verify the capabilities */ +struct rte_cryptodev_sym_capability_idx cap_idx; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + cap_idx.algo.auth =RTE_CRYPTO_AUTH_SHA1_HMAC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cap_idx.algo.cipher =RTE_CRYPTO_CIPHER_AES_CBC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ;
Repeated code.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2308
Quoted 4 lines
app/test/test_cryptodev.c +4
-0+ + buf =rte_malloc (NULL , buf_len,RTE_CACHE_LINE_SIZE ); +if (buf ==NULL ) +return TEST_SKIPPED ;
Why skipped? It is an error if malloc is failed.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2320
Quoted 12 lines
app/test/test_cryptodev.c +12
-0+ +rte_memcpy (buf, catch_22_quote,QUOTE_512_BYTES ); + shinfo =rte_pktmbuf_ext_shinfo_init_helper (buf, &buf_len, + ext_buf_free_callback_fn,NULL ); +if (unlikely (shinfo ==NULL )) { +rte_free (buf); +return -1 ; + } + iova =rte_malloc_virt2iova (buf); + m =rte_pktmbuf_alloc (ts_params->mbuf_pool); +if (m ==NULL ) +return TEST_SKIPPED ;
Again, it should be TEST_FAILED
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2324
Quoted 4 lines
app/test/test_cryptodev.c +4
-0+rte_pktmbuf_attach_extbuf (m, buf, iova, buf_len, shinfo); +rte_pktmbuf_reset_headroom (m); + m->pkt_len =QUOTE_512_BYTES ; + m->data_len =QUOTE_512_BYTES ;
Please use proper APIs to append data and increase lengths.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2325
Quoted 1 line
app/test/test_cryptodev.c +1
-0+ m->data_off =0 ;
Why is data off rewritten as 0?
It is modified by rte_pktmbuf_reset_headroom().
Quoted 112 lines
app/test/test_cryptodev.c +15
-0+ + ut_params->ibuf = m; + + ut_params->digest = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, +DIGEST_BYTE_LENGTH_SHA1 ); +TEST_ASSERT_NOT_NULL (ut_params->digest,"no room to append digest"); + +/* Setup Cipher Parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_CBC ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length =
CIPHER_KEY_LENGTH_AES_CBC;app/test/test_cryptodev.c +2
-0+ ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.cipher.iv.length =
CIPHER_IV_LENGTH_AES_CBC;app/test/test_cryptodev.c +11
-0+ +/* Setup HMAC Parameters */ + ut_params->auth_xform.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + + ut_params->auth_xform.next =NULL ; + + ut_params->auth_xform.auth.op =RTE_CRYPTO_AUTH_OP_GENERATE ; + ut_params->auth_xform.auth.algo =RTE_CRYPTO_AUTH_SHA1_HMAC ; + ut_params->auth_xform.auth.key.length =HMAC_KEY_LENGTH_SHA1 ; + ut_params->auth_xform.auth.key.data = hmac_sha1_key; + ut_params->auth_xform.auth.digest_length =
DIGEST_BYTE_LENGTH_SHA1;app/test/test_cryptodev.c +38
-0+ + ut_params->sess =rte_cryptodev_sym_session_create ( + ts_params->session_mpool); +TEST_ASSERT_NOT_NULL (ut_params->sess,"Session creation failed" ); + +/* Create crypto session*/ + status =rte_cryptodev_sym_session_init (ts_params->valid_devs[0 ], + ut_params->sess, &ut_params->cipher_xform, + ts_params->session_priv_mpool); + +if (status == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_EQUAL (status,0 ,"Session init failed" ); + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +TEST_ASSERT_NOT_NULL (ut_params->op, +"Failed to allocate symmetric crypto operation struct" ); + +rte_crypto_op_attach_sym_session (ut_params->op, ut_params->sess); + +struct rte_crypto_sym_op *sym_op = ut_params->op->sym; + +/* set crypto operation source mbuf */ + sym_op->m_src = ut_params->ibuf; + +/* Set crypto operation authentication parameters */ + sym_op->auth.digest.data = ut_params->digest; + sym_op->auth.digest.phys_addr =rte_pktmbuf_iova_offset ( + ut_params->ibuf,QUOTE_512_BYTES ); + + sym_op->auth.data.offset =0 ; + sym_op->auth.data.length =QUOTE_512_BYTES ; + +/* Copy IV at the end of the crypto operation */ + rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
IV_OFFSET),app/test/test_cryptodev.c +17
-0+ aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + +/* Set crypto operation cipher parameters */ + sym_op->cipher.data.offset =0 ; + sym_op->cipher.data.length =QUOTE_512_BYTES ; + +/* Process crypto operation */ +if (gbl_action_type ==RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ) +process_cpu_crypt_auth_op (ts_params->valid_devs[0 ], + ut_params->op); +else +TEST_ASSERT_NOT_NULL ( +process_crypto_request (ts_params->valid_devs[0 ], + ut_params->op), +"failed to process sym crypto op" ); + + TEST_ASSERT_EQUAL(ut_params->op->status,
RTE_CRYPTO_OP_STATUS_SUCCESS,app/test/test_cryptodev.c +15
-0+ "crypto op processing failed"); + +/* Validate obuf */ +uint8_t *ciphertext =rte_pktmbuf_mtod (ut_params->op->sym->m_src, + uint8_t *); + +TEST_ASSERT_BUFFERS_ARE_EQUAL (ciphertext, + catch_22_quote_2_512_bytes_AES_CBC_ciphertext, +QUOTE_512_BYTES , +"ciphertext data not as expected" ); + +uint8_t *digest = ciphertext +QUOTE_512_BYTES ; + + TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, +catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest,app/test/test_cryptodev.c +2
-0+ gbl_driver_id == rte_cryptodev_driver_id_get( +
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) ?
+
TRUNCATED_DIGEST_BYTE_LENGTH_SHA1:
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2429
Quoted 3 lines
app/test/test_cryptodev.c +3
-0+DIGEST_BYTE_LENGTH_SHA1 , + "Generated digest data not as expected"); +
Above check for AESNI_MB not required.
Quoted 22 lines
app/test/test_cryptodev.c +6
-0+return TEST_SUCCESS ; +} + +/* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */ #define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512)@@ -15458,6 +15619,8 @@ static struct unit_test_suite cryptodev_gen_testsuite = {TEST_CASE_ST (ut_setup, ut_teardown, test_stats),TEST_CASE_ST (ut_setup, ut_teardown, test_enq_callback_setup),TEST_CASE_ST (ut_setup, ut_teardown, test_deq_callback_setup), + TEST_CASE_ST(ut_setup, ut_teardown, +
test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer),app/test/test_cryptodev.c +0
-1TEST_CASES_END() /**< NULL terminate unit test array */ } }; --2.25.1
RE: [EXT] [PATCH 7/8] test/crypto: add external buffer test case
Hi,
Quoted 219 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 3:57 PM
To: Gagandeep Singh <[email protected]>; [email protected]; Power, Ciara <[email protected]>; Zhang, Roy Fan <[email protected]>
Subject: RE: [EXT] [PATCH 7/8] test/crypto: add external buffer test caseQuoted 26 lines
Add a test case to verify crypto functionality with external buffer.
Signed-off-by Gagandeep Singh <[email protected]>--- app/test/test_cryptodev.c | 163 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+)app/test/test_cryptodev.c +10
-0@@ -2270,6 +2270,167 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void)return TEST_SUCCESS ; } +static inline void +ext_buf_free_callback_fn (void *addr, + void *ext_buf_ptr __rte_unused) +{ +rte_free (addr); +} + +static int +test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer (void ) +{app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2292
Quoted 10 lines
app/test/test_cryptodev.c +10
-0+struct crypto_testsuite_params *ts_params = &testsuite_params; +struct crypto_unittest_params *ut_params = &unittest_params; +int status; +void *buf; +rte_iova_t iova; +uint16_t buf_len =QUOTE_1024_BYTES ; +struct rte_mbuf_ext_shared_info *shinfo =NULL ; +struct rte_mbuf *m; + +Extra line
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2304
Quoted 12 lines
app/test/test_cryptodev.c +12
-0+/* Verify the capabilities */ +struct rte_cryptodev_sym_capability_idx cap_idx; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + cap_idx.algo.auth =RTE_CRYPTO_AUTH_SHA1_HMAC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ; + cap_idx.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + cap_idx.algo.cipher =RTE_CRYPTO_CIPHER_AES_CBC ; +if (rte_cryptodev_sym_capability_get (ts_params->valid_devs[0 ], + &cap_idx) ==NULL ) +return TEST_SKIPPED ;Repeated code.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2308
Quoted 4 lines
app/test/test_cryptodev.c +4
-0+ + buf =rte_malloc (NULL , buf_len,RTE_CACHE_LINE_SIZE ); +if (buf ==NULL ) +return TEST_SKIPPED ;Why skipped? It is an error if malloc is failed.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2320
Quoted 12 lines
app/test/test_cryptodev.c +12
-0+ +rte_memcpy (buf, catch_22_quote,QUOTE_512_BYTES ); + shinfo =rte_pktmbuf_ext_shinfo_init_helper (buf, &buf_len, + ext_buf_free_callback_fn,NULL ); +if (unlikely (shinfo ==NULL )) { +rte_free (buf); +return -1 ; + } + iova =rte_malloc_virt2iova (buf); + m =rte_pktmbuf_alloc (ts_params->mbuf_pool); +if (m ==NULL ) +return TEST_SKIPPED ;Again, it should be
TEST_FAILEDapp/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2324
Quoted 4 lines
app/test/test_cryptodev.c +4
-0+rte_pktmbuf_attach_extbuf (m, buf, iova, buf_len, shinfo); +rte_pktmbuf_reset_headroom (m); + m->pkt_len =QUOTE_512_BYTES ; + m->data_len =QUOTE_512_BYTES ;Please use proper APIs to append data and increase lengths.
app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2325
Quoted 1 line
app/test/test_cryptodev.c +1
-0+ m->data_off =0 ;Why is data off rewritten as 0?
It is modified byrte_pktmbuf_reset_headroom().Quoted 112 lines
app/test/test_cryptodev.c +15
-0+ + ut_params->ibuf = m; + + ut_params->digest = (uint8_t *)rte_pktmbuf_append (ut_params->ibuf, +DIGEST_BYTE_LENGTH_SHA1 ); +TEST_ASSERT_NOT_NULL (ut_params->digest,"no room to append digest"); + +/* Setup Cipher Parameters */ + ut_params->cipher_xform.type =RTE_CRYPTO_SYM_XFORM_CIPHER ; + ut_params->cipher_xform.next = &ut_params->auth_xform; + + ut_params->cipher_xform.cipher.algo =RTE_CRYPTO_CIPHER_AES_CBC ; + ut_params->cipher_xform.cipher.op =RTE_CRYPTO_CIPHER_OP_ENCRYPT ; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length =
CIPHER_KEY_LENGTH_AES_CBC;app/test/test_cryptodev.c +2
-0+ ut_params->cipher_xform.cipher.iv.offset =IV_OFFSET ; + ut_params->cipher_xform.cipher.iv.length =
CIPHER_IV_LENGTH_AES_CBC;app/test/test_cryptodev.c +11
-0+ +/* Setup HMAC Parameters */ + ut_params->auth_xform.type =RTE_CRYPTO_SYM_XFORM_AUTH ; + + ut_params->auth_xform.next =NULL ; + + ut_params->auth_xform.auth.op =RTE_CRYPTO_AUTH_OP_GENERATE ; + ut_params->auth_xform.auth.algo =RTE_CRYPTO_AUTH_SHA1_HMAC ; + ut_params->auth_xform.auth.key.length =HMAC_KEY_LENGTH_SHA1 ; + ut_params->auth_xform.auth.key.data = hmac_sha1_key; + ut_params->auth_xform.auth.digest_length =
DIGEST_BYTE_LENGTH_SHA1;app/test/test_cryptodev.c +38
-0+ + ut_params->sess =rte_cryptodev_sym_session_create ( + ts_params->session_mpool); +TEST_ASSERT_NOT_NULL (ut_params->sess,"Session creation failed" ); + +/* Create crypto session*/ + status =rte_cryptodev_sym_session_init (ts_params->valid_devs[0 ], + ut_params->sess, &ut_params->cipher_xform, + ts_params->session_priv_mpool); + +if (status == -ENOTSUP ) +return TEST_SKIPPED ; + +TEST_ASSERT_EQUAL (status,0 ,"Session init failed" ); + +/* Generate crypto op data structure */ + ut_params->op =rte_crypto_op_alloc (ts_params->op_mpool, +RTE_CRYPTO_OP_TYPE_SYMMETRIC ); +TEST_ASSERT_NOT_NULL (ut_params->op, +"Failed to allocate symmetric crypto operation struct" ); + +rte_crypto_op_attach_sym_session (ut_params->op, ut_params->sess); + +struct rte_crypto_sym_op *sym_op = ut_params->op->sym; + +/* set crypto operation source mbuf */ + sym_op->m_src = ut_params->ibuf; + +/* Set crypto operation authentication parameters */ + sym_op->auth.digest.data = ut_params->digest; + sym_op->auth.digest.phys_addr =rte_pktmbuf_iova_offset ( + ut_params->ibuf,QUOTE_512_BYTES ); + + sym_op->auth.data.offset =0 ; + sym_op->auth.data.length =QUOTE_512_BYTES ; + +/* Copy IV at the end of the crypto operation */ + rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *,
IV_OFFSET),app/test/test_cryptodev.c +17
-0+ aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + +/* Set crypto operation cipher parameters */ + sym_op->cipher.data.offset =0 ; + sym_op->cipher.data.length =QUOTE_512_BYTES ; + +/* Process crypto operation */ +if (gbl_action_type ==RTE_SECURITY_ACTION_TYPE_CPU_CRYPTO ) +process_cpu_crypt_auth_op (ts_params->valid_devs[0 ], + ut_params->op); +else +TEST_ASSERT_NOT_NULL ( +process_crypto_request (ts_params->valid_devs[0 ], + ut_params->op), +"failed to process sym crypto op" ); + + TEST_ASSERT_EQUAL(ut_params->op->status,
RTE_CRYPTO_OP_STATUS_SUCCESS,app/test/test_cryptodev.c +15
-0+ "crypto op processing failed"); + +/* Validate obuf */ +uint8_t *ciphertext =rte_pktmbuf_mtod (ut_params->op->sym->m_src, + uint8_t *); + +TEST_ASSERT_BUFFERS_ARE_EQUAL (ciphertext, + catch_22_quote_2_512_bytes_AES_CBC_ciphertext, +QUOTE_512_BYTES , +"ciphertext data not as expected" ); + +uint8_t *digest = ciphertext +QUOTE_512_BYTES ; + + TEST_ASSERT_BUFFERS_ARE_EQUAL(digest, +catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest,app/test/test_cryptodev.c +2
-0+ gbl_driver_id == rte_cryptodev_driver_id_get( +
RTE_STR(CRYPTODEV_NAME_AESNI_MB_PMD)) ?
+
TRUNCATED_DIGEST_BYTE_LENGTH_SHA1:app/test/test_cryptodev.c test_AES_CBC_HMAC_SHA1_encrypt_digest(void) · line 2429
Quoted 3 lines
app/test/test_cryptodev.c +3
-0+DIGEST_BYTE_LENGTH_SHA1 , + "Generated digest data not as expected"); +Above check for
AESNI_MBnot required.app/test/test_cryptodev.c
Quoted 11 lines
app/test/test_cryptodev.c +4
-1+return TEST_SUCCESS ; +} + +/* ***** AES-CBC / HMAC-SHA512 Hash Tests ***** */ #define HMAC_KEY_LENGTH_SHA512 (DIGEST_BYTE_LENGTH_SHA512) @@ -15458,6 +15619,8 @@ static struct unit_test_suite
cryptodev_gen_testsuite= {app/test/test_cryptodev.c +0
-0TEST_CASE_ST (ut_setup, ut_teardown, test_stats), TEST_CASE_ST(ut_setup, ut_teardown,
test_enq_callback_setup),
Quoted 8 lines
Quoted 1 line
TEST_CASE_ST(ut_setup,
ut_teardown,
test_deq_callback_setup),app/test/test_cryptodev.c static struct unit_test_suite cryptodev_gen_testsuite = { · line 15626
Quoted 6 lines
app/test/test_cryptodev.c +2
-0+ TEST_CASE_ST(ut_setup, ut_teardown, +
test_AES_CBC_HMAC_SHA1_encrypt_digest_ext_buffer),app/test/test_cryptodev.c +0
-0TEST_CASES_END() /**< NULL terminate unit test array */ } };
If you agree, I would like to integrate external buffer testing in blockcipher test cases so that we can test all other cases as well and there will be no need to add additional test case. We can simply integrate it by adding additional "feature_mask" something like BLOCKCIPHER_TEST_FEATURE_EXTERNAL_BUFFER
to the test cases.
I will try to send it as separate patch.
Quoted 2 lines
Quoted 2 lines
--
2.25.1
PATCH 8/8 test/crypto: add short MAC-I test vector for zuc
In reply to Gagandeep SinghAdd a ZUC based short MAC-I test vector.
--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
app/test/test_cryptodev_security_pdcp_test_vectors.h +18 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2015-2016 Freescale Semiconductor,Inc. -* Copyright 2018-2021 NXP +* Copyright 2018-2022 NXP */ #ifndef SECURITY_PDCP_TEST_VECTOR_H_
@@ -128,7 +128,23 @@ static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = { .data_out = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x00, 0x00, 0x00, 0x00 }, }, - + { + .test_idx = 6, + .param = {.name = "PDCP-SMAC ZUC", + .auth_alg = RTE_CRYPTO_AUTH_ZUC_EIA3, + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .auth_key_len = 16, + }, + .auth_key = (uint8_t []){0xB2 ,0xA4 ,0x73 ,0xB6 ,0x78 ,0x5C , +0x51 ,0x8E ,0x9C ,0x1E ,0x9B ,0xC6 , +0x66 ,0xE4 ,0x84 ,0x24 + }, + .data_in = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4 }, + .in_len = 8, + .data_out = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4, 0xCC, 0x7D, 0xD0, 0xE4 }, + }, }; static struct pdcp_test_param pdcp_test_params[] = {
Signature · 1 line
2.25.1
RE: [EXT] [PATCH 8/8] test/crypto: add short MAC-I test vector for zuc
Quoted 3 lines
Add a ZUC based short MAC-I test vector.
Signed-off-by Gagandeep Singh <[email protected]>
Only test vector, where is the test case calling this?
Quoted 46 lines
--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)app/test/test_cryptodev_security_pdcp_test_vectors.h +18
-2@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2015-2016 Freescale Semiconductor,Inc. -* Copyright 2018-2021 NXP +* Copyright 2018-2022 NXP */ #ifndef SECURITY_PDCP_TEST_VECTOR_H_ @@ -128,7 +128,23 @@ static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = { .data_out = (uint8_t []){0x33 ,0x32 ,0x34 ,0x62 ,0x63 ,0x39 ,0x38 ,0x00 ,0x00 ,0x00 ,0x00 }, }, - + { + .test_idx = 6, + .param = {.name = "PDCP-SMAC ZUC", + .auth_alg =RTE_CRYPTO_AUTH_ZUC_EIA3 , + .domain =RTE_SECURITY_PDCP_MODE_SHORT_MAC , + .auth_key_len =16 , + }, + .auth_key = (uint8_t[]){ 0xB2, 0xA4, 0x73, 0xB6, 0x78, 0x5C, +0x51 ,0x8E ,0x9C ,0x1E ,0x9B ,0xC6 , +0x66 ,0xE4 ,0x84 ,0x24 + }, + .data_in = (uint8_t[]){ 0x00, 0x40, 0x00, 0x00, 0x00, 0x05, +0x09 ,0xe4 }, + .in_len = 8, + .data_out = (uint8_t[]){ 0x00, 0x40, 0x00, 0x00, 0x00, 0x05, + 0x09, 0xe4, 0xCC, 0x7D, 0xD0, 0xE4 }, + }, };static struct
pdcp_test_parampdcp_test_params[] = {
--
2.25.1
RE: [EXT] [PATCH 8/8] test/crypto: add short MAC-I test vector for zuc
Hi
Quoted 11 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 4:16 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH 8/8] test/crypto: add short MAC-I test vector for zucQuoted 3 lines
Add a ZUC based short MAC-I test vector.
Signed-off-by Gagandeep Singh <[email protected]>Only test vector, where is the test case calling this?
There is test case available in "test_PDCP_PROTO_short_mac" Which is running all the vectors available in "list_pdcp_smac_tests"
Quoted 47 lines
Quoted 47 lines
--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)app/test/test_cryptodev_security_pdcp_test_vectors.h +18
-2@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2015-2016 Freescale Semiconductor,Inc. -* Copyright 2018-2021 NXP +* Copyright 2018-2022 NXP */ #ifndef SECURITY_PDCP_TEST_VECTOR_H_ @@ -128,7 +128,23 @@ static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = { .data_out = (uint8_t []){0x33 ,0x32 ,0x34 ,0x62 ,0x63 ,0x39 ,0x38 ,0x00 ,0x00 ,0x00 ,0x00 }, }, - + { + .test_idx = 6, + .param = {.name = "PDCP-SMAC ZUC", + .auth_alg =RTE_CRYPTO_AUTH_ZUC_EIA3 , + .domain =RTE_SECURITY_PDCP_MODE_SHORT_MAC , + .auth_key_len =16 , + }, + .auth_key = (uint8_t[]){ 0xB2, 0xA4, 0x73, 0xB6, 0x78, 0x5C, +0x51 ,0x8E ,0x9C ,0x1E ,0x9B ,0xC6 , +0x66 ,0xE4 ,0x84 ,0x24 + }, + .data_in = (uint8_t[]){ 0x00, 0x40, 0x00, 0x00, 0x00, 0x05, +0x09 ,0xe4 }, + .in_len = 8, + .data_out = (uint8_t[]){ 0x00, 0x40, 0x00, 0x00, 0x00, 0x05, + 0x09, 0xe4, 0xCC, 0x7D, 0xD0, 0xE4 }, + }, };static struct
pdcp_test_parampdcp_test_params[] = {
--
2.25.1
Hi Gagan,
Quoted 5 lines
Issue more dequeue commands if the gap between enqueued and dequeued packets is more than burst size *8
Signed-off-by Gagandeep Singh <[email protected]>---
Why is this change required? What gain are we getting? I see a performance drop due to this patch.
Quoted 65 lines
app/test-crypto-perf/cperf_test_throughput.c | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_test_throughput.c +0
-0
perf/cperf_test_throughput.c
indexcecf30e470..5cd8919c91100644app/test-crypto-perf/cperf_test_throughput.c +4
-19@@ -223,26 +223,30 @@ cperf_throughput_test_runner(void *test_ctx) ops_unused = burst_size - ops_enqd; ops_enqd_total += ops_enqd; -/* Dequeue processed burst of ops from crypto device */ - ops_deqd =rte_cryptodev_dequeue_burst (ctx->dev_id, ctx->qp_id, - ops_processed, test_burst_size); - -if (likely (ops_deqd)) { -/* Free crypto ops so they can be reused. */ -rte_mempool_put_bulk (ctx->pool, - (void **)ops_processed, ops_deqd); - - ops_deqd_total += ops_deqd; - }else { -/** -* Count dequeue polls which didn't return any -* processed operations. This statistic is mainly -* relevant to hw accelerators. -*/ - ops_deqd_failed++; - } - + do { + ops_deqd = rte_cryptodev_dequeue_burst( + ctx->dev_id, ctx->qp_id, + ops_processed,
test_burst_size);app/test-crypto-perf/cperf_test_throughput.c +5
-0+ +if (likely (ops_deqd)) { +/* Free crypto ops for reuse */ + rte_mempool_put_bulk(ctx->pool, + (void**)ops_processed,
app/test-crypto-perf/cperf_test_throughput.c +14
-1+ ops_deqd); + + ops_deqd_total += ops_deqd; + }else { +/** +* Count dequeue polls which didn't +* return any processed operations. +* This statistic is mainly relevant +* to hw accelerators. +*/ + ops_deqd_failed++; + } + }while (ops_enqd_total - ops_deqd_total > + test_burst_size *8 ); }/* Dequeue any operations still in the crypto device */ --2.25.1
Hi
Quoted 8 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 3:17 PM
To: Gagandeep Singh <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Cc: Anoob Joseph <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logic
Quoted 8 lines
Hi Gagan,
Quoted 5 lines
Issue more dequeue commands if the gap between enqueued and dequeued packets is more than burst size *8
Signed-off-by Gagandeep Singh <[email protected]>---
Why is this change required? What gain are we getting? I see a performance drop due to this patch.
Issue is, in case if security engine/driver is slow in processing the Jobs especially for larger packet sizes then in that case application will keep enqueuing packets with higher rate than dequeue which may results in buffer pool exhaustion.
Application has option to increase pool size but that may not be Helpful for the platforms those with memory constraints.
We can work on limiting the enqueue side instead of keeping the dequeue to avoid any performance drop due to any empty dequeue.
Dropping this patch from this series. I will update the logic and will try to send as separate patch.
Quoted 66 lines
Quoted 66 lines
app/test-crypto-perf/cperf_test_throughput.c | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-)app/test-crypto- renamed from app/test-crypto-perf/cperf_test_throughput.c +0
-0
perf/cperf_test_throughput.c
indexcecf30e470..5cd8919c91100644app/test-crypto-perf/cperf_test_throughput.c +4
-19@@ -223,26 +223,30 @@ cperf_throughput_test_runner(void *test_ctx) ops_unused = burst_size - ops_enqd; ops_enqd_total += ops_enqd; -/* Dequeue processed burst of ops from crypto device */ - ops_deqd =rte_cryptodev_dequeue_burst (ctx->dev_id, ctx->qp_id, - ops_processed, test_burst_size); - -if (likely (ops_deqd)) { -/* Free crypto ops so they can be reused. */ -rte_mempool_put_bulk (ctx->pool, - (void **)ops_processed, ops_deqd); - - ops_deqd_total += ops_deqd; - }else { -/** -* Count dequeue polls which didn't return any -* processed operations. This statistic is mainly -* relevant to hw accelerators. -*/ - ops_deqd_failed++; - } - + do { + ops_deqd = rte_cryptodev_dequeue_burst( + ctx->dev_id, ctx->qp_id, + ops_processed,
test_burst_size);app/test-crypto-perf/cperf_test_throughput.c +5
-0+ +if (likely (ops_deqd)) { +/* Free crypto ops for reuse */ + rte_mempool_put_bulk(ctx->pool, + (void**)ops_processed,
app/test-crypto-perf/cperf_test_throughput.c +14
-1+ ops_deqd); + + ops_deqd_total += ops_deqd; + }else { +/** +* Count dequeue polls which didn't +* return any processed operations. +* This statistic is mainly relevant +* to hw accelerators. +*/ + ops_deqd_failed++; + } + }while (ops_enqd_total - ops_deqd_total > + test_burst_size *8 ); }/* Dequeue any operations still in the crypto device */ --2.25.1
Hi Gagandeep,
Please see inline.
Thanks,
Anoob
Quoted 25 lines
-----Original Message-----
From: Gagandeep Singh <[email protected]>
Sent: Monday, May 16, 2022 12:44 PM
To: Akhil Goyal <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Cc: Anoob Joseph <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logicHi
Quoted 15 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 3:17 PM
To: Gagandeep Singh <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Cc: Anoob Joseph <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logicHi Gagan,
Quoted 5 lines
Issue more dequeue commands if the gap between enqueued and dequeued packets is more than burst size *8
Signed-off-by Gagandeep Singh <[email protected]>---
Quoted 8 lines
Quoted 2 lines
Why is this change required? What gain are we getting? I see a performance drop due to this patch.
Issue is, in case if security engine/driver is slow in processing the Jobs especially for larger packet sizes then in that case application will keep enqueuing packets with higher rate than dequeue which may results in buffer pool exhaustion. Application has option to increase pool size but that may not be Helpful for the platforms those with memory constraints.
[Anoob] Can you elaborate the issue that you are hitting?
Quoted 3 lines
We can work on limiting the enqueue side instead of keeping the dequeue to avoid any performance drop due to any empty dequeue.
[Anoob] Shouldn't PMD take care of limiting the enqueue side? Application can specify the desired queue depth and when application enqueues beyond that, enqueue API can return 0. Wouldn't that good enough?
Quoted 71 lines
Dropping this patch from this series. I will update the logic and will try to send as separate patch.
Quoted 14 lines
Quoted 14 lines
app/test-crypto-perf/cperf_test_throughput.c | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-)(quoted diff) +0
-0b/app/test-crypto-
perf/cperf_test_throughput.cindexcecf30e470..5cd8919c91100644app/test-crypto-perf/cperf_test_throughput.c +0
-0@@ -223,26 +223,30 @@ cperf_throughput_test_runner(void *test_ctx) ops_unused = burst_size - ops_enqd; ops_enqd_total += ops_enqd;Quoted 2 lines
app/test-crypto-perf/cperf_test_throughput.c cperf_throughput_test_runner(void *test_ctx) · line 226
Quoted 2 lines
app/test-crypto-perf/cperf_test_throughput.c +0
-1-/* Dequeue processed burst of ops from crypto device */
Quoted 50 lines
Quoted 50 lines
app/test-crypto-perf/cperf_test_throughput.c +9
-18- ops_deqd =rte_cryptodev_dequeue_burst (ctx->dev_id, ctx->qp_id, - ops_processed, test_burst_size); - -if (likely (ops_deqd)) { -/* Free crypto ops so they can be reused. */ -rte_mempool_put_bulk (ctx->pool, - (void **)ops_processed, ops_deqd); - - ops_deqd_total += ops_deqd; - }else { -/** -* Count dequeue polls which didn't return any -* processed operations. This statistic is mainly -* relevant to hw accelerators. -*/ - ops_deqd_failed++; - } - + do { + ops_deqd = rte_cryptodev_dequeue_burst( + ctx->dev_id, ctx->qp_id, + ops_processed, test_burst_size); + + if (likely(ops_deqd)) { + /* Free crypto ops for reuse */ + rte_mempool_put_bulk(ctx->pool, + (void**)ops_processed,
app/test-crypto-perf/cperf_test_throughput.c +14
-1+ ops_deqd); + + ops_deqd_total += ops_deqd; + }else { +/** +* Count dequeue polls which didn't +* return any processed operations. +* This statistic is mainly relevant +* to hw accelerators. +*/ + ops_deqd_failed++; + } + }while (ops_enqd_total - ops_deqd_total > + test_burst_size *8 ); }/* Dequeue any operations still in the crypto device */ --2.25.1
Hi,
Quoted 54 lines
-----Original Message-----
From: Anoob Joseph <[email protected]>
Sent: Monday, May 16, 2022 12:57 PM
To: Gagandeep Singh <[email protected]>
Cc: Akhil Goyal <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logicHi Gagandeep,
Please see inline.
Thanks,
AnoobQuoted 24 lines
-----Original Message-----
From: Gagandeep Singh <[email protected]>
Sent: Monday, May 16, 2022 12:44 PM
To: Akhil Goyal <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Cc: Anoob Joseph <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logicHi
Quoted 13 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Friday, May 13, 2022 3:17 PM
To: Gagandeep Singh <[email protected]>; [email protected]; Hemant Agrawal <[email protected]>
Cc: Anoob Joseph <[email protected]>
Subject: RE: [EXT] [PATCH 1/8] app/test-crypto-perf: improve dequeue logicHi Gagan,
Quoted 3 lines
Issue more dequeue commands if the gap between enqueued and dequeued packets is more than burst size *8
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Signed-off-by Gagandeep Singh <[email protected]>---
Why is this change required? What gain are we getting? I see a performance drop due to this patch.
Issue is, in case if security engine/driver is slow in processing the Jobs especially for larger packet sizes then in that case application will keep enqueuing packets with higher rate than dequeue which may results
in buffer pool exhaustion.
Quoted 2 lines
Application has option to increase pool size but that may not be Helpful for the platforms those with memory constraints.
[Anoob] Can you elaborate the issue that you are hitting?
Quoted 1 line
Quoted 6 lines
Quoted 2 lines
We can work on limiting the enqueue side instead of keeping the dequeue to avoid any performance drop due to any empty dequeue.
[Anoob] Shouldn't PMD take care of limiting the enqueue side? Application can specify the desired queue depth and when application enqueues beyond that, enqueue API can return 0. Wouldn't that good enough?
Agree. Unfortunately, Currently In the NXP platform drivers like dpaa_sec, caam_jr not using the API's given queue depth. This is what I will discuss internally to support this in the PMDs itself to limit the enqueue, if we can do so without impacting the NXP's PMDs performance.
Quoted 71 lines
Quoted 71 lines
Dropping this patch from this series. I will update the logic and will try to send as separate patch.
Quoted 14 lines
Quoted 14 lines
app/test-crypto-perf/cperf_test_throughput.c | 42 +++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-)(quoted diff) +0
-0b/app/test-crypto-
perf/cperf_test_throughput.cindexcecf30e470..5cd8919c91100644app/test-crypto-perf/cperf_test_throughput.c +0
-0@@ -223,26 +223,30 @@ cperf_throughput_test_runner(void *test_ctx) ops_unused = burst_size - ops_enqd; ops_enqd_total += ops_enqd;Quoted 2 lines
app/test-crypto-perf/cperf_test_throughput.c cperf_throughput_test_runner(void *test_ctx) · line 226
Quoted 2 lines
app/test-crypto-perf/cperf_test_throughput.c +0
-1-/* Dequeue processed burst of ops from crypto device */
Quoted 50 lines
Quoted 50 lines
app/test-crypto-perf/cperf_test_throughput.c +9
-18- ops_deqd =rte_cryptodev_dequeue_burst (ctx->dev_id, ctx->qp_id, - ops_processed, test_burst_size); - -if (likely (ops_deqd)) { -/* Free crypto ops so they can be reused. */ -rte_mempool_put_bulk (ctx->pool, - (void **)ops_processed, ops_deqd); - - ops_deqd_total += ops_deqd; - }else { -/** -* Count dequeue polls which didn't return any -* processed operations. This statistic is mainly -* relevant to hw accelerators. -*/ - ops_deqd_failed++; - } - + do { + ops_deqd = rte_cryptodev_dequeue_burst( + ctx->dev_id, ctx->qp_id, + ops_processed, test_burst_size); + + if (likely(ops_deqd)) { + /* Free crypto ops for reuse */ + rte_mempool_put_bulk(ctx->pool, + (void**)ops_processed,
app/test-crypto-perf/cperf_test_throughput.c +14
-1+ ops_deqd); + + ops_deqd_total += ops_deqd; + }else { +/** +* Count dequeue polls which didn't +* return any processed operations. +* This statistic is mainly relevant +* to hw accelerators. +*/ + ops_deqd_failed++; + } + }while (ops_enqd_total - ops_deqd_total > + test_burst_size *8 ); }/* Dequeue any operations still in the crypto device */ --2.25.1
v2 cover Crypto related changes in sample/test apps
In reply to Gagandeep Singhv2-change-log:
* dropped qeueue improve logic in crypto-perf app patch
* removed external buffer patch in this series.
* update documentation.
Gagandeep Singh (7):
app/test-crypto-perf: support SDAP for PDCP operations examples/ipsec-secgw: support XCBC-MAC/DES-CBC examples/l2fwd-crypto: add signal handler for exit test/crypto: fix PMD name for dpaa raw buffer crypto driver test/crypto: support raw buffer APIs for PDCP test/crypto: add short MAC-I test vector for zuc
doc: add missing authentication algorithm
app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++ app/test/test_cryptodev.c | 24 ++++++++++++++++--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 ++++++++++++++-- doc/guides/sample_app_ug/ipsec_secgw.rst | 8 +++++-- doc/guides/tools/cryptoperf.rst | 4 ++++ examples/ipsec-secgw/esp.c | 5 ++++ examples/ipsec-secgw/sa.c | 8 +++++++ examples/l2fwd-crypto/main.c | 16 +++++++++++++ 10 files changed, 93 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/7 app/test-crypto-perf: support SDAP for PDCP operations
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c 0xc --log-level=8 -- --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 19 insertions(+)
app/test-crypto-perf/cperf_ops.c +1 -0
@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xform
app/test-crypto-perf/cperf_options.h +2 -0
@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")
@@ -129,6 +130,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif
app/test-crypto-perf/cperf_options_parsing.c +12 -0
@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",
@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ; } +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +} +static int parse_cipher_algo (struct cperf_options *opts,const char *arg) {
@@ -879,6 +889,7 @@ static struct option lgopts[] = { { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, + { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, #endif { CPERF_CSV, no_argument, 0, 0},
@@ -994,6 +1005,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, + { CPERF_ENABLE_SDAP, parse_enable_sdap }, { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, #endif { CPERF_CSV, parse_csv_friendly},
doc/guides/tools/cryptoperf.rst +4 -0
@@ -332,6 +332,10 @@ The following are the application command-line options: Enable fixed session based HFN instead of per packet HFN. +* ``--enable-sdap`` + + Enable Service Data Adaptation Protocol. + * ``--modex-len <n>`` Set modex length for asymmetric crypto perf test.
Signature · 1 line
2.25.1
v3 cover Crypto related changes in sample/test apps
v2-change-log:
* dropped qeueue improve logic in crypto-perf app patch
* removed external buffer patch in this series.
* update documentation.
v3-change-log:
* update signal handler's variable in l2fwd-crypto
Gagandeep Singh (7):
app/test-crypto-perf: support SDAP for PDCP operations examples/ipsec-secgw: support XCBC-MAC/DES-CBC examples/l2fwd-crypto: add signal handler for exit test/crypto: fix PMD name for dpaa raw buffer crypto driver test/crypto: support raw buffer APIs for PDCP test/crypto: add short MAC-I test vector for zuc
doc: add missing authentication algorithm
app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++ app/test/test_cryptodev.c | 24 ++++++++++++++++--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 ++++++++++++++-- doc/guides/sample_app_ug/ipsec_secgw.rst | 8 +++++-- doc/guides/tools/cryptoperf.rst | 4 ++++ examples/ipsec-secgw/esp.c | 5 ++++ examples/ipsec-secgw/sa.c | 8 +++++++ examples/l2fwd-crypto/main.c | 16 +++++++++++++ 10 files changed, 93 insertions(+), 7 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/7 app/test-crypto-perf: support SDAP for PDCP operations
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c 0xc --log-level=8 -- --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 19 insertions(+)
app/test-crypto-perf/cperf_ops.c +1 -0
@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xform
app/test-crypto-perf/cperf_options.h +2 -0
@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")
@@ -129,6 +130,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif
app/test-crypto-perf/cperf_options_parsing.c +12 -0
@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",
@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ; } +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +} +static int parse_cipher_algo (struct cperf_options *opts,const char *arg) {
@@ -879,6 +889,7 @@ static struct option lgopts[] = { { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, + { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, #endif { CPERF_CSV, no_argument, 0, 0},
@@ -994,6 +1005,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, + { CPERF_ENABLE_SDAP, parse_enable_sdap }, { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, #endif { CPERF_CSV, parse_csv_friendly},
doc/guides/tools/cryptoperf.rst +4 -0
@@ -332,6 +332,10 @@ The following are the application command-line options: Enable fixed session based HFN instead of per packet HFN. +* ``--enable-sdap`` + + Enable Service Data Adaptation Protocol. + * ``--modex-len <n>`` Set modex length for asymmetric crypto perf test.
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operations
Quoted 67 lines
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c0xc--log-level=8 -- --devtypecrypto_dpaa2_sec--optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdapSigned-off-by Gagandeep Singh <[email protected]>--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 19 insertions(+)app/test-crypto-perf/cperf_ops.c +1
-0@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xformapp/test-crypto- renamed from app/test-crypto-perf/cperf_options.h +0
-0
perf/cperf_options.h
index09caefde22..613d6d31e2100644app/test-crypto-perf/cperf_options.h +2
-0@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")@@ -129,6 +130,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif app/test-crypto- renamed from app/test-crypto-perf/cperf_options_parsing.c +0
-0
perf/cperf_options_parsing.c
index09c98121c8..28680347f1100644app/test-crypto-perf/cperf_options_parsing.c +1
-0@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ;
app/test-crypto-perf/cperf_options_parsing.c parse_silent(struct cperf_options *opts, · line 559
Quoted 10 lines
app/test-crypto-perf/cperf_options_parsing.c +8
-0} +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +}
You should also set a default value of this flag.
RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operations
Hi,
Quoted 75 lines
-----Original Message-----
From: Akhil Goyal <[email protected]>
Sent: Thursday, May 26, 2022 7:23 PM
To: Gagandeep Singh <[email protected]>; [email protected]
Subject: RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operationsQuoted 68 lines
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c0xc--log-level=8 -- --devtypecrypto_dpaa2_sec--optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdapSigned-off-by Gagandeep Singh <[email protected]>--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 19 insertions(+)app/test-crypto-perf/cperf_ops.c +1
-0@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xformapp/test-crypto- renamed from app/test-crypto-perf/cperf_options.h +0
-0
perf/cperf_options.hindex09caefde22..613d6d31e2100644app/test-crypto-perf/cperf_options.h +2
-0@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")@@ -129,6 +130,7 @@ struct cperf_options { #ifdef RTE_LIB_SECURITYuint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif (quoted diff) +0
-0b/app/test-crypto-
perf/cperf_options_parsing.cindex09c98121c8..28680347f1100644app/test-crypto-perf/cperf_options_parsing.c +1
-0@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ; }
Quoted 10 lines
app/test-crypto-perf/cperf_options_parsing.c parse_silent(struct cperf_options *opts, · line 559
Quoted 8 lines
app/test-crypto-perf/cperf_options_parsing.c +8
-0+static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +}You should also set a default value of this flag.
Default functionality is disable SDAP. Application is defining the cperf options with all values 0s in its main(): "struct cperf_options opts = {0};". Is n't it sufficient?
RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operations
Quoted 80 lines
Quoted 19 lines
Quoted 19 lines
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c0xc--log-level=8 -- --devtypecrypto_dpaa2_sec--optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdapSigned-off-by Gagandeep Singh <[email protected]>--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 12 ++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 19 insertions(+)Quoted 6 lines
app/test-crypto-perf/cperf_ops.c cperf_create_session(struct rte_mempool
Quoted 6 lines
app/test-crypto-perf/cperf_ops.c +0
-0@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool
*sess_mp,Quoted 43 lines
Quoted 43 lines
app/test-crypto-perf/cperf_ops.c +1
-0.hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xformapp/test-crypto- renamed from app/test-crypto-perf/cperf_options.h +0
-0
perf/cperf_options.hindex09caefde22..613d6d31e2100644app/test-crypto-perf/cperf_options.h +2
-0@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")@@ -129,6 +130,7 @@ struct cperf_options { #ifdef RTE_LIB_SECURITYuint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif (quoted diff) +0
-0b/app/test-crypto-
perf/cperf_options_parsing.cindex09c98121c8..28680347f1100644app/test-crypto-perf/cperf_options_parsing.c +1
-0@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ; }Quoted 10 lines
app/test-crypto-perf/cperf_options_parsing.c parse_silent(struct cperf_options *opts, · line 559
Quoted 8 lines
app/test-crypto-perf/cperf_options_parsing.c +8
-0+static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +}You should also set a default value of this flag.
Quoted 3 lines
Default functionality is disable SDAP. Application is defining the cperf options with all values 0s in its
main(): "structcperf_optionsopts = {0};". Is n't it sufficient?
It would be good to initialize that with other options. It will help in debugging and Improve code readability.
Please add it in cperf_options_default() as it is done for other PDCP options.
RE: [EXT] [PATCH v3 1/7] app/test-crypto-perf: support SDAP for PDCP operations
Quoted 10 lines
Quoted 5 lines
Quoted 1 line
You should also set a default value of this flag.
Default functionality is disable SDAP. Application is defining the cperf options with all values 0s in its
main(): "structcperf_optionsopts = {0};". Is n't it sufficient?It would be good to initialize that with other options. It will help in debugging and
Improve code readability.
Please add it incperf_options_default()as it is done for other PDCP options.
Please send v4 of this patch as standalone patch. The rest of the patches have been Applied to dpdk-next-crypto
Thanks.
PATCH v4 1/1 app/test-crypto-perf: support SDAP for PDCP operations
In reply to Gagandeep SinghAdd a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c 0xc --log-level=8 -- --devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
---
v2-change-log:
* dropped qeueue improve logic in crypto-perf app patch
* removed external buffer patch in this series.
* update documentation.
v3-change-log:
* update signal handler's variable in l2fwd-crypto
v4-change-log:
* added default value for sdap option.
* Sending standalone patch as all other patches
have been applied.
--- app/test-crypto-perf/cperf_ops.c | 1 + app/test-crypto-perf/cperf_options.h | 2 ++ app/test-crypto-perf/cperf_options_parsing.c | 13 +++++++++++++ doc/guides/tools/cryptoperf.rst | 4 ++++ 4 files changed, 20 insertions(+)
app/test-crypto-perf/cperf_ops.c +1 -0
@@ -861,6 +861,7 @@ cperf_create_session(struct rte_mempool *sess_mp, .hfn = options->pdcp_ses_hfn_en ? PDCP_DEFAULT_HFN : 0, .hfn_threshold = 0x70C0A, + .sdap_enabled = options->pdcp_sdap, .hfn_ovrd = !(options->pdcp_ses_hfn_en), } }, .crypto_xform = &cipher_xform
app/test-crypto-perf/cperf_options.h +2 -0
@@ -14,6 +14,7 @@#define CPERF_PTEST_TYPE ("ptest")#define CPERF_MODEX_LEN ("modex-len")#define CPERF_SILENT ("silent") +#define CPERF_ENABLE_SDAP ("enable-sdap")#define CPERF_POOL_SIZE ("pool-sz")#define CPERF_TOTAL_OPS ("total-ops")
@@ -129,6 +130,7 @@ struct cperf_options {#ifdef RTE_LIB_SECURITY uint16_t pdcp_sn_sz;uint16_t pdcp_ses_hfn_en; +uint16_t pdcp_sdap;enum rte_security_pdcp_domain pdcp_domain;uint16_t docsis_hdr_sz;#endif
app/test-crypto-perf/cperf_options_parsing.c +13 -0
@@ -64,6 +64,7 @@ usage(char *progname)" --pdcp-sn-sz N: set PDCP SN size N <5/7/12/15/18>\n" " --pdcp-domain DOMAIN: set PDCP domain <control/user>\n" " --pdcp-ses-hfn-en: enable session based fixed HFN\n" +" --enable-sdap: enable sdap\n" " --docsis-hdr-sz: set DOCSIS header size\n"#endif " -h: prints this help\n",
@@ -548,6 +549,15 @@ parse_silent(struct cperf_options *opts,return 0 ; } +static int +parse_enable_sdap (struct cperf_options *opts, + const char *arg __rte_unused) +{ + opts->pdcp_sdap =1 ; + +return 0 ; +} +static int parse_cipher_algo (struct cperf_options *opts,const char *arg) {
@@ -879,6 +889,7 @@ static struct option lgopts[] = { { CPERF_PDCP_SN_SZ, required_argument, 0, 0 }, { CPERF_PDCP_DOMAIN, required_argument, 0, 0 }, { CPERF_PDCP_SES_HFN_EN, no_argument, 0, 0 }, + { CPERF_ENABLE_SDAP, no_argument, 0, 0 }, { CPERF_DOCSIS_HDR_SZ, required_argument, 0, 0 }, #endif { CPERF_CSV, no_argument, 0, 0},
@@ -951,6 +962,7 @@ cperf_options_default(struct cperf_options *opts) opts->pdcp_sn_sz =12 ; opts->pdcp_domain =RTE_SECURITY_PDCP_MODE_CONTROL ; opts->pdcp_ses_hfn_en =0 ; + opts->pdcp_sdap =0 ; opts->docsis_hdr_sz =17 ;#endif opts->modex_data = (struct cperf_modex_test_data *)&modex_perf_data[0 ];
@@ -994,6 +1006,7 @@ cperf_opts_parse_long(int opt_idx, struct cperf_options *opts) { CPERF_PDCP_SN_SZ, parse_pdcp_sn_sz }, { CPERF_PDCP_DOMAIN, parse_pdcp_domain }, { CPERF_PDCP_SES_HFN_EN, parse_pdcp_ses_hfn_en }, + { CPERF_ENABLE_SDAP, parse_enable_sdap }, { CPERF_DOCSIS_HDR_SZ, parse_docsis_hdr_sz }, #endif { CPERF_CSV, parse_csv_friendly},
doc/guides/tools/cryptoperf.rst +4 -0
@@ -332,6 +332,10 @@ The following are the application command-line options: Enable fixed session based HFN instead of per packet HFN. +* ``--enable-sdap`` + + Enable Service Data Adaptation Protocol. + * ``--modex-len <n>`` Set modex length for asymmetric crypto perf test.
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v4] app/test-crypto-perf: support SDAP for PDCP operations
Quoted 11 lines
Add a command line option "--enable-sdap" to enable Service Data Adaptation Protocol.
example command:
./dpdk-test-crypto-perf -c0xc--log-level=8 -- --devtypecrypto_dpaa2_sec--optype pdcp --cipher-algo aes-ctr --cipher-op encrypt --auth-algo zuc-eia3 --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 --enable-sdap
Quoted 1 line
Signed-off-by Gagandeep Singh <[email protected]>
Applied to dpdk-next-crypto
Thanks.
PATCH v3 2/7 examples/ipsec-secgw: support XCBC-MAC/DES-CBC
In reply to Gagandeep Singhipsec-secgw application is updated to support
DES-CBC ciphering and XCBC-MAC authentication
based IPsec functionality.
--- doc/guides/sample_app_ug/ipsec_secgw.rst | 7 +++++-- examples/ipsec-secgw/esp.c | 5 +++++ examples/ipsec-secgw/sa.c | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
doc/guides/sample_app_ug/ipsec_secgw.rst +5 -2
@@ -115,8 +115,9 @@ Constraints * No IPv6 options headers. * No AH mode. -* Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, HMAC-SHA1, - AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 and NULL. +* Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, DES-CBC, + HMAC-SHA1, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 + and NULL. * Each SA must be handle by a unique lcore (*1 RX queue per port*). Compiling the Application
@@ -566,6 +567,7 @@ where each options means: * *aes-256-cbc*: AES-CBC 256-bit algorithm * *aes-128-ctr*: AES-CTR 128-bit algorithm * *3des-cbc*: 3DES-CBC 192-bit algorithm + * *des-cbc*: DES-CBC 64-bit algorithm * Syntax: *cipher_algo <your algorithm>*
@@ -593,6 +595,7 @@ where each options means: * *null*: NULL algorithm * *sha1-hmac*: HMAC SHA1 algorithm + * *aes-xcbc-mac*: AES XCBC MAC algorithm ``<auth_key>``
examples/ipsec-secgw/esp.c +5 -0
@@ -100,6 +100,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :/* Copy IV at the end of crypto operation */
@@ -121,6 +122,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + payload_len;
@@ -336,6 +338,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :memset (iv,0 , sa->iv_len);
@@ -399,6 +402,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC : sym_cop->cipher.data.offset = ip_hdr_len +
@@ -431,6 +435,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + pad_payload_len;
examples/ipsec-secgw/sa.c +8 -0
@@ -119,6 +119,13 @@ const struct supported_cipher_algo cipher_algos[] = { .iv_len = 8, .block_size = 8, .key_len = 24 + }, + { + .keyword = "des-cbc", + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .iv_len = 8, + .block_size = 8, + .key_len = 8 } };
@@ -1311,6 +1318,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 2/7] examples/ipsec-secgw: support XCBC-MAC/DES-CBC
Quoted 6 lines
ipsec-secgw application is updated to support
DES-CBC ciphering and XCBC-MAC authentication
based IPsec functionality.Signed-off-by Gagandeep Singh <[email protected]>---
PATCH v3 3/7 examples/l2fwd-crypto: add signal handler for exit
In reply to Gagandeep SinghHandle SIGINT and SIGTERM signals.
--- examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
examples/l2fwd-crypto/main.c +16 -0
@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h>
@@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];#define MAX_TIMER_PERIOD 86400UL/* 1 day max */ #define DEFAULT_TIMER_PERIOD 10UL +/* Global signal */ +static volatile bool signal_received; +/* Print out statistics on packets dropped */ static void print_stats (void )
@@ -922,6 +926,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) nb_rx =rte_eth_rx_burst (portid,0 , pkts_burst,MAX_PKT_BURST ); +if (unlikely (signal_received)) +return ; port_statistics[portid].rx += nb_rx;
@@ -2760,6 +2766,13 @@ reserve_key_memory(struct l2fwd_crypto_options *options) options->aad.phys_addr =rte_malloc_virt2iova (options->aad.data); } +static void +raise_signal (int signum) +{ +if (signum ==SIGINT || signum ==SIGTERM ) + signal_received = true; +} +int main (int argc,char **argv) {
@@ -2772,6 +2785,9 @@ main(int argc, char **argv)int ret, enabled_cdevcount, enabled_portcount;uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS ] = {0 }; +signal (SIGINT , raise_signal); +signal (SIGTERM , raise_signal); +/* init EAL */ ret =rte_eal_init (argc, argv);if (ret <0 )
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 3/7] examples/l2fwd-crypto: add signal handler for exit
Hi Stephen,
Quoted 4 lines
Handle SIGINT and SIGTERM signals.
Signed-off-by Gagandeep Singh <[email protected]>---
Do you have more comments on this? If not, can you please ack?
Quoted 63 lines
examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)examples/l2fwd-crypto/main.c +4
-0@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h> @@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS ];#define MAX_TIMER_PERIOD 86400UL/* 1 day max */ #define DEFAULT_TIMER_PERIOD 10UL +/* Global signal */ +static volatile bool signal_received; +/* Print out statistics on packets dropped */ static void
print_stats(void)examples/l2fwd-crypto/main.c +9
-0@@ -922,6 +926,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) nb_rx =rte_eth_rx_burst (portid,0 , pkts_burst,MAX_PKT_BURST ); +if (unlikely (signal_received)) +return ; port_statistics[portid].rx += nb_rx;@@ -2760,6 +2766,13 @@ reserve_key_memory(struct l2fwd_crypto_options *options) options->aad.phys_addr =rte_malloc_virt2iova (options->aad.data); } +static void +raise_signal (int signum) +{ +if (signum ==SIGINT || signum ==SIGTERM ) + signal_received = true; +} +int main (int argc,char **argv){
examples/l2fwd-crypto/main.c +3
-1@@ -2772,6 +2785,9 @@ main(int argc, char **argv)int ret, enabled_cdevcount, enabled_portcount;uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS ] = {0 }; +signal (SIGINT , raise_signal); +signal (SIGTERM , raise_signal); +/* init EAL */ ret =rte_eal_init (argc, argv);if (ret <0 ) --2.25.1
PATCH v3 4/7 test/crypto: fix PMD name for dpaa raw buffer crypto driver
In reply to Gagandeep SinghPMD name for DPAA raw buffer crypto driver test cases is updated with correct name.
--- app/test/test_cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev.c +1 -1
@@ -16588,7 +16588,7 @@ test_cryptodev_dpaa2_sec_raw_api(void)static int test_cryptodev_dpaa_sec_raw_api (void ) { -static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA2_SEC_PMD ); +static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD );int ret; ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP,
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 4/7] test/crypto: fix PMD name for dpaa raw buffer crypto driver
Quoted 7 lines
PMD name for DPAA raw buffer crypto driver test cases is updated with correct name.
Fixes cd8166c28cd1 ("test/crypto: add raw API test for dpaax")Signed-off-by Gagandeep Singh <[email protected]>
PATCH v3 5/7 test/crypto: support raw buffer APIs for PDCP
In reply to Gagandeep SinghThis patch supports raw buffer APIs testing for
PDCP test cases.
--- app/test/test_cryptodev.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
app/test/test_cryptodev.c +20 -2
@@ -8370,6 +8370,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,struct rte_security_ctx *ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx ( ts_params->valid_devs[0 ]); +struct rte_cryptodev_info dev_info; +uint64_t feat_flags; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); + feat_flags = dev_info.feature_flags;/* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx;
@@ -8391,6 +8396,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, input_vec_len);memcpy (plaintext, input_vec, input_vec_len); +if ((global_api_test_type ==CRYPTODEV_RAW_API_TEST ) && + (!(feat_flags &RTE_CRYPTODEV_FF_SYM_RAW_DP ))) { +printf ("Device does not support RAW data-path APIs.\n" ); +return TEST_SKIPPED ; + }/* Out of place support */ if (oop) {/*
@@ -8483,8 +8493,16 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, ut_params->op->sym->m_dst = ut_params->obuf;/* Process crypto operation */ -if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) - ==NULL ) { +if (global_api_test_type ==CRYPTODEV_RAW_API_TEST ) { +/* filling lengths */ + ut_params->op->sym->cipher.data.length = ut_params->op->sym->m_src->pkt_len; + ut_params->op->sym->auth.data.length = ut_params->op->sym->m_src->pkt_len; +process_sym_raw_dp_op (ts_params->valid_devs[0 ],0 , + ut_params->op,1 ,1 ,0 ,0 ); + }else { + ut_params->op =process_crypto_request (ts_params->valid_devs[0 ], ut_params->op); + } +if (ut_params->op ==NULL ) {printf ("TestCase %s()-%d line %d failed %s: " , __func__, i, __LINE__,"failed to process sym crypto op" );
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 5/7] test/crypto: support raw buffer APIs for PDCP
Quoted 5 lines
This patch supports raw buffer APIs testing for
PDCP test cases.Signed-off-by Gagandeep Singh <[email protected]>---
PATCH v3 6/7 test/crypto: add short MAC-I test vector for zuc
In reply to Gagandeep SinghAdd a ZUC based short MAC-I test vector.
--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
app/test/test_cryptodev_security_pdcp_test_vectors.h +18 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2015-2016 Freescale Semiconductor,Inc. -* Copyright 2018-2021 NXP +* Copyright 2018-2022 NXP */ #ifndef SECURITY_PDCP_TEST_VECTOR_H_
@@ -128,7 +128,23 @@ static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = { .data_out = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x00, 0x00, 0x00, 0x00 }, }, - + { + .test_idx = 6, + .param = {.name = "PDCP-SMAC ZUC", + .auth_alg = RTE_CRYPTO_AUTH_ZUC_EIA3, + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .auth_key_len = 16, + }, + .auth_key = (uint8_t []){0xB2 ,0xA4 ,0x73 ,0xB6 ,0x78 ,0x5C , +0x51 ,0x8E ,0x9C ,0x1E ,0x9B ,0xC6 , +0x66 ,0xE4 ,0x84 ,0x24 + }, + .data_in = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4 }, + .in_len = 8, + .data_out = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4, 0xCC, 0x7D, 0xD0, 0xE4 }, + }, }; static struct pdcp_test_param pdcp_test_params[] = {
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 6/7] test/crypto: add short MAC-I test vector for zuc
Quoted 4 lines
Add a ZUC based short MAC-I test vector.
Signed-off-by Gagandeep Singh <[email protected]>---
PATCH v3 7/7 doc: add missing authentication algorithm
In reply to Gagandeep SinghAdding the missing SHA256-HMAC authentication algorithm in ipsec-secgw guide.
--- doc/guides/sample_app_ug/ipsec_secgw.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
doc/guides/sample_app_ug/ipsec_secgw.rst +3 -2
@@ -116,8 +116,8 @@ Constraints * No IPv6 options headers. * No AH mode. * Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, DES-CBC, - HMAC-SHA1, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 - and NULL. + HMAC-SHA1, HMAC-SHA256, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, + CHACHA20_POLY1305 and NULL. * Each SA must be handle by a unique lcore (*1 RX queue per port*). Compiling the Application
@@ -595,6 +595,7 @@ where each options means: * *null*: NULL algorithm * *sha1-hmac*: HMAC SHA1 algorithm + * *sha256-hmac*: HMAC SHA256 algorithm * *aes-xcbc-mac*: AES XCBC MAC algorithm ``<auth_key>``
Signature · 1 line
2.25.1
RE: [EXT] [PATCH v3 7/7] doc: add missing authentication algorithm
Quoted 7 lines
Adding the missing SHA256-HMAC authentication algorithm in ipsec-secgw guide.
Fixes b5350285ce6e ("examples/ipsec-secgw: support SHA256 HMAC")Signed-off-by Gagandeep Singh <[email protected]>
PATCH v2 2/7 examples/ipsec-secgw: support XCBC-MAC/DES-CBC
In reply to Gagandeep Singhipsec-secgw application is updated to support
DES-CBC ciphering and XCBC-MAC authentication
based IPsec functionality.
--- doc/guides/sample_app_ug/ipsec_secgw.rst | 7 +++++-- examples/ipsec-secgw/esp.c | 5 +++++ examples/ipsec-secgw/sa.c | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-)
doc/guides/sample_app_ug/ipsec_secgw.rst +5 -2
@@ -115,8 +115,9 @@ Constraints * No IPv6 options headers. * No AH mode. -* Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, HMAC-SHA1, - AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 and NULL. +* Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, DES-CBC, + HMAC-SHA1, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 + and NULL. * Each SA must be handle by a unique lcore (*1 RX queue per port*). Compiling the Application
@@ -566,6 +567,7 @@ where each options means: * *aes-256-cbc*: AES-CBC 256-bit algorithm * *aes-128-ctr*: AES-CTR 128-bit algorithm * *3des-cbc*: 3DES-CBC 192-bit algorithm + * *des-cbc*: DES-CBC 64-bit algorithm * Syntax: *cipher_algo <your algorithm>*
@@ -593,6 +595,7 @@ where each options means: * *null*: NULL algorithm * *sha1-hmac*: HMAC SHA1 algorithm + * *aes-xcbc-mac*: AES XCBC MAC algorithm ``<auth_key>``
examples/ipsec-secgw/esp.c +5 -0
@@ -100,6 +100,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :/* Copy IV at the end of crypto operation */
@@ -121,6 +122,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + payload_len;
@@ -336,6 +338,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :memset (iv,0 , sa->iv_len);
@@ -399,6 +402,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC : sym_cop->cipher.data.offset = ip_hdr_len +
@@ -431,6 +435,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa,case RTE_CRYPTO_AUTH_NULL :case RTE_CRYPTO_AUTH_SHA1_HMAC :case RTE_CRYPTO_AUTH_SHA256_HMAC : +case RTE_CRYPTO_AUTH_AES_XCBC_MAC : sym_cop->auth.data.offset = ip_hdr_len; sym_cop->auth.data.length =sizeof (struct rte_esp_hdr ) + sa->iv_len + pad_payload_len;
examples/ipsec-secgw/sa.c +8 -0
@@ -119,6 +119,13 @@ const struct supported_cipher_algo cipher_algos[] = { .iv_len = 8, .block_size = 8, .key_len = 24 + }, + { + .keyword = "des-cbc", + .algo = RTE_CRYPTO_CIPHER_DES_CBC, + .iv_len = 8, + .block_size = 8, + .key_len = 8 } };
@@ -1311,6 +1318,7 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[], }else {switch (sa->cipher_algo) {case RTE_CRYPTO_CIPHER_NULL : +case RTE_CRYPTO_CIPHER_DES_CBC :case RTE_CRYPTO_CIPHER_3DES_CBC :case RTE_CRYPTO_CIPHER_AES_CBC :case RTE_CRYPTO_CIPHER_AES_CTR :
Signature · 1 line
2.25.1
PATCH v2 3/7 examples/l2fwd-crypto: add signal handler for exit
In reply to Gagandeep SinghHandle SIGINT and SIGTERM signals.
--- examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
examples/l2fwd-crypto/main.c +16 -0
@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h>
@@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];#define MAX_TIMER_PERIOD 86400UL/* 1 day max */ #define DEFAULT_TIMER_PERIOD 10UL +/* Global signal */ +unsigned int signal_received; +/* Print out statistics on packets dropped */ static void print_stats (void )
@@ -922,6 +926,8 @@ l2fwd_main_loop(struct l2fwd_crypto_options *options) nb_rx =rte_eth_rx_burst (portid,0 , pkts_burst,MAX_PKT_BURST ); +if (unlikely (signal_received)) +return ; port_statistics[portid].rx += nb_rx;
@@ -2760,6 +2766,13 @@ reserve_key_memory(struct l2fwd_crypto_options *options) options->aad.phys_addr =rte_malloc_virt2iova (options->aad.data); } +static void +raise_signal (int signum) +{ + signal_received =1 ; +printf ("Exiting on signal (%d)\n" , signum); +} +int main (int argc,char **argv) {
@@ -2772,6 +2785,9 @@ main(int argc, char **argv)int ret, enabled_cdevcount, enabled_portcount;uint8_t enabled_cdevs[RTE_CRYPTO_MAX_DEVS ] = {0 }; +signal (SIGINT , raise_signal); +signal (SIGTERM , raise_signal); +/* init EAL */ ret =rte_eal_init (argc, argv);if (ret <0 )
Signature · 1 line
2.25.1
Re: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exit
Quoted 20 lines · On Tue, 17 May 2022 09:08:54 +0530 Gagandeep Singh <[email protected]> wrote:
Handle SIGINT and SIGTERM signals.
Signed-off-by Gagandeep Singh <[email protected]>--- examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)examples/l2fwd-crypto/main.c +1
-0@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h>
examples/l2fwd-crypto/main.c struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; · line 261
Quoted 5 lines
examples/l2fwd-crypto/main.c +2
-0@@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS];#define MAX_TIMER_PERIOD 86400UL/* 1 day max */ #define DEFAULT_TIMER_PERIOD 10UL +/* Global signal */ +unsigned int signal_received;
This won't work as expected.
This kind of flag needs to either be volatile or use explicit atomic builtins because the compiler and CPU are free to believe that it never changes.
Traditional way to address this would be:
static volatile bool signal_received;
More advanced way would be to use __atomic_load/store builtin.
Also printf() is not technically safe to call from a signal handler.
RE: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exit
Hi,
Quoted 42 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Tuesday, May 17, 2022 10:02 PM
To: Gagandeep Singh <[email protected]>
Cc: [email protected]; [email protected]
Subject: Re: [PATCH v2 3/7] examples/l2fwd-crypto: add signal handler for exitQuoted 24 lines · On Tue, 17 May 2022 09:08:54 +0530 Gagandeep Singh <[email protected]> wrote:
Handle SIGINT and SIGTERM signals.
Signed-off-by Gagandeep Singh <[email protected]>--- examples/l2fwd-crypto/main.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)(quoted diff) +0
-0
b/examples/l2fwd-crypto/main.cindexb1e2613ccf..0a1fc790fc100644examples/l2fwd-crypto/main.c +1
-0@@ -18,6 +18,7 @@#include <getopt.h> #include <fcntl.h> #include <unistd.h> +#include <signal.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h> @@ -256,6 +257,9 @@ struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS ]; #define MAX_TIMER_PERIOD 86400UL /* 1 day max */ #define
DEFAULT_TIMER_PERIOD10ULexamples/l2fwd-crypto/main.c struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; · line 261
Quoted 2 lines
examples/l2fwd-crypto/main.c +2
-0+/* Global signal */ +unsigned int signal_received;This won't work as expected.
This kind of flag needs to either be volatile or use explicit atomic builtins because the compiler and CPU are free to believe that it never changes.
Quoted 7 lines
Traditional way to address this would be:
static volatile bool
signal_received;More advanced way would be to use __atomic_load/store builtin.
Also
printf()is not technically safe to call from a signal handler.
Ok, I will update it to "static volatile bool signal_received;" .
PATCH v2 4/7 test/crypto: fix PMD name for dpaa raw buffer crypto driver
In reply to Gagandeep SinghPMD name for DPAA raw buffer crypto driver test cases is updated with correct name.
--- app/test/test_cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_cryptodev.c +1 -1
@@ -16588,7 +16588,7 @@ test_cryptodev_dpaa2_sec_raw_api(void)static int test_cryptodev_dpaa_sec_raw_api (void ) { -static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA2_SEC_PMD ); +static const char *pmd_name =RTE_STR (CRYPTODEV_NAME_DPAA_SEC_PMD );int ret; ret = require_feature_flag(pmd_name, RTE_CRYPTODEV_FF_SYM_RAW_DP,
Signature · 1 line
2.25.1
PATCH v2 5/7 test/crypto: support raw buffer APIs for PDCP
In reply to Gagandeep SinghThis patch supports raw buffer APIs testing for
PDCP test cases.
--- app/test/test_cryptodev.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
app/test/test_cryptodev.c +20 -2
@@ -8370,6 +8370,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc,struct rte_security_ctx *ctx = (struct rte_security_ctx *)rte_cryptodev_get_sec_ctx ( ts_params->valid_devs[0 ]); +struct rte_cryptodev_info dev_info; +uint64_t feat_flags; + +rte_cryptodev_info_get (ts_params->valid_devs[0 ], &dev_info); + feat_flags = dev_info.feature_flags;/* Verify the capabilities */ struct rte_security_capability_idx sec_cap_idx;
@@ -8391,6 +8396,11 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, input_vec_len);memcpy (plaintext, input_vec, input_vec_len); +if ((global_api_test_type ==CRYPTODEV_RAW_API_TEST ) && + (!(feat_flags &RTE_CRYPTODEV_FF_SYM_RAW_DP ))) { +printf ("Device does not support RAW data-path APIs.\n" ); +return TEST_SKIPPED ; + }/* Out of place support */ if (oop) {/*
@@ -8483,8 +8493,16 @@ static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, ut_params->op->sym->m_dst = ut_params->obuf;/* Process crypto operation */ -if (process_crypto_request (ts_params->valid_devs[0 ], ut_params->op) - ==NULL ) { +if (global_api_test_type ==CRYPTODEV_RAW_API_TEST ) { +/* filling lengths */ + ut_params->op->sym->cipher.data.length = ut_params->op->sym->m_src->pkt_len; + ut_params->op->sym->auth.data.length = ut_params->op->sym->m_src->pkt_len; +process_sym_raw_dp_op (ts_params->valid_devs[0 ],0 , + ut_params->op,1 ,1 ,0 ,0 ); + }else { + ut_params->op =process_crypto_request (ts_params->valid_devs[0 ], ut_params->op); + } +if (ut_params->op ==NULL ) {printf ("TestCase %s()-%d line %d failed %s: " , __func__, i, __LINE__,"failed to process sym crypto op" );
Signature · 1 line
2.25.1
PATCH v2 6/7 test/crypto: add short MAC-I test vector for zuc
In reply to Gagandeep SinghAdd a ZUC based short MAC-I test vector.
--- ...est_cryptodev_security_pdcp_test_vectors.h | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
app/test/test_cryptodev_security_pdcp_test_vectors.h +18 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (C) 2015-2016 Freescale Semiconductor,Inc. -* Copyright 2018-2021 NXP +* Copyright 2018-2022 NXP */ #ifndef SECURITY_PDCP_TEST_VECTOR_H_
@@ -128,7 +128,23 @@ static const struct pdcp_short_mac_test list_pdcp_smac_tests[] = { .data_out = (uint8_t[]){ 0x33, 0x32, 0x34, 0x62, 0x63, 0x39, 0x38, 0x00, 0x00, 0x00, 0x00 }, }, - + { + .test_idx = 6, + .param = {.name = "PDCP-SMAC ZUC", + .auth_alg = RTE_CRYPTO_AUTH_ZUC_EIA3, + .domain = RTE_SECURITY_PDCP_MODE_SHORT_MAC, + .auth_key_len = 16, + }, + .auth_key = (uint8_t []){0xB2 ,0xA4 ,0x73 ,0xB6 ,0x78 ,0x5C , +0x51 ,0x8E ,0x9C ,0x1E ,0x9B ,0xC6 , +0x66 ,0xE4 ,0x84 ,0x24 + }, + .data_in = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4 }, + .in_len = 8, + .data_out = (uint8_t []){0x00 ,0x40 ,0x00 ,0x00 ,0x00 ,0x05 , + 0x09, 0xe4, 0xCC, 0x7D, 0xD0, 0xE4 }, + }, }; static struct pdcp_test_param pdcp_test_params[] = {
Signature · 1 line
2.25.1
PATCH v2 7/7 doc: add missing authentication algorithm
In reply to Gagandeep SinghAdding the missing SHA256-HMAC authentication algorithm in ipsec-secgw guide.
--- doc/guides/sample_app_ug/ipsec_secgw.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
doc/guides/sample_app_ug/ipsec_secgw.rst +3 -2
@@ -116,8 +116,8 @@ Constraints * No IPv6 options headers. * No AH mode. * Supported algorithms: AES-CBC, AES-CTR, AES-GCM, 3DES-CBC, DES-CBC, - HMAC-SHA1, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, CHACHA20_POLY1305 - and NULL. + HMAC-SHA1, HMAC-SHA256, AES-GMAC, AES_CTR, AES_XCBC_MAC, AES_CCM, + CHACHA20_POLY1305 and NULL. * Each SA must be handle by a unique lcore (*1 RX queue per port*). Compiling the Application
@@ -595,6 +595,7 @@ where each options means: * *null*: NULL algorithm * *sha1-hmac*: HMAC SHA1 algorithm + * *sha256-hmac*: HMAC SHA256 algorithm * *aes-xcbc-mac*: AES XCBC MAC algorithm ``<auth_key>``
Signature · 1 line
2.25.1