[dpdk-dev] [PATCH] openssl pmd: rename SW crypto device from libcrypto to openssl
This patch replaces name "libcrypto" to "openssl" from file directories, symbol prefixes and sub-names connected with old name. Renamed poll mode driver files, test files, and documentations. It is done to better name association with library because the cryptography operations are using Openssl library crypto API. Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library") Signed-off-by: Slawomir Mrozowicz --- MAINTAINERS|6 +- app/test/test_cryptodev.c | 56 +- app/test/test_cryptodev_aes_test_vectors.h | 62 +- app/test/test_cryptodev_blockcipher.c |6 +- app/test/test_cryptodev_blockcipher.h |2 +- app/test/test_cryptodev_des_test_vectors.h | 56 +- app/test/test_cryptodev_hash_test_vectors.h| 48 +- app/test/test_cryptodev_perf.c | 52 +- config/common_base |4 +- doc/guides/cryptodevs/index.rst|2 +- doc/guides/cryptodevs/libcrypto.rst| 117 --- doc/guides/cryptodevs/openssl.rst | 117 +++ doc/guides/rel_notes/release_16_11.rst |2 +- drivers/crypto/Makefile|2 +- drivers/crypto/libcrypto/Makefile | 60 -- drivers/crypto/libcrypto/rte_libcrypto_pmd.c | 1062 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c | 708 - .../crypto/libcrypto/rte_libcrypto_pmd_private.h | 174 .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 - drivers/crypto/openssl/Makefile| 60 ++ drivers/crypto/openssl/rte_openssl_pmd.c | 1062 drivers/crypto/openssl/rte_openssl_pmd_ops.c | 708 + drivers/crypto/openssl/rte_openssl_pmd_private.h | 174 drivers/crypto/openssl/rte_pmd_openssl_version.map |3 + lib/librte_cryptodev/rte_cryptodev.h |4 +- mk/rte.app.mk |2 +- 26 files changed, 2276 insertions(+), 2276 deletions(-) delete mode 100644 doc/guides/cryptodevs/libcrypto.rst create mode 100644 doc/guides/cryptodevs/openssl.rst delete mode 100644 drivers/crypto/libcrypto/Makefile delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c delete mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h delete mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map create mode 100644 drivers/crypto/openssl/Makefile create mode 100644 drivers/crypto/openssl/rte_openssl_pmd.c create mode 100644 drivers/crypto/openssl/rte_openssl_pmd_ops.c create mode 100644 drivers/crypto/openssl/rte_openssl_pmd_private.h create mode 100644 drivers/crypto/openssl/rte_pmd_openssl_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 8f5fa82..af47e04 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -436,10 +436,10 @@ M: Pablo de Lara F: drivers/crypto/zuc/ F: doc/guides/cryptodevs/zuc.rst -LibCrypto PMD +OpenSSL PMD M: Declan Doherty -F: drivers/crypto/libcrypto/ -F: doc/guides/cryptodevs/libcrypto.rst +F: drivers/crypto/openssl/ +F: doc/guides/cryptodevs/openssl.rst Null Crypto PMD M: Declan Doherty diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 7d03899..079e54d 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -326,24 +326,24 @@ testsuite_setup(void) } } - /* Create 2 LIBCRYPTO devices if required */ - if (gbl_cryptodev_type == RTE_CRYPTODEV_LIBCRYPTO_PMD) { -#ifndef RTE_LIBRTE_PMD_LIBCRYPTO - RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be" + /* Create 2 OPENSSL devices if required */ + if (gbl_cryptodev_type == RTE_CRYPTODEV_OPENSSL_PMD) { +#ifndef RTE_LIBRTE_PMD_OPENSSL + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_OPENSSL must be" " enabled in config file to run this testsuite.\n"); return TEST_FAILED; #endif nb_devs = rte_cryptodev_count_devtype( - RTE_CRYPTODEV_LIBCRYPTO_PMD); + RTE_CRYPTODEV_OPENSSL_PMD); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { ret = rte_eal_vdev_init( - RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD), + RTE_STR(CRYPTODEV_NAME_OPENSSL_PMD), NULL); TEST_ASSERT(ret == 0, "Failed to create " "instance %u of pmd : %s", i, - RTE_STR(CRYPTODEV_NAME_LIBCR
[dpdk-dev] [PATCH v6 4/4] examples/l2fwd-crypto: updated example for libcrypto PMD
Libcrypto PMD has support for: Supported cipher algorithms: RTE_CRYPTO_CIPHER_3DES_CBC RTE_CRYPTO_CIPHER_AES_CBC RTE_CRYPTO_CIPHER_AES_CTR RTE_CRYPTO_CIPHER_3DES_CTR RTE_CRYPTO_CIPHER_AES_GCM Supported authentication algorithms: RTE_CRYPTO_AUTH_AES_GMAC RTE_CRYPTO_AUTH_MD5 RTE_CRYPTO_AUTH_SHA1 RTE_CRYPTO_AUTH_SHA224 RTE_CRYPTO_AUTH_SHA256 RTE_CRYPTO_AUTH_SHA384 RTE_CRYPTO_AUTH_SHA512 RTE_CRYPTO_AUTH_MD5_HMAC RTE_CRYPTO_AUTH_SHA1_HMAC RTE_CRYPTO_AUTH_SHA224_HMAC RTE_CRYPTO_AUTH_SHA256_HMAC RTE_CRYPTO_AUTH_SHA384_HMAC RTE_CRYPTO_AUTH_SHA512_HMAC Signed-off-by: Daniel Mrzyglod --- v3: - change description --- examples/l2fwd-crypto/main.c | 9 + 1 file changed, 9 insertions(+) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 0593734..dae45f5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -340,15 +340,22 @@ fill_supported_algorithm_tables(void) strcpy(supported_auth_algo[i], "NOT_SUPPORTED"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_GCM], "AES_GCM"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_GMAC], "AES_GMAC"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_MD5_HMAC], "MD5_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_MD5], "MD5"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_NULL], "NULL"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_XCBC_MAC], "AES_XCBC_MAC"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA1_HMAC], "SHA1_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA1], "SHA1"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA224_HMAC], "SHA224_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA224], "SHA224"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA256_HMAC], "SHA256_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA256], "SHA256"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA384_HMAC], "SHA384_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA384], "SHA384"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA512_HMAC], "SHA512_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA512], "SHA512"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SNOW3G_UIA2], "SNOW3G_UIA2"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_ZUC_EIA3], "ZUC_EIA3"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_KASUMI_F9], "KASUMI_F9"); @@ -363,6 +370,8 @@ fill_supported_algorithm_tables(void) strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_SNOW3G_UEA2], "SNOW3G_UEA2"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_ZUC_EEA3], "ZUC_EEA3"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_KASUMI_F8], "KASUMI_F8"); + strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_3DES_CTR], "3DES_CTR"); + strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_3DES_CBC], "3DES_CBC"); } -- 2.5.0
[dpdk-dev] [PATCH v6 3/4] app/test: added tests for libcrypto PMD
This patch contains unit tests for libcrypto PMD. User can use app/test application to check how to use this pmd and to verify crypto processing. Test name is cryptodev_libcrypto_autotest. For performance test cryptodev_libcrypto_perftest can be used. Signed-off-by: Piotr Azarewicz Signed-off-by: Marcin Kerlin Signed-off-by: Daniel Mrzyglod --- v2: - rename AES-named functions to blockcipher - replace different test cases with blockcipher functions pattern - add 3DES tests into QuickAssist PMD testsuite v3: - add nagative verification tests - add big data test v4: - move aes test rework to another patch - move big data test to another patch - checking if libcrypto pmd is available v5: - add reduced big data test v6: - fix checkpatch warnings --- app/test/test_cryptodev.c | 1505 ++- app/test/test_cryptodev.h |1 + app/test/test_cryptodev_aes_test_vectors.h | 306 +- app/test/test_cryptodev_blockcipher.c | 22 + app/test/test_cryptodev_blockcipher.h |1 + app/test/test_cryptodev_des_test_vectors.h | 955 + app/test/test_cryptodev_gcm_test_vectors.h | 36 +- app/test/test_cryptodev_hash_test_vectors.h | 491 + app/test/test_cryptodev_perf.c | 712 - 9 files changed, 3954 insertions(+), 75 deletions(-) create mode 100644 app/test/test_cryptodev_des_test_vectors.h create mode 100644 app/test/test_cryptodev_hash_test_vectors.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 8f03157..9767704 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -45,6 +45,8 @@ #include "test_cryptodev_blockcipher.h" #include "test_cryptodev_aes_test_vectors.h" +#include "test_cryptodev_des_test_vectors.h" +#include "test_cryptodev_hash_test_vectors.h" #include "test_cryptodev_kasumi_test_vectors.h" #include "test_cryptodev_kasumi_hash_test_vectors.h" #include "test_cryptodev_snow3g_test_vectors.h" @@ -167,7 +169,7 @@ testsuite_setup(void) /* Not already created so create */ ts_params->mbuf_pool = rte_pktmbuf_pool_create( "CRYPTO_MBUFPOOL", - NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, + NUM_MBUFS, MBUF_CACHE_SIZE, 0, UINT16_MAX, rte_socket_id()); if (ts_params->mbuf_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); @@ -308,6 +310,28 @@ testsuite_setup(void) } } + /* Create 2 LIBCRYPTO devices if required */ + if (gbl_cryptodev_type == RTE_CRYPTODEV_LIBCRYPTO_PMD) { +#ifndef RTE_LIBRTE_PMD_LIBCRYPTO + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif + nb_devs = rte_cryptodev_count_devtype( + RTE_CRYPTODEV_LIBCRYPTO_PMD); + if (nb_devs < 2) { + for (i = nb_devs; i < 2; i++) { + ret = rte_eal_vdev_init( + RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD), + NULL); + + TEST_ASSERT(ret == 0, "Failed to create " + "instance %u of pmd : %s", i, + RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD)); + } + } + } + #ifndef RTE_LIBRTE_PMD_QAT if (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) { RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled " @@ -877,6 +901,315 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { 0x18, 0x8c, 0x1d, 0x32 }; + +/* Multisession Vector context Test */ +/*Begin Session 0 */ +static uint8_t ms_aes_cbc_key0[] = { + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +static uint8_t ms_aes_cbc_iv0[] = { + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +static const uint8_t ms_aes_cbc_cipher0[] = { + 0x3C, 0xE4, 0xEE, 0x42, 0xB6, 0x9B, 0xC3, 0x38, + 0x5F, 0xAD, 0x54, 0xDC, 0xA8, 0x32, 0x81, 0xDC, + 0x7A, 0x6F, 0x85, 0x58, 0x07, 0x35, 0xED, 0xEB, + 0xAD, 0x79, 0x79, 0x96, 0xD3, 0x0E, 0xA6, 0xD9, + 0xAA, 0x86, 0xA4, 0x8F, 0xB5, 0xD6, 0x6E, 0x6D, + 0x0C, 0x91, 0x2F, 0xC4, 0x67, 0x98, 0x0E, 0xC4, + 0x8D, 0x83, 0x68, 0x69, 0xC4, 0xD3, 0x94, 0x34, + 0xC4, 0x5D, 0x60, 0x55, 0x22, 0x87, 0x8F, 0x6F, + 0x17, 0x8E, 0x75, 0xE4, 0x02, 0xF5, 0x1B, 0x99, + 0xC8, 0x39, 0xA9, 0xAB,
[dpdk-dev] [PATCH v6 2/4] app/test: cryptodev AES tests rework
This patch rework AES tests . In general - rename AES-named functions to blockcipher functions pattern. Signed-off-by: Piotr Azarewicz Signed-off-by: Fiona Trahe --- v6: - fix checkpatch warnings --- app/test/Makefile |2 +- app/test/test_cryptodev.c | 75 +- app/test/test_cryptodev_aes.c | 687 - app/test/test_cryptodev_aes.h | 1124 app/test/test_cryptodev_aes_test_vectors.h | 797 app/test/test_cryptodev_blockcipher.c | 516 + app/test/test_cryptodev_blockcipher.h | 124 +++ 7 files changed, 1486 insertions(+), 1839 deletions(-) delete mode 100644 app/test/test_cryptodev_aes.c delete mode 100644 app/test/test_cryptodev_aes.h create mode 100644 app/test/test_cryptodev_aes_test_vectors.h create mode 100644 app/test/test_cryptodev_blockcipher.c create mode 100644 app/test/test_cryptodev_blockcipher.h diff --git a/app/test/Makefile b/app/test/Makefile index 611d77a..5be023a 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -193,7 +193,7 @@ endif SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c -SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_aes.c +SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9d7caba..8f03157 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -43,7 +43,8 @@ #include "test.h" #include "test_cryptodev.h" -#include "test_cryptodev_aes.h" +#include "test_cryptodev_blockcipher.h" +#include "test_cryptodev_aes_test_vectors.h" #include "test_cryptodev_kasumi_test_vectors.h" #include "test_cryptodev_kasumi_hash_test_vectors.h" #include "test_cryptodev_snow3g_test_vectors.h" @@ -86,12 +87,16 @@ struct crypto_unittest_params { */ static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params); + struct crypto_unittest_params *ut_params, uint8_t *cipher_key, + uint8_t *hmac_key); static int test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_param); + struct crypto_testsuite_params *ts_param, + const uint8_t *cipher, + const uint8_t *digest, + const uint8_t *iv); static struct rte_mbuf * setup_test_string(struct rte_mempool *mpool, @@ -313,7 +318,7 @@ testsuite_setup(void) nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { - RTE_LOG(ERR, USER1, "No crypto devices found?"); + RTE_LOG(ERR, USER1, "No crypto devices found?\n"); return TEST_FAILED; } @@ -872,7 +877,6 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { 0x18, 0x8c, 0x1d, 0x32 }; - static int test_AES_CBC_HMAC_SHA1_encrypt_digest(void) { @@ -1003,17 +1007,24 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest[] = { static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params); + struct crypto_unittest_params *ut_params, + uint8_t *cipher_key, + uint8_t *hmac_key); static int test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_params); + struct crypto_testsuite_params *ts_params, + const uint8_t *cipher, + const uint8_t *digest, + const uint8_t *iv); static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params) + struct crypto_unittest_params *ut_params, + uint8_t *cipher_key, + uint8_t *hmac_key) { /* Setup Cipher Parameters */ @@ -1022,7 +1033,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; /* Setup HMAC Parameters */ @@ -1031,7 +1042,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC; -
[dpdk-dev] [PATCH v6 1/4] libcrypto_pmd: initial implementation of SW crypto device
This code provides the initial implementation of the libcrypto poll mode driver. All cryptography operations are using Openssl library crypto API. Each algorithm uses EVP_ interface from openssl API - which is recommended by Openssl maintainers. This patch adds libcrypto poll mode driver support to librte_cryptodev library. Signed-off-by: Slawomir Mrozowicz Signed-off-by: Michal Kobylinski Signed-off-by: Tomasz Kulasek Signed-off-by: Daniel Mrzyglod --- v2: - add gcm crypto cipher and authentication algorithm - rework gmac crypto authentication algorithm v3: - fix pmd according to negative verification tests - change gmac aad max size - update documentation v6: - fix checkpatch warnings --- MAINTAINERS|4 + config/common_base |6 + doc/guides/cryptodevs/index.rst|1 + doc/guides/cryptodevs/libcrypto.rst| 116 +++ doc/guides/rel_notes/release_16_11.rst | 23 +- drivers/crypto/Makefile|1 + drivers/crypto/libcrypto/Makefile | 60 ++ drivers/crypto/libcrypto/rte_libcrypto_pmd.c | 1062 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c | 708 + .../crypto/libcrypto/rte_libcrypto_pmd_private.h | 174 .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 + lib/librte_cryptodev/rte_cryptodev.h |5 +- mk/rte.app.mk | 23 +- 13 files changed, 2173 insertions(+), 13 deletions(-) create mode 100644 doc/guides/cryptodevs/libcrypto.rst create mode 100644 drivers/crypto/libcrypto/Makefile create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h create mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 58a10b8..1e9d1f8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -439,6 +439,10 @@ M: Declan Doherty F: drivers/crypto/null/ F: doc/guides/cryptodevs/null.rst +LibCrypto Crypto PMD +M: Declan Doherty +F: drivers/crypto/libcrypto/ +F: doc/guides/cryptodevs/libcrypto.rst Packet processing - diff --git a/config/common_base b/config/common_base index 3a412ee..87b8646 100644 --- a/config/common_base +++ b/config/common_base @@ -376,6 +376,12 @@ CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n # +# Compile PMD for Software backed device +# +CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO=n +CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO_DEBUG=n + +# # Compile PMD for AESNI GCM device # CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n diff --git a/doc/guides/cryptodevs/index.rst b/doc/guides/cryptodevs/index.rst index 906f1b4..bae8e53 100644 --- a/doc/guides/cryptodevs/index.rst +++ b/doc/guides/cryptodevs/index.rst @@ -39,6 +39,7 @@ Crypto Device Drivers aesni_mb aesni_gcm kasumi +libcrypto null snow3g qat diff --git a/doc/guides/cryptodevs/libcrypto.rst b/doc/guides/cryptodevs/libcrypto.rst new file mode 100644 index 000..77eff95 --- /dev/null +++ b/doc/guides/cryptodevs/libcrypto.rst @@ -0,0 +1,116 @@ +.. BSD LICENSE +Copyright(c) 2016 Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. +* Neither the name of Intel Corporation nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +LibCrypto Crypto Poll Mode Driver + +This code provides the initial impl
[dpdk-dev] [PATCH v6 0/4] new crypto software based device
This code provides the initial implementation of the libcrypto poll mode driver. All cryptography operations are using Openssl library crypto API. Each algorithm uses EVP_ interface from openssl API - which is recommended by Openssl maintainers. For more information about how to use this driver, go to: doc/guides/cryptodevs/libcrypto.rst Changes in V6: - fix checkpatch warnings Changes in V5: - reduce source of big data test Changes in V4: - move aes test rework to another patch - move big data test to another patch - checking if libcrypto pmd is available Changes in V3: - add nagative verification tests - add big data test - fix pmd according to negative verification tests - change gmac aad max size - update documentation and commits comments Changes in V2: - add gcm/gmac algorithm correction - unit test rework Slawomir Mrozowicz (1): libcrypto_pmd: initial implementation of SW crypto device Piotr Azarewicz (2) app/test: cryptodev AES tests rework app/test: added tests for libcrypto PMD Daniel Mrzyglod (1) examples/l2fwd-crypto: updated example for libcrypto PMD MAINTAINERS|4 + app/test/Makefile |2 +- app/test/test_cryptodev.c | 1584 ++-- app/test/test_cryptodev.h |1 + app/test/test_cryptodev_aes.c | 687 - app/test/test_cryptodev_aes.h | 1124 -- app/test/test_cryptodev_aes_test_vectors.h | 1097 ++ app/test/test_cryptodev_blockcipher.c | 538 +++ app/test/test_cryptodev_blockcipher.h | 125 ++ app/test/test_cryptodev_des_test_vectors.h | 955 app/test/test_cryptodev_gcm_test_vectors.h | 36 +- app/test/test_cryptodev_hash_test_vectors.h| 491 ++ app/test/test_cryptodev_perf.c | 712 - config/common_base |6 + doc/guides/cryptodevs/index.rst|1 + doc/guides/cryptodevs/libcrypto.rst| 116 ++ doc/guides/rel_notes/release_16_11.rst | 23 +- drivers/crypto/Makefile|1 + drivers/crypto/libcrypto/Makefile | 60 + drivers/crypto/libcrypto/rte_libcrypto_pmd.c | 1062 + drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c | 708 + .../crypto/libcrypto/rte_libcrypto_pmd_private.h | 174 +++ .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 + examples/l2fwd-crypto/main.c |9 + lib/librte_cryptodev/rte_cryptodev.h |5 +- mk/rte.app.mk | 23 +- 26 files changed, 7621 insertions(+), 1926 deletions(-) delete mode 100644 app/test/test_cryptodev_aes.c delete mode 100644 app/test/test_cryptodev_aes.h create mode 100644 app/test/test_cryptodev_aes_test_vectors.h create mode 100644 app/test/test_cryptodev_blockcipher.c create mode 100644 app/test/test_cryptodev_blockcipher.h create mode 100644 app/test/test_cryptodev_des_test_vectors.h create mode 100644 app/test/test_cryptodev_hash_test_vectors.h create mode 100644 doc/guides/cryptodevs/libcrypto.rst create mode 100644 drivers/crypto/libcrypto/Makefile create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h create mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map -- 2.5.0
[dpdk-dev] [PATCH v5 4/4] examples/l2fwd-crypto: updated example for libcrypto PMD
Libcrypto PMD has support for: Supported cipher algorithms: RTE_CRYPTO_CIPHER_3DES_CBC RTE_CRYPTO_CIPHER_AES_CBC RTE_CRYPTO_CIPHER_AES_CTR RTE_CRYPTO_CIPHER_3DES_CTR RTE_CRYPTO_CIPHER_AES_GCM Supported authentication algorithms: RTE_CRYPTO_AUTH_AES_GMAC RTE_CRYPTO_AUTH_MD5 RTE_CRYPTO_AUTH_SHA1 RTE_CRYPTO_AUTH_SHA224 RTE_CRYPTO_AUTH_SHA256 RTE_CRYPTO_AUTH_SHA384 RTE_CRYPTO_AUTH_SHA512 RTE_CRYPTO_AUTH_MD5_HMAC RTE_CRYPTO_AUTH_SHA1_HMAC RTE_CRYPTO_AUTH_SHA224_HMAC RTE_CRYPTO_AUTH_SHA256_HMAC RTE_CRYPTO_AUTH_SHA384_HMAC RTE_CRYPTO_AUTH_SHA512_HMAC Signed-off-by: Daniel Mrzyglod --- v3: - change description --- examples/l2fwd-crypto/main.c | 9 + 1 file changed, 9 insertions(+) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 0593734..dae45f5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -340,15 +340,22 @@ fill_supported_algorithm_tables(void) strcpy(supported_auth_algo[i], "NOT_SUPPORTED"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_GCM], "AES_GCM"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_GMAC], "AES_GMAC"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_MD5_HMAC], "MD5_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_MD5], "MD5"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_NULL], "NULL"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_AES_XCBC_MAC], "AES_XCBC_MAC"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA1_HMAC], "SHA1_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA1], "SHA1"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA224_HMAC], "SHA224_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA224], "SHA224"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA256_HMAC], "SHA256_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA256], "SHA256"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA384_HMAC], "SHA384_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA384], "SHA384"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA512_HMAC], "SHA512_HMAC"); + strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SHA512], "SHA512"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_SNOW3G_UIA2], "SNOW3G_UIA2"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_ZUC_EIA3], "ZUC_EIA3"); strcpy(supported_auth_algo[RTE_CRYPTO_AUTH_KASUMI_F9], "KASUMI_F9"); @@ -363,6 +370,8 @@ fill_supported_algorithm_tables(void) strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_SNOW3G_UEA2], "SNOW3G_UEA2"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_ZUC_EEA3], "ZUC_EEA3"); strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_KASUMI_F8], "KASUMI_F8"); + strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_3DES_CTR], "3DES_CTR"); + strcpy(supported_cipher_algo[RTE_CRYPTO_CIPHER_3DES_CBC], "3DES_CBC"); } -- 2.5.0
[dpdk-dev] [PATCH v5 3/4] app/test: added tests for libcrypto PMD
This patch containes unit tests for libcrypto PMD. User can use app/test application to check how to use this pmd and to verify crypto processing. Test name is cryptodev_libcrypto_autotest. For performance test cryptodev_libcrypto_perftest can be used. Signed-off-by: Piotr Azarewicz Signed-off-by: Marcin Kerlin Signed-off-by: Daniel Mrzyglod --- v2: - rename AES-named functions to blockcipher - replace different test cases with blockcipher functions pattern - add 3DES tests into QuickAssist PMD testsuite v3: - add nagative verification tests - add big data test v4: - move aes test rework to another patch - move big data test to another patch - checking if libcrypto pmd is available v5: - add reduced big data test --- app/test/test_cryptodev.c | 1495 +-- app/test/test_cryptodev.h |1 + app/test/test_cryptodev_aes_test_vectors.h | 304 +- app/test/test_cryptodev_blockcipher.c | 22 + app/test/test_cryptodev_blockcipher.h |1 + app/test/test_cryptodev_des_test_vectors.h | 952 + app/test/test_cryptodev_gcm_test_vectors.h | 36 +- app/test/test_cryptodev_hash_test_vectors.h | 491 + app/test/test_cryptodev_perf.c | 689 +++- 9 files changed, 3911 insertions(+), 80 deletions(-) create mode 100644 app/test/test_cryptodev_des_test_vectors.h create mode 100644 app/test/test_cryptodev_hash_test_vectors.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index c46db94..54982d2 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -45,6 +45,8 @@ #include "test_cryptodev_blockcipher.h" #include "test_cryptodev_aes_test_vectors.h" +#include "test_cryptodev_des_test_vectors.h" +#include "test_cryptodev_hash_test_vectors.h" #include "test_cryptodev_kasumi_test_vectors.h" #include "test_cryptodev_kasumi_hash_test_vectors.h" #include "test_cryptodev_snow3g_test_vectors.h" @@ -167,7 +169,7 @@ testsuite_setup(void) /* Not already created so create */ ts_params->mbuf_pool = rte_pktmbuf_pool_create( "CRYPTO_MBUFPOOL", - NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE, + NUM_MBUFS, MBUF_CACHE_SIZE, 0, UINT16_MAX, rte_socket_id()); if (ts_params->mbuf_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n"); @@ -308,6 +310,26 @@ testsuite_setup(void) } } + /* Create 2 LIBCRYPTO devices if required */ + if (gbl_cryptodev_type == RTE_CRYPTODEV_LIBCRYPTO_PMD) { +#ifndef RTE_LIBRTE_PMD_LIBCRYPTO + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif + nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_LIBCRYPTO_PMD); + if (nb_devs < 2) { + for (i = nb_devs; i < 2; i++) { + ret = rte_eal_vdev_init( + RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD), NULL); + + TEST_ASSERT(ret == 0, + "Failed to create instance %u of pmd : %s", + i, RTE_STR(CRYPTODEV_NAME_LIBCRYPTO_PMD)); + } + } + } + #ifndef RTE_LIBRTE_PMD_QAT if (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) { RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_QAT must be enabled " @@ -877,6 +899,315 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { 0x18, 0x8c, 0x1d, 0x32 }; + +/* Multisession Vector context Test */ +/*Begin Session 0 */ +static uint8_t ms_aes_cbc_key0[] = { + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +static uint8_t ms_aes_cbc_iv0[] = { + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff +}; + +static const uint8_t ms_aes_cbc_cipher0[] = { + 0x3C, 0xE4, 0xEE, 0x42, 0xB6, 0x9B, 0xC3, 0x38, + 0x5F, 0xAD, 0x54, 0xDC, 0xA8, 0x32, 0x81, 0xDC, + 0x7A, 0x6F, 0x85, 0x58, 0x07, 0x35, 0xED, 0xEB, + 0xAD, 0x79, 0x79, 0x96, 0xD3, 0x0E, 0xA6, 0xD9, + 0xAA, 0x86, 0xA4, 0x8F, 0xB5, 0xD6, 0x6E, 0x6D, + 0x0C, 0x91, 0x2F, 0xC4, 0x67, 0x98, 0x0E, 0xC4, + 0x8D, 0x83, 0x68, 0x69, 0xC4, 0xD3, 0x94, 0x34, + 0xC4, 0x5D, 0x60, 0x55, 0x22, 0x87, 0x8F, 0x6F, + 0x17, 0x8E, 0x75, 0xE4, 0x02, 0xF5, 0x1B, 0x99, + 0xC8, 0x39, 0xA9, 0xAB, 0x23, 0x91, 0x12, 0xED, + 0x08, 0xE7, 0xD9, 0x25, 0x89, 0x24, 0x4F, 0x8D, +
[dpdk-dev] [PATCH v5 2/4] app/test: cryptodev AES tests rework
This patch rework AES tests . In general - rename AES-named functions to blockcipher functions pattern. Signed-off-by: Piotr Azarewicz Signed-off-by: Fiona Trahe --- app/test/Makefile |2 +- app/test/test_cryptodev.c | 74 +- app/test/test_cryptodev_aes.c | 687 - app/test/test_cryptodev_aes.h | 1124 app/test/test_cryptodev_aes_test_vectors.h | 797 app/test/test_cryptodev_blockcipher.c | 509 + app/test/test_cryptodev_blockcipher.h | 124 +++ 7 files changed, 1478 insertions(+), 1839 deletions(-) delete mode 100644 app/test/test_cryptodev_aes.c delete mode 100644 app/test/test_cryptodev_aes.h create mode 100644 app/test/test_cryptodev_aes_test_vectors.h create mode 100644 app/test/test_cryptodev_blockcipher.c create mode 100644 app/test/test_cryptodev_blockcipher.h diff --git a/app/test/Makefile b/app/test/Makefile index 611d77a..5be023a 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -193,7 +193,7 @@ endif SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c -SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_aes.c +SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_perf.c SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9d7caba..c46db94 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -43,7 +43,8 @@ #include "test.h" #include "test_cryptodev.h" -#include "test_cryptodev_aes.h" +#include "test_cryptodev_blockcipher.h" +#include "test_cryptodev_aes_test_vectors.h" #include "test_cryptodev_kasumi_test_vectors.h" #include "test_cryptodev_kasumi_hash_test_vectors.h" #include "test_cryptodev_snow3g_test_vectors.h" @@ -86,12 +87,16 @@ struct crypto_unittest_params { */ static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params); + struct crypto_unittest_params *ut_params, uint8_t *cipher_key, + uint8_t *hmac_key); static int test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_param); + struct crypto_testsuite_params *ts_param, + const uint8_t *cipher, + const uint8_t *digest, + const uint8_t *iv); static struct rte_mbuf * setup_test_string(struct rte_mempool *mpool, @@ -313,7 +318,7 @@ testsuite_setup(void) nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { - RTE_LOG(ERR, USER1, "No crypto devices found?"); + RTE_LOG(ERR, USER1, "No crypto devices found?\n"); return TEST_FAILED; } @@ -872,7 +877,6 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { 0x18, 0x8c, 0x1d, 0x32 }; - static int test_AES_CBC_HMAC_SHA1_encrypt_digest(void) { @@ -1003,17 +1007,24 @@ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA512_digest[] = { static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params); + struct crypto_unittest_params *ut_params, + uint8_t *cipher_key, + uint8_t *hmac_key); static int test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_sym_session *sess, struct crypto_unittest_params *ut_params, - struct crypto_testsuite_params *ts_params); + struct crypto_testsuite_params *ts_params, + const uint8_t *cipher, + const uint8_t *digest, + const uint8_t *iv); static int test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( - struct crypto_unittest_params *ut_params) + struct crypto_unittest_params *ut_params, + uint8_t *cipher_key, + uint8_t *hmac_key) { /* Setup Cipher Parameters */ @@ -1022,7 +1033,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_DECRYPT; - ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.data = cipher_key; ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; /* Setup HMAC Parameters */ @@ -1031,7 +1042,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_VERIFY; ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA512_HMAC; -
[dpdk-dev] [PATCH v5 1/4] libcrypto_pmd: initial implementation of SW crypto device
This code provides the initial implementation of the libcrypto poll mode driver. All cryptography operations are using Openssl library crypto API. Each algorithm uses EVP_ interface from openssl API - which is recommended by Openssl maintainers. This patch adds libcrypto poll mode driver support to librte_cryptodev library. Signed-off-by: Slawomir Mrozowicz Signed-off-by: Michal Kobylinski Signed-off-by: Tomasz Kulasek Signed-off-by: Daniel Mrzyglod --- v2: - add gcm crypto cipher and authentication algorithm - rework gmac crypto authentication algorithm v3: - fix pmd according to negative verification tests - change gmac aad max size - update documentation --- MAINTAINERS|4 + config/common_base |6 + doc/guides/cryptodevs/index.rst|1 + doc/guides/cryptodevs/libcrypto.rst| 116 +++ doc/guides/rel_notes/release_16_11.rst | 23 +- drivers/crypto/Makefile|1 + drivers/crypto/libcrypto/Makefile | 60 ++ drivers/crypto/libcrypto/rte_libcrypto_pmd.c | 1051 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c | 708 + .../crypto/libcrypto/rte_libcrypto_pmd_private.h | 174 .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 + lib/librte_cryptodev/rte_cryptodev.h |5 +- mk/rte.app.mk | 23 +- 13 files changed, 2162 insertions(+), 13 deletions(-) create mode 100644 doc/guides/cryptodevs/libcrypto.rst create mode 100644 drivers/crypto/libcrypto/Makefile create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h create mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 58a10b8..1e9d1f8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -439,6 +439,10 @@ M: Declan Doherty F: drivers/crypto/null/ F: doc/guides/cryptodevs/null.rst +LibCrypto Crypto PMD +M: Declan Doherty +F: drivers/crypto/libcrypto/ +F: doc/guides/cryptodevs/libcrypto.rst Packet processing - diff --git a/config/common_base b/config/common_base index 3a412ee..87b8646 100644 --- a/config/common_base +++ b/config/common_base @@ -376,6 +376,12 @@ CONFIG_RTE_LIBRTE_PMD_AESNI_MB=n CONFIG_RTE_LIBRTE_PMD_AESNI_MB_DEBUG=n # +# Compile PMD for Software backed device +# +CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO=n +CONFIG_RTE_LIBRTE_PMD_LIBCRYPTO_DEBUG=n + +# # Compile PMD for AESNI GCM device # CONFIG_RTE_LIBRTE_PMD_AESNI_GCM=n diff --git a/doc/guides/cryptodevs/index.rst b/doc/guides/cryptodevs/index.rst index 906f1b4..bae8e53 100644 --- a/doc/guides/cryptodevs/index.rst +++ b/doc/guides/cryptodevs/index.rst @@ -39,6 +39,7 @@ Crypto Device Drivers aesni_mb aesni_gcm kasumi +libcrypto null snow3g qat diff --git a/doc/guides/cryptodevs/libcrypto.rst b/doc/guides/cryptodevs/libcrypto.rst new file mode 100644 index 000..77eff95 --- /dev/null +++ b/doc/guides/cryptodevs/libcrypto.rst @@ -0,0 +1,116 @@ +.. BSD LICENSE +Copyright(c) 2016 Intel Corporation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in +the documentation and/or other materials provided with the +distribution. +* Neither the name of Intel Corporation nor the names of its +contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +LibCrypto Crypto Poll Mode Driver + +This code provides the initial implementation of the libcrypto
[dpdk-dev] [PATCH v5 0/4] new crypto software based device
This code provides the initial implementation of the libcrypto poll mode driver. All cryptography operations are using Openssl library crypto API. Each algorithm uses EVP_ interface from openssl API - which is recommended by Openssl maintainers. For more information about how to use this driver, go to: doc/guides/cryptodevs/libcrypto.rst Changes in V5: - reduce source of big data test Changes in V4: - move aes test rework to another patch - move big data test to another patch - checking if libcrypto pmd is available Changes in V3: - add nagative verification tests - add big data test - fix pmd according to negative verification tests - change gmac aad max size - update documentation and commits comments Changes in V2: - add gcm/gmac algorithm correction - unit test rework Slawomir Mrozowicz (1): libcrypto_pmd: initial implementation of SW crypto device Piotr Azarewicz (2) app/test: cryptodev AES tests rework app/test: added tests for libcrypto PMD Daniel Mrzyglod (1) examples/l2fwd-crypto: updated example for libcrypto PMD MAINTAINERS|4 + app/test/Makefile |2 +- app/test/test_cryptodev.c | 1581 ++-- app/test/test_cryptodev.h |1 + app/test/test_cryptodev_aes.c | 687 - app/test/test_cryptodev_aes.h | 1124 -- app/test/test_cryptodev_aes_test_vectors.h | 1095 ++ app/test/test_cryptodev_blockcipher.c | 531 +++ app/test/test_cryptodev_blockcipher.h | 125 ++ app/test/test_cryptodev_des_test_vectors.h | 952 app/test/test_cryptodev_gcm_test_vectors.h | 36 +- app/test/test_cryptodev_hash_test_vectors.h| 491 ++ app/test/test_cryptodev_perf.c | 689 - config/common_base |6 + doc/guides/cryptodevs/index.rst|1 + doc/guides/cryptodevs/libcrypto.rst| 116 ++ doc/guides/rel_notes/release_16_11.rst | 23 +- drivers/crypto/Makefile|1 + drivers/crypto/libcrypto/Makefile | 60 + drivers/crypto/libcrypto/rte_libcrypto_pmd.c | 1051 + drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c | 708 + .../crypto/libcrypto/rte_libcrypto_pmd_private.h | 174 +++ .../crypto/libcrypto/rte_pmd_libcrypto_version.map |3 + examples/l2fwd-crypto/main.c |9 + lib/librte_cryptodev/rte_cryptodev.h |5 +- mk/rte.app.mk | 23 +- 26 files changed, 7563 insertions(+), 1935 deletions(-) delete mode 100644 app/test/test_cryptodev_aes.c delete mode 100644 app/test/test_cryptodev_aes.h create mode 100644 app/test/test_cryptodev_aes_test_vectors.h create mode 100644 app/test/test_cryptodev_blockcipher.c create mode 100644 app/test/test_cryptodev_blockcipher.h create mode 100644 app/test/test_cryptodev_des_test_vectors.h create mode 100644 app/test/test_cryptodev_hash_test_vectors.h create mode 100644 doc/guides/cryptodevs/libcrypto.rst create mode 100644 drivers/crypto/libcrypto/Makefile create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_ops.c create mode 100644 drivers/crypto/libcrypto/rte_libcrypto_pmd_private.h create mode 100644 drivers/crypto/libcrypto/rte_pmd_libcrypto_version.map -- 2.5.0
[dpdk-dev] [PATCH v2] examples/l2fwd-crypto: fix out-of-bounds read
Overrunning array crypto_statistics of 32 64-byte elements at element index 63 using index cdevid. Fixed by extend crypto_statistics array. Coverity ID 120145 Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Signed-off-by: Slawomir Mrozowicz --- v2: - correct commit description --- examples/l2fwd-crypto/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 8dc616d..70fada5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -243,7 +243,7 @@ struct l2fwd_crypto_statistics { } __rte_cache_aligned; struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; -struct l2fwd_crypto_statistics crypto_statistics[RTE_MAX_ETHPORTS]; +struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; /* A tsc-based timer responsible for triggering statistics printout */ #define TIMER_MILLISECOND 200ULL /* around 1ms at 2 Ghz */ -- 1.9.1
[dpdk-dev] [PATCH] examples/l2fwd-crypto: out-of-bounds read
Overrunning array crypto_statistics of 32 64-byte elements at element index 63 using index cdevid. Fixed by extend crypto_statistics array. Fixes: 387259bd6c67 ("examples/l2fwd-crypto: add sample application") Coverity ID 120145 Signed-off-by: Slawomir Mrozowicz --- examples/l2fwd-crypto/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 8dc616d..70fada5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -243,7 +243,7 @@ struct l2fwd_crypto_statistics { } __rte_cache_aligned; struct l2fwd_port_statistics port_statistics[RTE_MAX_ETHPORTS]; -struct l2fwd_crypto_statistics crypto_statistics[RTE_MAX_ETHPORTS]; +struct l2fwd_crypto_statistics crypto_statistics[RTE_CRYPTO_MAX_DEVS]; /* A tsc-based timer responsible for triggering statistics printout */ #define TIMER_MILLISECOND 200ULL /* around 1ms at 2 Ghz */ -- 1.9.1
[dpdk-dev] [PATCH v5] eal: out-of-bounds write
Overrunning array mcfg->memseg of 256 44-byte elements at element index 257 using index j. Fixed by add condition with message information. Fixes: af75078fece3 ("first public release") Coverity ID 13282 Signed-off-by: Slawomir Mrozowicz --- v5: - update message v4: - remove check condition from loop v3: - add check condition inside and outside the loop v2: - add message information --- lib/librte_eal/linuxapp/eal/eal_memory.c | 8 1 file changed, 8 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c..ffe069c 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1301,6 +1301,14 @@ rte_eal_hugepage_init(void) break; } + if (j >= RTE_MAX_MEMSEG) { + RTE_LOG(ERR, EAL, + "All memory segments exhausted by IVSHMEM. " + "Try recompiling with larger RTE_MAX_MEMSEG " + "then current %d\n", RTE_MAX_MEMSEG); + return -ENOMEM; + } + for (i = 0; i < nr_hugefiles; i++) { new_memseg = 0; -- 1.9.1
[dpdk-dev] [PATCH] app/testpmd: unchecked return value
Calling rte_eth_dev_rss_hash_update without checking return value. Fixed by handle return value and print out error status. Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") Coverity ID 119251 Signed-off-by: Slawomir Mrozowicz --- app/test-pmd/cmdline.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index c5b9479..9616790 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1524,6 +1524,7 @@ cmd_config_rss_parsed(void *parsed_result, { struct cmd_config_rss *res = parsed_result; struct rte_eth_rss_conf rss_conf; + int diag; uint8_t i; if (!strcmp(res->value, "all")) @@ -1547,8 +1548,13 @@ cmd_config_rss_parsed(void *parsed_result, return; } rss_conf.rss_key = NULL; - for (i = 0; i < rte_eth_dev_count(); i++) - rte_eth_dev_rss_hash_update(i, _conf); + for (i = 0; i < rte_eth_dev_count(); i++) { + diag = rte_eth_dev_rss_hash_update(i, _conf); + if (diag < 0) + printf("Configuration of RSS hash at ethernet port %d " + "failed with error (%d): %s.\n", + i, -diag, strerror(-diag)); + } } cmdline_parse_token_string_t cmd_config_rss_port = -- 1.9.1
[dpdk-dev] [PATCH v3] eal: out-of-bounds write
Overrunning array mcfg->memseg of 256 44-byte elements at element index 257 using index j. Fixed by add condition with message information. Fixes: af75078fece3 ("first public release") Coverity ID 13282 Signed-off-by: Slawomir Mrozowicz --- lib/librte_eal/linuxapp/eal/eal_memory.c | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c..6a2daf5 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1301,6 +1301,15 @@ rte_eal_hugepage_init(void) break; } + if (j >= RTE_MAX_MEMSEG) { + RTE_LOG(ERR, EAL, + "Failed: all memsegs used by ivshmem.\n" + "Current %d is not enough.\n" + "Please either increase the RTE_MAX_MEMSEG\n", + RTE_MAX_MEMSEG); + return -ENOMEM; + } + for (i = 0; i < nr_hugefiles; i++) { new_memseg = 0; @@ -1333,8 +1342,14 @@ rte_eal_hugepage_init(void) if (new_memseg) { j += 1; - if (j == RTE_MAX_MEMSEG) - break; + if (j >= RTE_MAX_MEMSEG) { + RTE_LOG(ERR, EAL, + "Failed: all memsegs used by ivshmem.\n" + "Current %d is not enough.\n" + "Please either increase the RTE_MAX_MEMSEG\n", + RTE_MAX_MEMSEG); + return -ENOMEM; + } mcfg->memseg[j].phys_addr = hugepage[i].physaddr; mcfg->memseg[j].addr = hugepage[i].final_va; -- 1.9.1
[dpdk-dev] [PATCH] examples/ipsec-secgw: wrong spi read from packet
In ipsec-secgw wrong SPI number is read from incoming ESP packet. The problem exist inside function inbound_sa_lookup(). The SPI is read from mbuf where the information is stored in big-endian. In low-endian environment the value is erroneous. Fixed by add conversion rte_be_to_cpu_32(). Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Slawomir Mrozowicz --- examples/ipsec-secgw/sa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index b6260ed..503e345 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -416,8 +416,8 @@ inbound_sa_lookup(struct sa_ctx *sa_ctx, struct rte_mbuf *pkts[], uint32_t *src, spi; for (i = 0; i < nb_pkts; i++) { - spi = rte_pktmbuf_mtod_offset(pkts[i], struct esp_hdr *, - sizeof(struct ip))->spi; + spi = rte_be_to_cpu_32(rte_pktmbuf_mtod_offset(pkts[i], + struct esp_hdr *, sizeof(struct ip))->spi); if (spi == INVALID_SPI) continue; -- 1.9.1
[dpdk-dev] [PATCH] examples/ipsec-secgw: Calling risky function
lrand48 should not be used for security related applications, as linear congruential algorithms are too easy to break. Used a compliant random number generator /dev/urandom. Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Coverity ID 124558 Signed-off-by: Slawomir Mrozowicz --- examples/ipsec-secgw/esp.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/examples/ipsec-secgw/esp.c b/examples/ipsec-secgw/esp.c index 0f6b33e..f3c4687 100644 --- a/examples/ipsec-secgw/esp.c +++ b/examples/ipsec-secgw/esp.c @@ -55,16 +55,17 @@ static inline void random_iv_u64(uint64_t *buf, uint16_t n) { - unsigned left = n & 0x7; - unsigned i; + int res = 0; + FILE *fp; - RTE_ASSERT((n & 0x3) == 0); - - for (i = 0; i < (n >> 3); i++) - buf[i] = rte_rand(); + fp = fopen("/dev/urandom", "r"); + if (fp != NULL) { + res = fread(buf, 8, n, fp); + fclose(fp); + } - if (left) - *((uint32_t *)[i]) = (uint32_t)lrand48(); + RTE_ASSERT(res != n); + RTE_LOG(DEBUG, IPSEC_ESP, "random_iv_u64 result %d\n", res); } /* IPv4 Tunnel */ -- 1.9.1
[dpdk-dev] [PATCH] enic: negative array index write
Negative array index write using variable pos as an index to array enic->fdir.nodes. Fixed by add array index check. Fixes: fefed3d1e62c ("enic: new driver") Coverity ID 13270 Signed-off-by: Slawomir Mrozowicz --- drivers/net/enic/enic_clsf.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/enic/enic_clsf.c b/drivers/net/enic/enic_clsf.c index edb56e1..6b1489d 100644 --- a/drivers/net/enic/enic_clsf.c +++ b/drivers/net/enic/enic_clsf.c @@ -213,6 +213,12 @@ int enic_fdir_add_fltr(struct enic *enic, struct rte_eth_fdir_filter *params) } pos = rte_hash_add_key(enic->fdir.hash, params); + if (pos < 0 || pos >= ENICPMD_FDIR_MAX) { + dev_err(enic, "Add hash key failed\n"); + enic->fdir.stats.f_add++; + return -EINVAL; + } + enic->fdir.nodes[pos] = key; return 0; } -- 1.9.1
[dpdk-dev] [PATCH] i40e: Unchecked return value
Calling i40e_switch_tx_queue without checking return value. Fixed by add warning log information if return failed. Fixes: 71d35259ff67 ("i40e: tear down flow director") Coverity ID 13208 Signed-off-by: Slawomir Mrozowicz --- drivers/net/i40e/i40e_fdir.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 8aa41e5..d0bdf2c 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -288,11 +288,14 @@ i40e_fdir_teardown(struct i40e_pf *pf) { struct i40e_hw *hw = I40E_PF_TO_HW(pf); struct i40e_vsi *vsi; + int err = I40E_SUCCESS; vsi = pf->fdir.fdir_vsi; if (!vsi) return; - i40e_switch_tx_queue(hw, vsi->base_queue, FALSE); + err = i40e_switch_tx_queue(hw, vsi->base_queue, FALSE); + if (err) + PMD_DRV_LOG(WARNING, "Failed to do FDIR TX switch off."); i40e_switch_rx_queue(hw, vsi->base_queue, FALSE); i40e_dev_rx_queue_release(pf->fdir.rxq); pf->fdir.rxq = NULL; -- 1.9.1
[dpdk-dev] [PATCH] i40e: unintended sign extension
Suspicious implicit sign extension: pf->fdir.match_counter_index with type unsigned short (16 bits, unsigned) is promoted in pf->fdir.match_counter_index << 20 to type int (32 bits, signed), then sign-extended to type unsigned long (64 bits, unsigned). If pf->fdir.match_counter_index << 20 is greater than 0x7FFF, the upper bits of the result will all be 1. To fix the issue set explicit cast uint32_t of pf->fdir.match_counter_index. Fixes: 05999aab4ca6 ("i40e: add or delete flow director") Coverity ID 13315 Signed-off-by: Slawomir Mrozowicz --- drivers/net/i40e/i40e_fdir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 8aa41e5..66ef83f 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -1141,7 +1141,8 @@ i40e_fdir_filter_programming(struct i40e_pf *pf, fdirdp->dtype_cmd_cntindex |= rte_cpu_to_le_32(I40E_TXD_FLTR_QW1_CNT_ENA_MASK); fdirdp->dtype_cmd_cntindex |= - rte_cpu_to_le_32((pf->fdir.match_counter_index << + rte_cpu_to_le_32( + ((uint32_t)pf->fdir.match_counter_index << I40E_TXD_FLTR_QW1_CNTINDEX_SHIFT) & I40E_TXD_FLTR_QW1_CNTINDEX_MASK); -- 1.9.1
[dpdk-dev] [PATCH v2] rte mempool: division or modulo by zero
Fix issue reported by Coverity. Coverity ID 13243: Division or modulo by zero In function call rte_mempool_xmem_size, division by expression total_size which may be zero has undefined behavior. Fixes: 148f963fb532 ("xen: core library changes") Signed-off-by: Slawomir Mrozowicz --- lib/librte_mempool/rte_mempool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 1ab6701..b54de43 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -239,6 +239,9 @@ rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz, uint32_t pg_shift) { size_t obj_per_page, pg_num, pg_sz; + if (total_elt_sz == 0) + return 0; + if (pg_shift == 0) return total_elt_sz * elt_num; -- 1.9.1
[dpdk-dev] [PATCH v4] examples/qos_meter: fix unchecked return value
Fix issue reported by Coverity. Coverity ID 30693: Unchecked return value check_return: Calling rte_meter_srtcm_config without checking return value. Fixes: e6541fdec8b2 ("meter: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_meter/main.c | 16 examples/qos_meter/main.h | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b968b00..1565615 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -133,14 +133,20 @@ struct rte_meter_trtcm_params app_trtcm_params[] = { FLOW_METER app_flows[APP_FLOWS_MAX]; -static void +static int app_configure_flow_table(void) { uint32_t i, j; + int ret; - for (i = 0, j = 0; i < APP_FLOWS_MAX; i ++, j = (j + 1) % RTE_DIM(PARAMS)){ - FUNC_CONFIG(_flows[i], [j]); + for (i = 0, j = 0; i < APP_FLOWS_MAX; + i ++, j = (j + 1) % RTE_DIM(PARAMS)) { + ret = FUNC_CONFIG(_flows[i], [j]); + if (ret) + return ret; } + + return 0; } static inline void @@ -381,7 +387,9 @@ main(int argc, char **argv) rte_eth_promiscuous_enable(port_tx); /* App configuration */ - app_configure_flow_table(); + ret = app_configure_flow_table(); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Invalid configure flow table\n"); /* Launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER); diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h index 530bf69..54867dc 100644 --- a/examples/qos_meter/main.h +++ b/examples/qos_meter/main.h @@ -51,7 +51,7 @@ enum policer_action policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] = #if APP_MODE == APP_MODE_FWD #define FUNC_METER(a,b,c,d) color, flow_id=flow_id, pkt_len=pkt_len, time=time -#define FUNC_CONFIG(a,b) +#define FUNC_CONFIG(a, b) 0 #define PARAMS app_srtcm_params #define FLOW_METER int -- 1.9.1
[dpdk-dev] [PATCH] rte mempool: division or modulo by zero
Fix issue reported by Coverity. Coverity ID 13243: Division or modulo by zero In function call rte_mempool_xmem_size, division by expression total_size which may be zero has undefined behavior. Fixes: 148f963fb532 ("xen: core library changes") Signed-off-by: Slawomir Mrozowicz --- lib/librte_mempool/rte_mempool.c | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index f8781e1..01668c1 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -327,15 +327,19 @@ rte_mempool_calc_obj_size(uint32_t elt_size, uint32_t flags, size_t rte_mempool_xmem_size(uint32_t elt_num, size_t elt_sz, uint32_t pg_shift) { - size_t n, pg_num, pg_sz, sz; + size_t n, pg_num, pg_sz; + size_t sz = 0; - pg_sz = (size_t)1 << pg_shift; + if (elt_sz > 0) { + pg_sz = (size_t)1 << pg_shift; + n = pg_sz / elt_sz; - if ((n = pg_sz / elt_sz) > 0) { - pg_num = (elt_num + n - 1) / n; - sz = pg_num << pg_shift; - } else { - sz = RTE_ALIGN_CEIL(elt_sz, pg_sz) * elt_num; + if (n > 0) { + pg_num = (elt_num + n - 1) / n; + sz = pg_num << pg_shift; + } else { + sz = RTE_ALIGN_CEIL(elt_sz, pg_sz) * elt_num; + } } return sz; -- 1.9.1
[dpdk-dev] [PATCH v4] examples/qos_sched: fix bad bit shift operation
Fix issue reported by Coverity. Coverity ID 30690: Bad bit shift operation large_shift: In expression 1ULL << i, left shifting by more than 63 bits has undefined behavior. The shift amount, i, is as much as 127. Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 4 ++-- examples/qos_sched/main.h | 5 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..354372d 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -123,7 +123,7 @@ app_eal_core_mask(void) uint64_t cm = 0; struct rte_config *cfg = rte_eal_get_configuration(); - for (i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < APP_MAX_LCORE; i++) { if (cfg->lcore_role[i] == ROLE_RTE) cm |= (1ULL << i); } @@ -142,7 +142,7 @@ app_cpu_core_count(void) char path[PATH_MAX]; uint32_t ncores = 0; - for(i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < APP_MAX_LCORE; i++) { len = snprintf(path, sizeof(path), SYS_CPU_DIR, i); if (len <= 0 || (unsigned)len >= sizeof(path)) continue; diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 82aa0fa..c7490c6 100644 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -68,7 +68,10 @@ extern "C" { #define BURST_TX_DRAIN_US 100 -#define MAX_DATA_STREAMS (RTE_MAX_LCORE/2) +#ifndef APP_MAX_LCORE +#define APP_MAX_LCORE 64 +#endif +#define MAX_DATA_STREAMS (APP_MAX_LCORE/2) #define MAX_SCHED_SUBPORTS 8 #define MAX_SCHED_PIPES4096 -- 1.9.1
[dpdk-dev] [PATCH v3] examples/qos_sched: fix bad bit shift operation
Fix issue reported by Coverity. Coverity ID 30690: Bad bit shift operation large_shift: In expression 1ULL << i, left shifting by more than 63 bits has undefined behavior. The shift amount, i, is as much as 127. Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 4 ++-- examples/qos_sched/main.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..354372d 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -123,7 +123,7 @@ app_eal_core_mask(void) uint64_t cm = 0; struct rte_config *cfg = rte_eal_get_configuration(); - for (i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < APP_MAX_LCORE; i++) { if (cfg->lcore_role[i] == ROLE_RTE) cm |= (1ULL << i); } @@ -142,7 +142,7 @@ app_cpu_core_count(void) char path[PATH_MAX]; uint32_t ncores = 0; - for(i = 0; i < RTE_MAX_LCORE; i++) { + for (i = 0; i < APP_MAX_LCORE; i++) { len = snprintf(path, sizeof(path), SYS_CPU_DIR, i); if (len <= 0 || (unsigned)len >= sizeof(path)) continue; diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 82aa0fa..e0517d1 100644 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -68,7 +68,8 @@ extern "C" { #define BURST_TX_DRAIN_US 100 -#define MAX_DATA_STREAMS (RTE_MAX_LCORE/2) +#define APP_MAX_LCORE 64 +#define MAX_DATA_STREAMS (APP_MAX_LCORE/2) #define MAX_SCHED_SUBPORTS 8 #define MAX_SCHED_PIPES4096 -- 1.9.1
[dpdk-dev] [PATCH v3] examples/qos_meter: fix unchecked return value
Fix issue reported by Coverity. Coverity ID 30693: Unchecked return value check_return: Calling rte_meter_srtcm_config without checking return value. Fixes: e6541fdec8b2 ("meter: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_meter/main.c | 15 ++- examples/qos_meter/main.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b968b00..7c69606 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -133,14 +133,17 @@ struct rte_meter_trtcm_params app_trtcm_params[] = { FLOW_METER app_flows[APP_FLOWS_MAX]; -static void +static int app_configure_flow_table(void) { uint32_t i, j; + int ret = 0; - for (i = 0, j = 0; i < APP_FLOWS_MAX; i ++, j = (j + 1) % RTE_DIM(PARAMS)){ - FUNC_CONFIG(_flows[i], [j]); - } + for (i = 0, j = 0; i < APP_FLOWS_MAX && ret == 0; + i ++, j = (j + 1) % RTE_DIM(PARAMS)) + ret = FUNC_CONFIG(_flows[i], [j]); + + return ret; } static inline void @@ -381,7 +384,9 @@ main(int argc, char **argv) rte_eth_promiscuous_enable(port_tx); /* App configuration */ - app_configure_flow_table(); + ret = app_configure_flow_table(); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Invalid configure flow table\n"); /* Launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER); diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h index 530bf69..54867dc 100644 --- a/examples/qos_meter/main.h +++ b/examples/qos_meter/main.h @@ -51,7 +51,7 @@ enum policer_action policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] = #if APP_MODE == APP_MODE_FWD #define FUNC_METER(a,b,c,d) color, flow_id=flow_id, pkt_len=pkt_len, time=time -#define FUNC_CONFIG(a,b) +#define FUNC_CONFIG(a, b) 0 #define PARAMS app_srtcm_params #define FLOW_METER int -- 1.9.1
[dpdk-dev] [PATCH] lpm: unchecked return value
Fix issue reported by Coverity. Coverity ID 13205: Unchecked return value Unchecked return value check_return: Calling rte_lpm6_add without checking return value Fixes: 5c510e13a9cb ("lpm: add IPv6 support") Signed-off-by: Slawomir Mrozowicz --- lib/librte_lpm/rte_lpm6.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index ba4353c..f4db3fa 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -749,6 +749,7 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) int32_t rule_to_delete_index; uint8_t ip_masked[RTE_LPM6_IPV6_ADDR_SIZE]; unsigned i; + int status = 0; /* * Check input arguments. @@ -790,12 +791,13 @@ rte_lpm6_delete(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth) * Add every rule again (except for the one that was removed from * the rules table). */ - for (i = 0; i < lpm->used_rules; i++) { - rte_lpm6_add(lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth, - lpm->rules_tbl[i].next_hop); + for (i = 0; i < lpm->used_rules && status >= 0; i++) { + status = rte_lpm6_add( + lpm, lpm->rules_tbl[i].ip, lpm->rules_tbl[i].depth, + lpm->rules_tbl[i].next_hop); } - return 0; + return status; } /* -- 1.9.1
[dpdk-dev] [PATCH v2] eal: out-of-bounds write
Fix issue reported by Coverity. Coverity ID 13282: Out-of-bounds write overrun-local: Overrunning array mcfg->memseg of 256 44-byte elements at element index 257 using index j. Fixes: af75078fece3 ("first public release") Signed-off-by: Slawomir Mrozowicz --- lib/librte_eal/linuxapp/eal/eal_memory.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c..715bd52 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1333,8 +1333,11 @@ rte_eal_hugepage_init(void) if (new_memseg) { j += 1; - if (j == RTE_MAX_MEMSEG) + if (j >= RTE_MAX_MEMSEG) { + RTE_LOG(ERR, EAL, + "Failed: memseg reached RTE_MAX_MEMSEG\n"); break; + } mcfg->memseg[j].phys_addr = hugepage[i].physaddr; mcfg->memseg[j].addr = hugepage[i].final_va; -- 1.9.1
[dpdk-dev] [PATCH] eal: out-of-bounds write
Fix issue reported by Coverity. Coverity ID 13282: Out-of-bounds write overrun-local: Overrunning array mcfg->memseg of 256 44-byte elements at element index 257 using index j. Fixes: af75078fece3 ("first public release") Signed-off-by: Slawomir Mrozowicz --- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 5b9132c..1e737e4 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -1333,7 +1333,7 @@ rte_eal_hugepage_init(void) if (new_memseg) { j += 1; - if (j == RTE_MAX_MEMSEG) + if (j >= RTE_MAX_MEMSEG) break; mcfg->memseg[j].phys_addr = hugepage[i].physaddr; -- 1.9.1
[dpdk-dev] [PATCH] examples: fix CID 30693 unchecked return value
It fix coverity issue: CID 30693 (#1 of 1): Unchecked return value (CHECKED_RETURN) 2. check_return: Calling rte_meter_srtcm_config without checking return value (as is done elsewhere 16 out of 17 times). Fixes: e6541fdec8b2 ("meter: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_meter/main.c | 15 ++- examples/qos_meter/main.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index b968b00..16b0b87 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -133,14 +133,17 @@ struct rte_meter_trtcm_params app_trtcm_params[] = { FLOW_METER app_flows[APP_FLOWS_MAX]; -static void +static int app_configure_flow_table(void) { uint32_t i, j; + int ret = 0; - for (i = 0, j = 0; i < APP_FLOWS_MAX; i ++, j = (j + 1) % RTE_DIM(PARAMS)){ - FUNC_CONFIG(_flows[i], [j]); - } + for (i = 0, j = 0; i < APP_FLOWS_MAX; + i ++, j = (j + 1) % RTE_DIM(PARAMS)) + ret |= FUNC_CONFIG(_flows[i], [j]); + + return ret; } static inline void @@ -381,7 +384,9 @@ main(int argc, char **argv) rte_eth_promiscuous_enable(port_tx); /* App configuration */ - app_configure_flow_table(); + ret = app_configure_flow_table(); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Invalid configure flow table\n"); /* Launch per-lcore init on every lcore */ rte_eal_mp_remote_launch(main_loop, NULL, CALL_MASTER); diff --git a/examples/qos_meter/main.h b/examples/qos_meter/main.h index 530bf69..54867dc 100644 --- a/examples/qos_meter/main.h +++ b/examples/qos_meter/main.h @@ -51,7 +51,7 @@ enum policer_action policer_table[e_RTE_METER_COLORS][e_RTE_METER_COLORS] = #if APP_MODE == APP_MODE_FWD #define FUNC_METER(a,b,c,d) color, flow_id=flow_id, pkt_len=pkt_len, time=time -#define FUNC_CONFIG(a,b) +#define FUNC_CONFIG(a, b) 0 #define PARAMS app_srtcm_params #define FLOW_METER int -- 1.9.1 Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
[dpdk-dev] [PATCH] examples: fix CID 30690 bad bit shift operation
It fix coverity issue: CID 30690 (#1 of 1): Bad bit shift operation (BAD_SHIFT) 10. large_shift: In expression 1ULL << i, left shifting by more than 63 bits has undefined behavior. The shift amount, i, is as much as 127. Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 84 +-- 1 file changed, 52 insertions(+), 32 deletions(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..cd077ba 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -53,7 +53,7 @@ static uint32_t app_master_core = 1; static uint32_t app_numa_mask; -static uint64_t app_used_core_mask = 0; +static int app_used_core_mask[RTE_MAX_LCORE]; static uint64_t app_used_port_mask = 0; static uint64_t app_used_rx_port_mask = 0; static uint64_t app_used_tx_port_mask = 0; @@ -115,22 +115,23 @@ static inline int str_is(const char *str, const char *is) return strcmp(str, is) == 0; } -/* returns core mask used by DPDK */ -static uint64_t -app_eal_core_mask(void) +/* compare used core with eal configuration, + returns: + 1 if equal + 0 if differ */ +static int +app_eal_core_check(void) { - uint32_t i; - uint64_t cm = 0; + uint16_t i; + int ret = 1; struct rte_config *cfg = rte_eal_get_configuration(); - for (i = 0; i < RTE_MAX_LCORE; i++) { - if (cfg->lcore_role[i] == ROLE_RTE) - cm |= (1ULL << i); + for (i = 0; i < RTE_MAX_LCORE && ret; i++) { + if ((cfg->lcore_role[i] == ROLE_RTE) != app_used_core_mask[i]) + ret = 0; } - cm |= (1ULL << cfg->master_lcore); - - return cm; + return ret; } @@ -292,14 +293,9 @@ app_parse_flow_conf(const char *conf_str) app_used_tx_port_mask |= mask; app_used_port_mask |= mask; - mask = 1lu << pconf->rx_core; - app_used_core_mask |= mask; - - mask = 1lu << pconf->wt_core; - app_used_core_mask |= mask; - - mask = 1lu << pconf->tx_core; - app_used_core_mask |= mask; + app_used_core_mask[pconf->rx_core] = 1; + app_used_core_mask[pconf->wt_core] = 1; + app_used_core_mask[pconf->tx_core] = 1; nb_pfc++; @@ -335,7 +331,7 @@ app_parse_args(int argc, char **argv) int option_index; const char *optname; char *prgname = argv[0]; - uint32_t i, nb_lcores; + uint16_t i, j, k, nb_lcores; static struct option lgopts[] = { { "pfc", 1, 0, 0 }, @@ -349,6 +345,9 @@ app_parse_args(int argc, char **argv) { NULL, 0, 0, 0 } }; + for (i = 0; i < RTE_MAX_LCORE; i++) + app_used_core_mask[i] = 0; + /* initialize EAL first */ ret = rte_eal_init(argc, argv); if (ret < 0) @@ -436,19 +435,40 @@ app_parse_args(int argc, char **argv) } /* check master core index validity */ - for(i = 0; i <= app_master_core; i++) { - if (app_used_core_mask & (1u << app_master_core)) { - RTE_LOG(ERR, APP, "Master core index is not configured properly\n"); - app_usage(prgname); - return -1; - } + if (app_used_core_mask[app_master_core] == 1) { + RTE_LOG(ERR, APP, + "Master core index is not configured properly\n"); + app_usage(prgname); + return -1; } - app_used_core_mask |= 1u << app_master_core; + app_used_core_mask[app_master_core] = 1; + + if ((app_eal_core_check() == 0) || + (app_master_core != rte_get_master_lcore())) { + + char used_hexstr[RTE_MAX_LCORE/4+1]; + char conf_hexstr[RTE_MAX_LCORE/4+1]; + int used_byte, conf_byte; + struct rte_config *cfg = rte_eal_get_configuration(); + + for (i = 0; i < RTE_MAX_LCORE/4; i++) { + used_byte = 0; + conf_byte = 0; + for (j = 0; j < 3; j++) { + k = 4 * (RTE_MAX_LCORE/4 - i - 1) + j; + used_byte += app_used_core_mask[k] << j; + conf_byte += + ((cfg->lcore_role[k] == + ROLE_RTE)?1:0) << j; + } + sprintf(_hexstr[i], "%1x", used_byte); + sprintf(_hexstr[i], "%1x", used_byte); + } + + RTE_LOG(ERR, APP, "EAL core mask not configured properly\n");
[dpdk-dev] [PATCH] examples: fix CID 30708 out-of-bounds read
It fix coverity issue: CID 30708 (#1 of 1): Out-of-bounds read (OVERRUN) 12. overrun-local: Overrunning array tokens of 8 8-byte elements at element index 4294967294 (byte offset 34359738352) using index i (which evaluates to 4294967294). Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..d819269 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -175,9 +175,11 @@ app_parse_opt_vals(const char *conf_str, char separator, uint32_t n_vals, uint32 n_tokens = rte_strsplit(string, strnlen(string, 32), tokens, n_vals, separator); - for(i = 0; i < n_tokens; i++) { + if (n_tokens > MAX_OPT_VALUES) + return -1; + + for (i = 0; i < n_tokens; i++) opt_vals[i] = (uint32_t)atol(tokens[i]); - } free(string); -- 1.9.1 Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
[dpdk-dev] [PATCH] examples: fix CID 30704 negative loop bound
It fix coverity issue: CID 30704 (#1 of 1): Negative loop bound (NEGATIVE_RETURNS) 8. negative_returns: Using unsigned variable n_tokens in a loop exit condition. Date: Thu, 14 Apr 2016 13:15:49 +0200 Message-Id: <1460632549-20942-1-git-send-email-slawomirx.mrozowicz at intel.com> X-Mailer: git-send-email 1.9.1 Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..7a98e5c 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -162,7 +162,7 @@ static int app_parse_opt_vals(const char *conf_str, char separator, uint32_t n_vals, uint32_t *opt_vals) { char *string; - uint32_t i, n_tokens; + int i, n_tokens; char *tokens[MAX_OPT_VALUES]; if (conf_str == NULL || opt_vals == NULL || n_vals == 0 || n_vals > MAX_OPT_VALUES) -- 1.9.1 Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
[dpdk-dev] [PATCH] examples: fix CID 30699 copy-paste error
It fix coverity issue: CID 30699 (#1 of 1): Copy-paste error (COPY_PASTE_ERROR) copy_paste_error: rx_port in pconf->rx_port looks like a copy-paste error. Fixes: de3cfa2c9823 ("sched: initial import") Signed-off-by: Slawomir Mrozowicz --- examples/qos_sched/args.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 3e7fd08..1916790 100644 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -270,7 +270,7 @@ app_parse_flow_conf(const char *conf_str) } if (pconf->tx_port >= RTE_MAX_ETHPORTS) { RTE_LOG(ERR, APP, "pfc %u: invalid tx port %"PRIu8" index\n", - nb_pfc, pconf->rx_port); + nb_pfc, pconf->tx_port); return -1; } -- 1.9.1 Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.
[dpdk-dev] [PATCH] ethdev: fix CID 124557 unchecked return value
It fix coverity issue: CID 124557 (#1 of 1): Unchecked return value (CHECKED_RETURN) 3. check_return: Calling rte_eth_tx_buffer_set_err_callback without checking return value (as is done elsewhere 6 out of 7 times). Fixes: d6c99e62c852 ("ethdev: add buffered Tx") Signed-off-by: Slawomir Mrozowicz --- lib/librte_ether/rte_ethdev.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index dcf9e6f..0dc1025 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -1342,15 +1342,19 @@ rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer *buffer, int rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer *buffer, uint16_t size) { + int ret_val = 0; + if (buffer == NULL) return -EINVAL; buffer->size = size; - if (buffer->error_callback == NULL) - rte_eth_tx_buffer_set_err_callback(buffer, - rte_eth_tx_buffer_drop_callback, NULL); + if (buffer->error_callback == NULL) { - return 0; + ret_val = rte_eth_tx_buffer_set_err_callback( + buffer, rte_eth_tx_buffer_drop_callback, NULL); + } + + return ret_val; } void -- 1.9.1 Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.