DPDK patches and discussions
 help / color / mirror / Atom feed
From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: declan.doherty@intel.com, fiona.trahe@intel.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH v2 5/9] test/crypto: use existing algorithm strings
Date: Thu, 22 Jun 2017 13:02:31 +0100	[thread overview]
Message-ID: <20170622120235.46063-6-pablo.de.lara.guarch@intel.com> (raw)
In-Reply-To: <20170622120235.46063-1-pablo.de.lara.guarch@intel.com>

Instead of using duplicated functions to get the algorithm
strings, use the functions from the cryptodev library.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
---
 test/test/test_cryptodev_perf.c | 119 ++++++++++++----------------------------
 1 file changed, 36 insertions(+), 83 deletions(-)

diff --git a/test/test/test_cryptodev_perf.c b/test/test/test_cryptodev_perf.c
index 6be7012..7a90667 100644
--- a/test/test/test_cryptodev_perf.c
+++ b/test/test/test_cryptodev_perf.c
@@ -214,57 +214,6 @@ static const char *pmd_name(enum rte_cryptodev_type pmd)
 	}
 }
 
-static const char *cipher_algo_name(enum rte_crypto_cipher_algorithm cipher_algo)
-{
-	switch (cipher_algo) {
-	case RTE_CRYPTO_CIPHER_NULL: return "NULL";
-	case RTE_CRYPTO_CIPHER_3DES_CBC: return "3DES_CBC";
-	case RTE_CRYPTO_CIPHER_3DES_CTR: return "3DES_CTR";
-	case RTE_CRYPTO_CIPHER_3DES_ECB: return "3DES_ECB";
-	case RTE_CRYPTO_CIPHER_AES_CBC: return "AES_CBC";
-	case RTE_CRYPTO_CIPHER_AES_CCM: return "AES_CCM";
-	case RTE_CRYPTO_CIPHER_AES_CTR: return "AES_CTR";
-	case RTE_CRYPTO_CIPHER_AES_ECB: return "AES_ECB";
-	case RTE_CRYPTO_CIPHER_AES_F8: return "AES_F8";
-	case RTE_CRYPTO_CIPHER_AES_GCM: return "AES_GCM";
-	case RTE_CRYPTO_CIPHER_AES_XTS: return "AES_XTS";
-	case RTE_CRYPTO_CIPHER_ARC4: return "ARC4";
-	case RTE_CRYPTO_CIPHER_KASUMI_F8: return "KASUMI_F8";
-	case RTE_CRYPTO_CIPHER_SNOW3G_UEA2: return "SNOW3G_UEA2";
-	case RTE_CRYPTO_CIPHER_ZUC_EEA3: return "ZUC_EEA3";
-	default: return "Another cipher algo";
-	}
-}
-
-static const char *auth_algo_name(enum rte_crypto_auth_algorithm auth_algo)
-{
-	switch (auth_algo) {
-	case RTE_CRYPTO_AUTH_NULL: return "NULL"; break;
-	case RTE_CRYPTO_AUTH_AES_CBC_MAC: return "AES_CBC_MAC"; break;
-	case RTE_CRYPTO_AUTH_AES_CCM: return "AES_CCM"; break;
-	case RTE_CRYPTO_AUTH_AES_CMAC: return "AES_CMAC,"; break;
-	case RTE_CRYPTO_AUTH_AES_GCM: return "AES_GCM"; break;
-	case RTE_CRYPTO_AUTH_AES_GMAC: return "AES_GMAC"; break;
-	case RTE_CRYPTO_AUTH_AES_XCBC_MAC: return "AES_XCBC_MAC"; break;
-	case RTE_CRYPTO_AUTH_KASUMI_F9: return "KASUMI_F9"; break;
-	case RTE_CRYPTO_AUTH_MD5: return "MD5"; break;
-	case RTE_CRYPTO_AUTH_MD5_HMAC: return "MD5_HMAC,"; break;
-	case RTE_CRYPTO_AUTH_SHA1: return "SHA1"; break;
-	case RTE_CRYPTO_AUTH_SHA1_HMAC: return "SHA1_HMAC"; break;
-	case RTE_CRYPTO_AUTH_SHA224: return "SHA224"; break;
-	case RTE_CRYPTO_AUTH_SHA224_HMAC: return "SHA224_HMAC"; break;
-	case RTE_CRYPTO_AUTH_SHA256: return "SHA256"; break;
-	case RTE_CRYPTO_AUTH_SHA256_HMAC: return "SHA256_HMAC"; break;
-	case RTE_CRYPTO_AUTH_SHA384: return "SHA384,"; break;
-	case RTE_CRYPTO_AUTH_SHA384_HMAC: return "SHA384_HMAC,"; break;
-	case RTE_CRYPTO_AUTH_SHA512: return "SHA512,"; break;
-	case RTE_CRYPTO_AUTH_SHA512_HMAC: return "SHA512_HMAC,"; break;
-	case RTE_CRYPTO_AUTH_SNOW3G_UIA2: return "SNOW3G_UIA2"; break;
-	case RTE_CRYPTO_AUTH_ZUC_EIA3: return "RTE_CRYPTO_AUTH_ZUC_EIA3"; break;
-	default: return "Another auth algo"; break;
-	};
-}
-
 static struct rte_mbuf *
 setup_test_string(struct rte_mempool *mpool,
 		const uint8_t *data, size_t len, uint8_t blocksize)
