From: Declan Doherty
This patch provides the implementation of a NULL crypto PMD, which supports
NULL cipher and NULL authentication operations, which can be chained together
as follows:
- Authentication Only
- Cipher Only
- Authentication then Cipher
- Cipher then Authentication
As this is a NULL operation device the crypto operations which are submitted for
processing are not actually modified and are stored in a queue pairs processed
packets ring ready for collection when rte_cryptodev_burst_dequeue() is called.
The patch also contains the related unit tests function to test the PMDs
supported operations.
Signed-off-by: Declan Doherty
---
This patch depends on "AES GCM, AES CMAC fixes and addition of GCM tests for
QAT" patchset
(http://dpdk.org/ml/archives/dev/2016-March/034974.html)
Changes in v2:
- Rebased to include Cryptodev API changes
MAINTAINERS| 4 +
app/test/test_cryptodev.c | 402 -
config/common_base | 5 +
doc/api/doxy-api.conf | 1 -
doc/guides/cryptodevs/index.rst| 3 +-
doc/guides/cryptodevs/null.rst | 72
doc/guides/rel_notes/release_16_04.rst | 4 +
drivers/crypto/Makefile| 1 +
drivers/crypto/null/Makefile | 59 +++
drivers/crypto/null/null_crypto_pmd.c | 275 ++
drivers/crypto/null/null_crypto_pmd_ops.c | 308
drivers/crypto/null/null_crypto_pmd_private.h | 93 +
.../crypto/null/rte_pmd_null_crypto_version.map| 3 +
mk/rte.app.mk | 1 +
14 files changed, 1228 insertions(+), 3 deletions(-)
create mode 100644 doc/guides/cryptodevs/null.rst
create mode 100644 drivers/crypto/null/Makefile
create mode 100644 drivers/crypto/null/null_crypto_pmd.c
create mode 100644 drivers/crypto/null/null_crypto_pmd_ops.c
create mode 100644 drivers/crypto/null/null_crypto_pmd_private.h
create mode 100644 drivers/crypto/null/rte_pmd_null_crypto_version.map
diff --git a/MAINTAINERS b/MAINTAINERS
index d4b2d98..0bf8a77 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -364,6 +364,10 @@ SNOW 3G PMD
M: Pablo de Lara
F: drivers/crypto/snow3g
+Null Crypto PMD
+M: Declan Doherty
+F: drivers/crypto/null/
+
Packet processing
-
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index b862f72..28d9d54 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -226,6 +226,23 @@ testsuite_setup(void)
}
}
+ /* Create 2 NULL devices if required */
+ if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) {
+ nb_devs = rte_cryptodev_count_devtype(
+ RTE_CRYPTODEV_NULL_PMD);
+ if (nb_devs < 2) {
+ for (i = nb_devs; i < 2; i++) {
+ int dev_id = rte_eal_vdev_init(
+ CRYPTODEV_NAME_NULL_PMD, NULL);
+
+ TEST_ASSERT(dev_id >= 0,
+ "Failed to create instance %u of"
+ " pmd : %s",
+ i, CRYPTODEV_NAME_NULL_PMD);
+ }
+ }
+ }
+
nb_devs = rte_cryptodev_count();
if (nb_devs < 1) {
RTE_LOG(ERR, USER1, "No crypto devices found?");
@@ -3364,15 +3381,362 @@ test_not_in_place_crypto(void)
QUOTE_512_BYTES,
"Plaintext data not as expected");
+ return TEST_SUCCESS;
+}
+
+static int
+test_null_cipher_only_operation(void)
+{
+ struct crypto_testsuite_params *ts_params = _params;
+ struct crypto_unittest_params *ut_params = _params;
+
+ /* Generate test mbuf data and space for digest */
+ ut_params->ibuf = setup_test_string(ts_params->mbuf_pool,
+ catch_22_quote, QUOTE_512_BYTES, 0);
+
+ /* Setup Cipher Parameters */
+ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ ut_params->cipher_xform.next = NULL;
+
+ ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
+ ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+
+ /* Create Crypto session*/
+ ut_params->sess = rte_cryptodev_sym_session_create(
+ ts_params->valid_devs[0], _params->cipher_xform);
+ TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed");
+
+ /* Generate Crypto op data structure */
+ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+ TEST_ASSERT_NOT_NULL(ut_params->op,
+ "Failed to allocate symmetric crypto operation