* [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests @ 2016-06-15 13:01 Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 1/4] test: remove useless hexdump include Pablo de Lara ` (5 more replies) 0 siblings, 6 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 13:01 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara The cryptodev unit tests were using the macro RTE_APP_TEST_DEBUG, which is not used in any other tests, to dump memory for debugging purposes. Instead, a new macro TEST_HEXDUMP will be used to dump memory (calling rte_hexdump), when RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. This patchset depends on the patchset "rework crypto AES unit test": http://dpdk.org/ml/archives/dev/2016-June/041572.html Pablo de Lara (4): test: remove useless hexdump include test: fix compilation when RTE_APP_TEST_DEBUG was set test: remove unnecessary hexdump_mbuf_data and HEXDUMP app: add new TEST_HEXDUMP macro app/test/test.h | 7 ++ app/test/test_cryptodev.c | 165 ++++++++++++++--------------------------- app/test/test_cryptodev_perf.c | 1 - 3 files changed, 63 insertions(+), 110 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 1/4] test: remove useless hexdump include 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara @ 2016-06-15 13:01 ` Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara ` (4 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 13:01 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Cryptodev performance tests do not need to use any function from rte_hexdump.h. Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev_perf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index b3f4fd9..151078f 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -38,7 +38,6 @@ #include <rte_crypto.h> #include <rte_cryptodev.h> #include <rte_cycles.h> -#include <rte_hexdump.h> #include "test.h" #include "test_cryptodev.h" -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 1/4] test: remove useless hexdump include Pablo de Lara @ 2016-06-15 13:01 ` Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara ` (3 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 13:01 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Compilation error: app/test/test_cryptodev.c: In function ‘create_gcm_operation’: app/test/test_cryptodev.c:3619:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’ ut_params->op->digest.data, ^ app/test/test_cryptodev.c:3620:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’ ut_params->op->digest.length); ^ app/test/test_cryptodev.c:3662:41: error: ‘struct rte_crypto_op’ has no member named ‘iv’ rte_hexdump(stdout, "iv:", ut_params->op->iv.data, iv_pad_len); ^ app/test/test_cryptodev.c:3664:17: error: ‘struct rte_crypto_op’ has no member named ‘additional_auth’ ut_params->op->additional_auth.data, aad_len); Fixes: eec136f3c54fc ("aesni_gcm: add driver for AES-GCM crypto operations") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c5b5fb3..5674534 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2404,8 +2404,8 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); #ifdef RTE_APP_TEST_DEBUG rte_hexdump(stdout, "digest:", - ut_params->op->digest.data, - ut_params->op->digest.length); + sym_op->auth.digest.data, + sym_op->auth.digest.length); #endif } @@ -2447,9 +2447,9 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, rte_memcpy(sym_op->auth.aad.data, aad, aad_len); #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "iv:", ut_params->op->iv.data, iv_pad_len); + rte_hexdump(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); rte_hexdump(stdout, "aad:", - ut_params->op->additional_auth.data, aad_len); + sym_op->auth.aad.data, aad_len); #endif sym_op->cipher.data.length = data_len; sym_op->cipher.data.offset = aad_buffer_len + iv_pad_len; -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 1/4] test: remove useless hexdump include Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara @ 2016-06-15 13:01 ` Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara ` (2 subsequent siblings) 5 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 13:01 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 5674534..a5b34e2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -112,21 +112,9 @@ setup_test_string(struct rte_mempool *mpool, return m; } -#if HEX_DUMP -static void -hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) -{ - rte_hexdump(f, title, rte_pktmbuf_mtod(m, const void *), m->data_len); -} -#endif - static struct rte_crypto_op * process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { -#if HEX_DUMP - hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); -#endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { printf("Error sending packet for encryption"); return NULL; @@ -137,11 +125,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0) rte_pause(); -#if HEX_DUMP - if (obuf) - hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); -#endif - return op; } -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH 4/4] app: add new TEST_HEXDUMP macro 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara ` (2 preceding siblings ...) 2016-06-15 13:01 ` [dpdk-dev] [PATCH 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara @ 2016-06-15 13:01 ` Pablo de Lara 2016-06-15 14:03 ` [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests De Lara Guarch, Pablo 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara 5 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 13:01 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Instead of using the previous RTE_APP_TEST_DEBUG macro, to dump memory when it was enabled (with rte_hexdump), a new TEST_HEXDUMP is defined, which will call rte_hexdump if RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test.h | 7 +++ app/test/test_cryptodev.c | 142 +++++++++++++++++----------------------------- 2 files changed, 60 insertions(+), 89 deletions(-) diff --git a/app/test/test.h b/app/test/test.h index a2fba60..8ddde23 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -35,6 +35,7 @@ #define _TEST_H_ #include <stddef.h> #include <sys/queue.h> +#include "rte_log.h" #define TEST_SUCCESS (0) #define TEST_FAILED (-1) @@ -150,6 +151,12 @@ struct unit_test_case { #define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 } +#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG +#define TEST_HEXDUMP(file, title, buf, len) rte_hexdump(file, title, buf, len) +#else +#define TEST_HEXDUMP(file, title, buf, len) do {} while (0) +#endif + struct unit_test_suite { const char *suite_name; int (*setup)(void); diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index a5b34e2..1acb324 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1075,9 +1075,9 @@ create_snow3g_hash_session(uint8_t dev_id, struct crypto_unittest_params *ut_params = &unittest_params; memcpy(hash_key, key, key_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Setup Authentication Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -1113,9 +1113,8 @@ create_snow3g_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session */ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params-> @@ -1239,9 +1238,8 @@ create_snow3g_cipher_auth_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = cipher_auth_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params->cipher_xform); @@ -1281,9 +1279,8 @@ create_snow3g_auth_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = auth_cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params->auth_xform); @@ -1341,10 +1338,8 @@ create_snow3g_hash_operation(const uint8_t *auth_tag, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif /* digest */ sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( @@ -1361,11 +1356,9 @@ create_snow3g_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); -#endif sym_op->auth.data.length = auth_len; sym_op->auth.data.offset = auth_offset; @@ -1440,10 +1433,8 @@ create_snow3g_cipher_hash_operation(const uint8_t *auth_tag, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif /* digest */ sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( @@ -1460,11 +1451,9 @@ create_snow3g_cipher_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); - #endif sym_op->auth.data.length = auth_len; sym_op->auth.data.offset = auth_offset; @@ -1513,11 +1502,10 @@ create_snow3g_auth_cipher_operation(const unsigned auth_tag_len, memset(sym_op->auth.digest.data, 0, auth_tag_len); - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); - #endif + /* iv */ iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); @@ -1552,10 +1540,8 @@ create_snow3g_auth_cipher_operation(const unsigned auth_tag_len, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif sym_op->cipher.data.length = cipher_len; sym_op->cipher.data.offset = auth_offset + cipher_offset; @@ -1754,9 +1740,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3)); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation(tdata->iv.data, tdata->iv.len, tdata->validCipherLenInBits.len, @@ -1781,9 +1766,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -1840,9 +1824,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3)); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation_oop(tdata->iv.data, tdata->iv.len, @@ -1868,9 +1851,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -1916,9 +1898,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation(tdata->iv.data, tdata->iv.len, tdata->validCipherLenInBits.len, @@ -1941,9 +1922,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL(plaintext, tdata->plaintext.data, @@ -2000,9 +1980,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation_oop(tdata->iv.data, tdata->iv.len, @@ -2026,9 +2005,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(plaintext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL(plaintext, tdata->plaintext.data, @@ -2072,9 +2050,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); /* Create SNOW3G operation */ retval = create_snow3g_cipher_hash_operation(tdata->digest.data, @@ -2104,9 +2080,8 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8-lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2161,9 +2136,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); /* Create SNOW3G operation */ retval = create_snow3g_auth_cipher_operation( @@ -2197,9 +2170,8 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata) (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + plaintext_pad_len + tdata->aad.len + tdata->iv.len; - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2322,9 +2294,8 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op, ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Setup Authentication Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -2385,11 +2356,9 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, if (op == RTE_CRYPTO_CIPHER_OP_DECRYPT) { rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); -#endif } /* iv */ @@ -2429,11 +2398,10 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif + sym_op->cipher.data.length = data_len; sym_op->cipher.data.offset = aad_buffer_len + iv_pad_len; @@ -2479,9 +2447,8 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create GCM opertaion */ retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_ENCRYPT, tdata->auth_tag.data, tdata->auth_tag.len, @@ -2512,10 +2479,9 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) auth_tag = plaintext + plaintext_pad_len; } -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); - rte_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2607,9 +2573,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create GCM opertaion */ retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_DECRYPT, tdata->auth_tag.data, tdata->auth_tag.len, @@ -2637,9 +2602,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) else plaintext = ciphertext; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( plaintext, -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara ` (3 preceding siblings ...) 2016-06-15 13:01 ` [dpdk-dev] [PATCH 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara @ 2016-06-15 14:03 ` De Lara Guarch, Pablo 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara 5 siblings, 0 replies; 13+ messages in thread From: De Lara Guarch, Pablo @ 2016-06-15 14:03 UTC (permalink / raw) To: De Lara Guarch, Pablo, dev > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara > Sent: Wednesday, June 15, 2016 2:02 PM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo > Subject: [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev > tests > > The cryptodev unit tests were using the macro RTE_APP_TEST_DEBUG, which > is not used > in any other tests, to dump memory for debugging purposes. > Instead, a new macro TEST_HEXDUMP will be used to dump memory (calling > rte_hexdump), > when RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. > > This patchset depends on the patchset "rework crypto AES unit test": > http://dpdk.org/ml/archives/dev/2016-June/041572.html > > Pablo de Lara (4): > test: remove useless hexdump include > test: fix compilation when RTE_APP_TEST_DEBUG was set > test: remove unnecessary hexdump_mbuf_data and HEXDUMP > app: add new TEST_HEXDUMP macro > > app/test/test.h | 7 ++ > app/test/test_cryptodev.c | 165 ++++++++++++++--------------------------- > app/test/test_cryptodev_perf.c | 1 - > 3 files changed, 63 insertions(+), 110 deletions(-) > > -- > 2.5.0 Nack, need to use TEST_HEXDUMP in another file too. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara ` (4 preceding siblings ...) 2016-06-15 14:03 ` [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests De Lara Guarch, Pablo @ 2016-06-15 14:11 ` Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 1/4] test: remove useless hexdump include Pablo de Lara ` (4 more replies) 5 siblings, 5 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 14:11 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara The cryptodev unit tests were using the macro RTE_APP_TEST_DEBUG, which is not used in any other tests, to dump memory for debugging purposes. Instead, a new macro TEST_HEXDUMP will be used to dump memory (calling rte_hexdump), when RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. This patchset depends on the patchset "rework crypto AES unit test": http://dpdk.org/ml/archives/dev/2016-June/041572.html Changes in v2: - Use new TEST_HEXDUMP macro in new test_cryptodev_aes.c file. Pablo de Lara (4): test: remove useless hexdump include test: fix compilation when RTE_APP_TEST_DEBUG was set test: remove unnecessary hexdump_mbuf_data and HEXDUMP app: add new TEST_HEXDUMP macro app/test/test.h | 7 ++ app/test/test_cryptodev.c | 165 ++++++++++++++--------------------------- app/test/test_cryptodev_aes.c | 6 +- app/test/test_cryptodev_perf.c | 1 - 4 files changed, 65 insertions(+), 114 deletions(-) -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 1/4] test: remove useless hexdump include 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara @ 2016-06-15 14:11 ` Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara ` (3 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 14:11 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Cryptodev performance tests do not need to use any function from rte_hexdump.h. Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev_perf.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index b3f4fd9..151078f 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -38,7 +38,6 @@ #include <rte_crypto.h> #include <rte_cryptodev.h> #include <rte_cycles.h> -#include <rte_hexdump.h> #include "test.h" #include "test_cryptodev.h" -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 1/4] test: remove useless hexdump include Pablo de Lara @ 2016-06-15 14:11 ` Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara ` (2 subsequent siblings) 4 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 14:11 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Compilation error: app/test/test_cryptodev.c: In function ‘create_gcm_operation’: app/test/test_cryptodev.c:3619:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’ ut_params->op->digest.data, ^ app/test/test_cryptodev.c:3620:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’ ut_params->op->digest.length); ^ app/test/test_cryptodev.c:3662:41: error: ‘struct rte_crypto_op’ has no member named ‘iv’ rte_hexdump(stdout, "iv:", ut_params->op->iv.data, iv_pad_len); ^ app/test/test_cryptodev.c:3664:17: error: ‘struct rte_crypto_op’ has no member named ‘additional_auth’ ut_params->op->additional_auth.data, aad_len); Fixes: eec136f3c54fc ("aesni_gcm: add driver for AES-GCM crypto operations") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c5b5fb3..5674534 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2404,8 +2404,8 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); #ifdef RTE_APP_TEST_DEBUG rte_hexdump(stdout, "digest:", - ut_params->op->digest.data, - ut_params->op->digest.length); + sym_op->auth.digest.data, + sym_op->auth.digest.length); #endif } @@ -2447,9 +2447,9 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, rte_memcpy(sym_op->auth.aad.data, aad, aad_len); #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "iv:", ut_params->op->iv.data, iv_pad_len); + rte_hexdump(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); rte_hexdump(stdout, "aad:", - ut_params->op->additional_auth.data, aad_len); + sym_op->auth.aad.data, aad_len); #endif sym_op->cipher.data.length = data_len; sym_op->cipher.data.offset = aad_buffer_len + iv_pad_len; -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 1/4] test: remove useless hexdump include Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara @ 2016-06-15 14:11 ` Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara 2016-06-15 14:42 ` [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests Zhang, Roy Fan 4 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 14:11 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test_cryptodev.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 5674534..a5b34e2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -112,21 +112,9 @@ setup_test_string(struct rte_mempool *mpool, return m; } -#if HEX_DUMP -static void -hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) -{ - rte_hexdump(f, title, rte_pktmbuf_mtod(m, const void *), m->data_len); -} -#endif - static struct rte_crypto_op * process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { -#if HEX_DUMP - hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); -#endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { printf("Error sending packet for encryption"); return NULL; @@ -137,11 +125,6 @@ process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) while (rte_cryptodev_dequeue_burst(dev_id, 0, &op, 1) == 0) rte_pause(); -#if HEX_DUMP - if (obuf) - hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); -#endif - return op; } -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [dpdk-dev] [PATCH v2 4/4] app: add new TEST_HEXDUMP macro 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara ` (2 preceding siblings ...) 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara @ 2016-06-15 14:11 ` Pablo de Lara 2016-06-15 14:42 ` [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests Zhang, Roy Fan 4 siblings, 0 replies; 13+ messages in thread From: Pablo de Lara @ 2016-06-15 14:11 UTC (permalink / raw) To: dev; +Cc: Pablo de Lara Instead of using the previous RTE_APP_TEST_DEBUG macro, to dump memory when it was enabled (with rte_hexdump), a new TEST_HEXDUMP is defined, which will call rte_hexdump if RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> --- app/test/test.h | 7 +++ app/test/test_cryptodev.c | 142 ++++++++++++++++-------------------------- app/test/test_cryptodev_aes.c | 6 +- 3 files changed, 62 insertions(+), 93 deletions(-) diff --git a/app/test/test.h b/app/test/test.h index a2fba60..8ddde23 100644 --- a/app/test/test.h +++ b/app/test/test.h @@ -35,6 +35,7 @@ #define _TEST_H_ #include <stddef.h> #include <sys/queue.h> +#include "rte_log.h" #define TEST_SUCCESS (0) #define TEST_FAILED (-1) @@ -150,6 +151,12 @@ struct unit_test_case { #define TEST_CASES_END() { NULL, NULL, NULL, NULL, NULL, 0 } +#if RTE_LOG_LEVEL >= RTE_LOG_DEBUG +#define TEST_HEXDUMP(file, title, buf, len) rte_hexdump(file, title, buf, len) +#else +#define TEST_HEXDUMP(file, title, buf, len) do {} while (0) +#endif + struct unit_test_suite { const char *suite_name; int (*setup)(void); diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index a5b34e2..1acb324 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1075,9 +1075,9 @@ create_snow3g_hash_session(uint8_t dev_id, struct crypto_unittest_params *ut_params = &unittest_params; memcpy(hash_key, key, key_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Setup Authentication Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -1113,9 +1113,8 @@ create_snow3g_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session */ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params-> @@ -1239,9 +1238,8 @@ create_snow3g_cipher_auth_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = cipher_auth_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params->cipher_xform); @@ -1281,9 +1279,8 @@ create_snow3g_auth_cipher_session(uint8_t dev_id, ut_params->cipher_xform.cipher.key.data = auth_cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Create Crypto session*/ ut_params->sess = rte_cryptodev_sym_session_create(dev_id, &ut_params->auth_xform); @@ -1341,10 +1338,8 @@ create_snow3g_hash_operation(const uint8_t *auth_tag, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif /* digest */ sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( @@ -1361,11 +1356,9 @@ create_snow3g_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); -#endif sym_op->auth.data.length = auth_len; sym_op->auth.data.offset = auth_offset; @@ -1440,10 +1433,8 @@ create_snow3g_cipher_hash_operation(const uint8_t *auth_tag, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif /* digest */ sym_op->auth.digest.data = (uint8_t *)rte_pktmbuf_append( @@ -1460,11 +1451,9 @@ create_snow3g_cipher_hash_operation(const uint8_t *auth_tag, else rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); - #endif sym_op->auth.data.length = auth_len; sym_op->auth.data.offset = auth_offset; @@ -1513,11 +1502,10 @@ create_snow3g_auth_cipher_operation(const unsigned auth_tag_len, memset(sym_op->auth.digest.data, 0, auth_tag_len); - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); - #endif + /* iv */ iv_pad_len = RTE_ALIGN_CEIL(iv_len, 16); @@ -1552,10 +1540,8 @@ create_snow3g_auth_cipher_operation(const unsigned auth_tag_len, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif sym_op->cipher.data.length = cipher_len; sym_op->cipher.data.offset = auth_offset + cipher_offset; @@ -1754,9 +1740,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3)); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation(tdata->iv.data, tdata->iv.len, tdata->validCipherLenInBits.len, @@ -1781,9 +1766,8 @@ test_snow3g_encryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -1840,9 +1824,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) memcpy(plaintext, tdata->plaintext.data, (tdata->plaintext.len >> 3)); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation_oop(tdata->iv.data, tdata->iv.len, @@ -1868,9 +1851,8 @@ test_snow3g_encryption_oop(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -1916,9 +1898,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation(tdata->iv.data, tdata->iv.len, tdata->validCipherLenInBits.len, @@ -1941,9 +1922,8 @@ static int test_snow3g_decryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL(plaintext, tdata->plaintext.data, @@ -2000,9 +1980,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create SNOW3G operation */ retval = create_snow3g_cipher_operation_oop(tdata->iv.data, tdata->iv.len, @@ -2026,9 +2005,8 @@ static int test_snow3g_decryption_oop(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8 - lastByteValidBits); (*(plaintext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL(plaintext, tdata->plaintext.data, @@ -2072,9 +2050,7 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); /* Create SNOW3G operation */ retval = create_snow3g_cipher_hash_operation(tdata->digest.data, @@ -2104,9 +2080,8 @@ test_snow3g_authenticated_encryption(const struct snow3g_test_data *tdata) lastByteMask = lastByteMask << (8-lastByteValidBits); (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2161,9 +2136,7 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len >> 3); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); /* Create SNOW3G operation */ retval = create_snow3g_auth_cipher_operation( @@ -2197,9 +2170,8 @@ test_snow3g_encrypted_authentication(const struct snow3g_test_data *tdata) (*(ciphertext + (tdata->ciphertext.len >> 3) - 1)) &= lastByteMask; ut_params->digest = rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + plaintext_pad_len + tdata->aad.len + tdata->iv.len; - #ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2322,9 +2294,8 @@ create_gcm_session(uint8_t dev_id, enum rte_crypto_cipher_operation op, ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = key_len; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "key:", key, key_len); -#endif + TEST_HEXDUMP(stdout, "key:", key, key_len); + /* Setup Authentication Parameters */ ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -2385,11 +2356,9 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, if (op == RTE_CRYPTO_CIPHER_OP_DECRYPT) { rte_memcpy(sym_op->auth.digest.data, auth_tag, auth_tag_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "digest:", + TEST_HEXDUMP(stdout, "digest:", sym_op->auth.digest.data, sym_op->auth.digest.length); -#endif } /* iv */ @@ -2429,11 +2398,10 @@ create_gcm_operation(enum rte_crypto_cipher_operation op, memset(sym_op->auth.aad.data, 0, aad_buffer_len); rte_memcpy(sym_op->auth.aad.data, aad, aad_len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); - rte_hexdump(stdout, "aad:", + TEST_HEXDUMP(stdout, "iv:", sym_op->cipher.iv.data, iv_pad_len); + TEST_HEXDUMP(stdout, "aad:", sym_op->auth.aad.data, aad_len); -#endif + sym_op->cipher.data.length = data_len; sym_op->cipher.data.offset = aad_buffer_len + iv_pad_len; @@ -2479,9 +2447,8 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) plaintext_pad_len); memcpy(plaintext, tdata->plaintext.data, tdata->plaintext.len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->plaintext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->plaintext.len); + /* Create GCM opertaion */ retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_ENCRYPT, tdata->auth_tag.data, tdata->auth_tag.len, @@ -2512,10 +2479,9 @@ test_mb_AES_GCM_authenticated_encryption(const struct gcm_test_data *tdata) auth_tag = plaintext + plaintext_pad_len; } -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); - rte_hexdump(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + TEST_HEXDUMP(stdout, "auth tag:", auth_tag, tdata->auth_tag.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( ciphertext, @@ -2607,9 +2573,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) ciphertext_pad_len); memcpy(ciphertext, tdata->ciphertext.data, tdata->ciphertext.len); -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "ciphertext:", ciphertext, tdata->ciphertext.len); + /* Create GCM opertaion */ retval = create_gcm_operation(RTE_CRYPTO_CIPHER_OP_DECRYPT, tdata->auth_tag.data, tdata->auth_tag.len, @@ -2637,9 +2602,8 @@ test_mb_AES_GCM_authenticated_decryption(const struct gcm_test_data *tdata) else plaintext = ciphertext; -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "plaintext:", plaintext, tdata->ciphertext.len); -#endif + TEST_HEXDUMP(stdout, "plaintext:", plaintext, tdata->ciphertext.len); + /* Validate obuf */ TEST_ASSERT_BUFFERS_ARE_EQUAL( plaintext, diff --git a/app/test/test_cryptodev_aes.c b/app/test/test_cryptodev_aes.c index a55c968..bf832b6 100644 --- a/app/test/test_cryptodev_aes.c +++ b/app/test/test_cryptodev_aes.c @@ -543,14 +543,12 @@ test_AES_one_case(const struct aes_test_case *t, goto error_exit; } -#ifdef RTE_APP_TEST_DEBUG - rte_hexdump(stdout, "m_src:", + TEST_HEXDUMP(stdout, "m_src:", rte_pktmbuf_mtod(sym_op->m_src, uint8_t *), buf_len); if (t->feature_mask & AES_TEST_FEATURE_OOP) - rte_hexdump(stdout, "m_dst:", + TEST_HEXDUMP(stdout, "m_dst:", rte_pktmbuf_mtod(sym_op->m_dst, uint8_t *), buf_len); -#endif /* Verify results */ if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) { -- 2.5.0 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara ` (3 preceding siblings ...) 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara @ 2016-06-15 14:42 ` Zhang, Roy Fan 2016-06-20 15:48 ` Thomas Monjalon 4 siblings, 1 reply; 13+ messages in thread From: Zhang, Roy Fan @ 2016-06-15 14:42 UTC (permalink / raw) To: De Lara Guarch, Pablo, dev; +Cc: De Lara Guarch, Pablo, Zhang, Roy Fan > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara > Sent: Wednesday, June 15, 2016 3:11 PM > To: dev@dpdk.org > Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com> > Subject: [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on > cryptodev tests > > The cryptodev unit tests were using the macro RTE_APP_TEST_DEBUG, > which is not used in any other tests, to dump memory for debugging > purposes. > Instead, a new macro TEST_HEXDUMP will be used to dump memory (calling > rte_hexdump), when RTE_LOG_LEVEL is set to RTE_LOG_DEBUG. > > This patchset depends on the patchset "rework crypto AES unit test": > http://dpdk.org/ml/archives/dev/2016-June/041572.html > > Changes in v2: > - Use new TEST_HEXDUMP macro in new test_cryptodev_aes.c file. > > Pablo de Lara (4): > test: remove useless hexdump include > test: fix compilation when RTE_APP_TEST_DEBUG was set > test: remove unnecessary hexdump_mbuf_data and HEXDUMP > app: add new TEST_HEXDUMP macro > > app/test/test.h | 7 ++ > app/test/test_cryptodev.c | 165 ++++++++++++++--------------------------- > app/test/test_cryptodev_aes.c | 6 +- > app/test/test_cryptodev_perf.c | 1 - > 4 files changed, 65 insertions(+), 114 deletions(-) > > -- > 2.5.0 Series-acked-by: Fan Zhang <roy.fan.zhang@intel.com> ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests 2016-06-15 14:42 ` [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests Zhang, Roy Fan @ 2016-06-20 15:48 ` Thomas Monjalon 0 siblings, 0 replies; 13+ messages in thread From: Thomas Monjalon @ 2016-06-20 15:48 UTC (permalink / raw) To: De Lara Guarch, Pablo; +Cc: dev, Zhang, Roy Fan > > Pablo de Lara (4): > > test: remove useless hexdump include > > test: fix compilation when RTE_APP_TEST_DEBUG was set > > test: remove unnecessary hexdump_mbuf_data and HEXDUMP > > app: add new TEST_HEXDUMP macro > > Series-acked-by: Fan Zhang <roy.fan.zhang@intel.com> Applied, thanks ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2016-06-20 15:48 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-06-15 13:01 [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 1/4] test: remove useless hexdump include Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara 2016-06-15 13:01 ` [dpdk-dev] [PATCH 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara 2016-06-15 14:03 ` [dpdk-dev] [PATCH 0/4] Refactor of debug information on cryptodev tests De Lara Guarch, Pablo 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 " Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 1/4] test: remove useless hexdump include Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 2/4] test: fix compilation when RTE_APP_TEST_DEBUG was set Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 3/4] test: remove unnecessary hexdump_mbuf_data and HEXDUMP Pablo de Lara 2016-06-15 14:11 ` [dpdk-dev] [PATCH v2 4/4] app: add new TEST_HEXDUMP macro Pablo de Lara 2016-06-15 14:42 ` [dpdk-dev] [PATCH v2 0/4] Refactor of debug information on cryptodev tests Zhang, Roy Fan 2016-06-20 15:48 ` Thomas Monjalon
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).