@@ -2168,8 +2117,8 @@ test_perf_snow3G_optimise_cyclecount(struct perf_test_params *pparams)
 			pmd_name(gbl_cryptodev_perftest_devtype),
 			ts_params->dev_id, 0,
 			chain_mode_name(pparams->chain),
-			cipher_algo_name(pparams->cipher_algo),
-			auth_algo_name(pparams->auth_algo),
+			rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
+			rte_crypto_auth_algorithm_strings[pparams->auth_algo],
 			pparams->buf_size);
 	printf("\nOps Tx\tOps Rx\tOps/burst  ");
 	printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\tIACycles/Byte");
@@ -2363,9 +2312,9 @@ test_perf_openssl_optimise_cyclecount(struct perf_test_params *pparams)
 			pmd_name(gbl_cryptodev_perftest_devtype),
 			ts_params->dev_id, 0,
 			chain_mode_name(pparams->chain),
-			cipher_algo_name(pparams->cipher_algo),
+			rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
 			pparams->cipher_key_length,
-			auth_algo_name(pparams->auth_algo),
+			rte_crypto_auth_algorithm_strings[pparams->auth_algo],
 			pparams->buf_size);
 	printf("\nOps Tx\tOps Rx\tOps/burst  ");
 	printf("Retries  EmptyPolls\tIACycles/CyOp\tIACycles/Burst\t"
@@ -2498,9 +2447,9 @@ test_perf_armv8_optimise_cyclecount(struct perf_test_params *pparams)
 			pmd_name(gbl_cryptodev_perftest_devtype),
 			ts_params->dev_id, 0,
 			chain_mode_name(pparams->chain),
-			cipher_algo_name(pparams->cipher_algo),
+			rte_crypto_cipher_algorithm_strings[pparams->cipher_algo],
 			pparams->cipher_key_length,
-			auth_algo_name(pparams->auth_algo),
+			rte_crypto_auth_algorithm_strings[pparams->auth_algo],
 			pparams->buf_size);
 	printf("\nOps Tx\tOps Rx\tOps/burst  ");
 	printf("Retries  "
@@ -3792,12 +3741,12 @@ test_perf_aes_cbc_encrypt_digest_vary_pkt_size(void)
 		params_set[i].total_operations = total_operations;
 		params_set[i].burst_size = burst_size;
 		printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
-				" burst_size: %d ops\n",
-				chain_mode_name(params_set[i].chain),
-				cipher_algo_name(params_set[i].cipher_algo),
-				auth_algo_name(params_set[i].auth_algo),
-				params_set[i].cipher_key_length,
-				burst_size);
+			" burst_size: %d ops\n",
+			chain_mode_name(params_set[i].chain),
+			rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
+			rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
+			params_set[i].cipher_key_length,
+			burst_size);
 		printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
 			"Retries\tEmptyPolls\n");
 		for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -3842,13 +3791,17 @@ test_perf_snow3G_vary_pkt_size(void)
 		printf("\n\n");
 		params_set[i].total_operations = total_operations;
 		for (k = 0; k < RTE_DIM(burst_sizes); k++) {
+			enum rte_crypto_cipher_algorithm cipher_algo =
+				params_set[i].cipher_algo;
+			enum rte_crypto_auth_algorithm auth_algo =
+				params_set[i].auth_algo;
 			printf("\nOn %s dev%u qp%u, %s, "
 				"cipher algo:%s, auth algo:%s, burst_size: %d ops",
 				pmd_name(gbl_cryptodev_perftest_devtype),
 				testsuite_params.dev_id, 0,
 				chain_mode_name(params_set[i].chain),
-				cipher_algo_name(params_set[i].cipher_algo),
-				auth_algo_name(params_set[i].auth_algo),
+				rte_crypto_cipher_algorithm_strings[cipher_algo],
+				rte_crypto_auth_algorithm_strings[auth_algo],
 				burst_sizes[k]);
 
 			params_set[i].burst_size = burst_sizes[k];
@@ -3931,12 +3884,12 @@ test_perf_openssl_vary_pkt_size(void)
 		params_set[i].total_operations = total_operations;
 		params_set[i].burst_size = burst_size;
 		printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
-				" burst_size: %d ops\n",
-				chain_mode_name(params_set[i].chain),
-				cipher_algo_name(params_set[i].cipher_algo),
-				auth_algo_name(params_set[i].auth_algo),
-				params_set[i].cipher_key_length,
-				burst_size);
+			" burst_size: %d ops\n",
+			chain_mode_name(params_set[i].chain),
+			rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
+			rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
+			params_set[i].cipher_key_length,
+			burst_size);
 		printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
 				"EmptyPolls\n");
 		for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -4071,12 +4024,12 @@ test_perf_armv8_vary_pkt_size(void)
 		params_set[i].total_operations = total_operations;
 		params_set[i].burst_size = burst_size;
 		printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
-				" burst_size: %d ops\n",
-				chain_mode_name(params_set[i].chain),
-				cipher_algo_name(params_set[i].cipher_algo),
-				auth_algo_name(params_set[i].auth_algo),
-				params_set[i].cipher_key_length,
-				burst_size);
+			" burst_size: %d ops\n",
+			chain_mode_name(params_set[i].chain),
+			rte_crypto_cipher_algorithm_strings[params_set[i].cipher_algo],
+			rte_crypto_auth_algorithm_strings[params_set[i].auth_algo],
+			params_set[i].cipher_key_length,
+			burst_size);
 		printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\tRetries\t"
 				"EmptyPolls\n");
 		for (j = 0; j < RTE_DIM(buf_lengths); j++) {
@@ -4607,12 +4560,12 @@ test_perf_continual_performance_test(void)
 
 	for (i = 1; i <= total_loops; ++i) {
 		printf("\n%s. cipher algo: %s auth algo: %s cipher key size=%u."
-				" burst_size: %d ops\n",
-				chain_mode_name(params_set.chain),
-				cipher_algo_name(params_set.cipher_algo),
-				auth_algo_name(params_set.auth_algo),
-				params_set.cipher_key_length,
-				burst_size);
+			" burst_size: %d ops\n",
+			chain_mode_name(params_set.chain),
+			rte_crypto_cipher_algorithm_strings[params_set.cipher_algo],
+			rte_crypto_auth_algorithm_strings[params_set.auth_algo],
+			params_set.cipher_key_length,
+			burst_size);
 		printf("\nBuffer Size(B)\tOPS(M)\tThroughput(Gbps)\t"
 				"Retries\tEmptyPolls\n");
 				test_perf_aes_sha(testsuite_params.dev_id, 0,
-- 
2.9.4

  parent reply	other threads:[~2017-06-22 20:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  6:41 [dpdk-dev] [PATCH 0/9] Crypto fixes/cleanup Pablo de Lara
2017-06-21  6:41 ` [dpdk-dev] [PATCH 1/9] crypto/aesni_mb: remove assert check Pablo de Lara
2017-06-21  6:41 ` [dpdk-dev] [PATCH 2/9] test/crypto: fix wrong AAD setting Pablo de Lara
2017-06-21 17:39   ` Trahe, Fiona
2017-06-22 10:40     ` De Lara Guarch, Pablo
2017-06-21  6:41 ` [dpdk-dev] [PATCH 3/9] test/crypto: remove unnecessary offset Pablo de Lara
2017-06-21 16:38   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 4/9] test/crypto: remove offsets in wireless algorithm vectors Pablo de Lara
2017-06-21 17:07   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 5/9] test/crypto: use existing algorithm strings Pablo de Lara
2017-06-21 16:42   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 6/9] examples/l2fwd-crypto: fix application help Pablo de Lara
2017-06-21 16:43   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 7/9] examples/l2fwd-crypto: fix auth info display Pablo de Lara
2017-06-21 16:44   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 8/9] app/crypto-perf: fix error message Pablo de Lara
2017-06-21 16:39   ` Trahe, Fiona
2017-06-21  6:41 ` [dpdk-dev] [PATCH 9/9] doc: fix typo in l2fwd-crypto usage Pablo de Lara
2017-06-21 17:44   ` Trahe, Fiona
2017-06-22 12:02 ` [dpdk-dev] [PATCH v2 0/9] Crypto fixes/cleanup Pablo de Lara
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 1/9] crypto/aesni_mb: remove assert check Pablo de Lara
2017-06-23 12:50     ` Declan Doherty
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 2/9] test/crypto: fix wrong AAD setting Pablo de Lara
2017-06-23  9:56     ` Trahe, Fiona
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 3/9] test/crypto: remove unnecessary offset Pablo de Lara
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 4/9] test/crypto: remove offsets in wireless algorithm vectors Pablo de Lara
2017-06-22 12:02   ` Pablo de Lara [this message]
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 6/9] examples/l2fwd-crypto: fix application help Pablo de Lara
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 7/9] examples/l2fwd-crypto: fix auth info display Pablo de Lara
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 8/9] app/crypto-perf: fix error message Pablo de Lara
2017-06-22 12:02   ` [dpdk-dev] [PATCH v2 9/9] doc: fix typo in l2fwd-crypto usage Pablo de Lara
2017-06-23 16:21   ` [dpdk-dev] [PATCH v2 0/9] Crypto fixes/cleanup De Lara Guarch, Pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170622120235.46063-6-pablo.de.lara.guarch@intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).