[dpdk-dev] [PATCH] test: adding AES cipher-only tests on QAT PMD
Extended functional AES-CBC and AES-CTR cipher-only tests to run on QAT PMD. Added AES_CBC cipher-only performance tests on QAT PMD. No driver changes, but as now tested, QAT documentation is updated to remove constraint. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 18 ++ app/test/test_cryptodev_aes_test_vectors.h | 36 +++ app/test/test_cryptodev_perf.c | 96 +++--- doc/guides/cryptodevs/qat.rst | 1 - 4 files changed, 102 insertions(+), 49 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 872f8b4..00dced5 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1530,6 +1530,22 @@ test_AES_chain_qat_all(void) } static int +test_AES_cipheronly_qat_all(void) +{ + struct crypto_testsuite_params *ts_params = _params; + int status; + + status = test_blockcipher_all_tests(ts_params->mbuf_pool, + ts_params->op_mpool, ts_params->valid_devs[0], + RTE_CRYPTODEV_QAT_SYM_PMD, + BLKCIPHER_AES_CIPHERONLY_TYPE); + + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return TEST_SUCCESS; +} + +static int test_authonly_openssl_all(void) { struct crypto_testsuite_params *ts_params = _params; @@ -6032,6 +6048,8 @@ static struct unit_test_suite cryptodev_qat_testsuite = { test_multi_session), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_chain_qat_all), + TEST_CASE_ST(ut_setup, ut_teardown, + test_AES_cipheronly_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_chain_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_cipheronly_qat_all), diff --git a/app/test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_vectors.h index 1c68f93..efbe7da 100644 --- a/app/test/test_cryptodev_aes_test_vectors.h +++ b/app/test/test_cryptodev_aes_test_vectors.h @@ -1024,73 +1024,85 @@ static const struct blockcipher_test_case aes_cipheronly_test_cases[] = { .test_descr = "AES-128-CBC Encryption", .test_data = _test_data_4, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-128-CBC Decryption", .test_data = _test_data_4, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-192-CBC Encryption", .test_data = _test_data_10, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-192-CBC Decryption", .test_data = _test_data_10, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-256-CBC Encryption", .test_data = _test_data_11, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-256-CBC Decryption", .test_data = _test_data_11, .op_mask = BLOCKCIPHER_TEST_OP_DECRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-128-CTR Encryption", .test_data = _test_data_1, .op_mask = BLOCKCIPHER_TEST_OP_ENCRYPT, - .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL + .pmd_mask = BLOCKCIPHER_TEST_TARGET_PMD_OPENSSL | + BLOCKCIPHER_TEST_TARGET_PMD_QAT }, { .test_descr = "AES-128-CTR Decryption", .test_data = _test_data_1, .op_mask = BLOCKCIPHER_TEST_OP
[dpdk-dev] [PATCH] crypto/qat: fix to avoid buffer overwrite in OOP case
In out-of-place operation, data is DMAed from source mbuf to destination mbuf. To avoid header data in dest mbuf being overwritten, the minimal data-set should be DMAed. Fixes: 39e0bee48e81 ("crypto/qat: rework request builder for performance") Signed-off-by: Fiona Trahe --- This patch depends on following patch : crypto: remove unused digest-appended feature http://dpdk.org/dev/patchwork/patch/17079/ drivers/crypto/qat/qat_crypto.c | 66 - drivers/crypto/qat/qat_crypto.h | 1 + 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 6a6bd2e..afce4ac 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -955,7 +955,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) uint32_t cipher_len = 0, cipher_ofs = 0; uint32_t auth_len = 0, auth_ofs = 0; uint32_t min_ofs = 0; - uint64_t buf_start = 0; + uint64_t src_buf_start = 0, dst_buf_start = 0; #ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX @@ -1077,27 +1077,40 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) if (do_cipher && do_auth) min_ofs = cipher_ofs < auth_ofs ? cipher_ofs : auth_ofs; - - /* Start DMA at nearest aligned address below min_ofs */ - #define QAT_64_BTYE_ALIGN_MASK (~0x3f) - buf_start = rte_pktmbuf_mtophys_offset(op->sym->m_src, min_ofs) & - QAT_64_BTYE_ALIGN_MASK; - - if (unlikely((rte_pktmbuf_mtophys(op->sym->m_src) - - rte_pktmbuf_headroom(op->sym->m_src)) > buf_start)) { - /* alignment has pushed addr ahead of start of mbuf -* so revert and take the performance hit + if (unlikely(op->sym->m_dst != NULL)) { + /* Out-of-place operation (OOP) +* Don't align DMA start. DMA the minimum data-set +* so as not to overwrite data in dest buffer */ - buf_start = rte_pktmbuf_mtophys(op->sym->m_src); + src_buf_start = + rte_pktmbuf_mtophys_offset(op->sym->m_src, min_ofs); + dst_buf_start = + rte_pktmbuf_mtophys_offset(op->sym->m_dst, min_ofs); + } else { + /* In-place operation +* Start DMA at nearest aligned address below min_ofs +*/ + src_buf_start = + rte_pktmbuf_mtophys_offset(op->sym->m_src, min_ofs) + & QAT_64_BTYE_ALIGN_MASK; + + if (unlikely((rte_pktmbuf_mtophys(op->sym->m_src) - + rte_pktmbuf_headroom(op->sym->m_src)) + > src_buf_start)) { + /* alignment has pushed addr ahead of start of mbuf +* so revert and take the performance hit +*/ + src_buf_start = + rte_pktmbuf_mtophys_offset(op->sym->m_src, + min_ofs); + } + dst_buf_start = src_buf_start; } - qat_req->comn_mid.dest_data_addr = - qat_req->comn_mid.src_data_addr = buf_start; - if (do_cipher) { cipher_param->cipher_offset = - (uint32_t)rte_pktmbuf_mtophys_offset( - op->sym->m_src, cipher_ofs) - buf_start; + (uint32_t)rte_pktmbuf_mtophys_offset( + op->sym->m_src, cipher_ofs) - src_buf_start; cipher_param->cipher_length = cipher_len; } else { cipher_param->cipher_offset = 0; @@ -1105,7 +1118,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) } if (do_auth) { auth_param->auth_off = (uint32_t)rte_pktmbuf_mtophys_offset( - op->sym->m_src, auth_ofs) - buf_start; + op->sym->m_src, auth_ofs) - src_buf_start; auth_param->auth_len = auth_len; } else { auth_param->auth_off = 0; @@ -1118,21 +1131,8 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) (cipher_param->cipher_offset + cipher_param->cipher_length) : (auth_param->auth_off + auth_param->auth_len); - - /* out-of-place operation (OOP) */ - if (unlikely(op->sym->m_dst != NULL)) { - - if (do_auth) -
[dpdk-dev] [PATCH] crypto: remove unused digest-appended feature
The cryptodev API had specified that if the digest address field was left empty on an authentication operation, then the PMD would assume the digest was appended to the source or destination data. This case was not handled at all by most PMDs and incorrectly handled by the QAT PMD. As no bugs were raised, it is assumed to be not needed, so this patch removes it, rather than add handling for the case on all PMDs. The digest can still be appended to the data, but its address must now be provided in the op. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 2 ++ drivers/crypto/qat/qat_crypto.c | 18 +- lib/librte_cryptodev/rte_crypto_sym.h| 10 +- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 8900668..f4e24b3 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -439,6 +439,8 @@ void qat_alg_init_common_hdr(struct icp_qat_fw_comn_req_hdr *header, proto); ICP_QAT_FW_LA_UPDATE_STATE_SET(header->serv_specif_flags, ICP_QAT_FW_LA_NO_UPDATE_STATE); + ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET(header->serv_specif_flags, + ICP_QAT_FW_LA_NO_DIGEST_IN_BUFFER); } int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 798cd98..6a6bd2e 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -955,7 +955,6 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) uint32_t cipher_len = 0, cipher_ofs = 0; uint32_t auth_len = 0, auth_ofs = 0; uint32_t min_ofs = 0; - uint32_t digest_appended = 1; uint64_t buf_start = 0; @@ -1068,14 +1067,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) } min_ofs = auth_ofs; - if (op->sym->auth.digest.phys_addr) { - ICP_QAT_FW_LA_DIGEST_IN_BUFFER_SET( - qat_req->comn_hdr.serv_specif_flags, - ICP_QAT_FW_LA_NO_DIGEST_IN_BUFFER); - auth_param->auth_res_addr = - op->sym->auth.digest.phys_addr; - digest_appended = 0; - } + auth_param->auth_res_addr = op->sym->auth.digest.phys_addr; auth_param->u1.aad_adr = op->sym->auth.aad.phys_addr; @@ -1126,14 +1118,6 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) (cipher_param->cipher_offset + cipher_param->cipher_length) : (auth_param->auth_off + auth_param->auth_len); - if (do_auth && digest_appended) { - if (ctx->auth_op == ICP_QAT_HW_AUTH_GENERATE) - qat_req->comn_mid.dst_length - += op->sym->auth.digest.length; - else - qat_req->comn_mid.src_length - += op->sym->auth.digest.length; - } /* out-of-place operation (OOP) */ if (unlikely(op->sym->m_dst != NULL)) { diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index d3d38e4..d694723 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -541,8 +541,7 @@ struct rte_crypto_sym_op { struct { uint8_t *data; - /**< If this member of this structure is set this is a -* pointer to the location where the digest result + /**< This points to the location where the digest result * should be inserted (in the case of digest generation) * or where the purported digest exists (in the case of * digest verification). @@ -560,13 +559,6 @@ struct rte_crypto_sym_op { * @note * For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM), for * "digest result" read "authentication tag T". -* -* If this member is not set the digest result is -* understood to be in the destination buffer for -* digest generation, and in the source buffer for -* digest verification. The location of the digest -* result in this case is immediately following the -
[dpdk-dev] [PATCH] crypto: remove unused digest-appended feature
The cryptodev API had specified that if the digest address field was left empty on an authentication operation, then the PMD would assume the digest was appended to the source or destination data. This case was not handled at all by most PMDs and incorrectly handled by the QAT PMD. As no bugs were raised, it is assumed to be not needed, so this patch removes it, rather than add handling for the case on all PMDs. The digest can still be appended to the data, but its address must now be provided in the op. I've added this cover letter to pre-empt the question which will arise in chained-mbuf case. (Chained-mbuf support will be added in next few weeks for 17.02) In a chained-mbuf case, if the digest is appended to the data, it could in theory end up split across the last 2 mbufs. Using the digest address field only works for the case where the digest is in a flat buffer. The digest-appended feature would have provided one way of handling this, pushing the responsibility down to the PMD to follow the chain to find the digest address and handle it whether in 1 or 2 mbufs. However, this is adding extra cycles on the data path in all PMDs to handle a case which may not arise in many applications. The alternative is to give the application the responsibility to make sure the digest is in a flat buffer. Specifically if an application knows cases of a digest spanning buffers can arise, then it can check for this case and memcpy the partial start of the digest from the second last buffer into the last buffer so it's no longer split. Does anyone see a problem with this? Fiona Trahe (1): crypto: remove unused digest-appended feature drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 2 ++ drivers/crypto/qat/qat_crypto.c | 18 +- lib/librte_cryptodev/rte_crypto_sym.h| 10 +- 3 files changed, 4 insertions(+), 26 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH v2] doc: add known issue on QAT PMD into release notes
Issue is with the digest appended feature on QAT PMD. A workaround is also documented. Signed-off-by: Fiona Trahe Acked-by: John McNamara --- v2 - fixed trailing whitespace checkpatch errors doc/guides/rel_notes/release_16_11.rst | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 365b5a3..5f925b5 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -213,7 +213,18 @@ Known Issues Therefore, in order to use L3fwd-power, vector mode should be disabled from the config file. - +* **Digest address must be supplied for crypto auth operation on QAT PMD.** + + The cryptodev API specifies that if the rte_crypto_sym_op.digest.data field, + and by inference the digest.phys_addr field which points to the same location, + is not set for an auth operation the driver is to understand that the digest + result is located immediately following the region over which the digest is + computed. The QAT PMD doesn't correctly handle this case and reads and writes + to an incorrect location. + + Callers can workaround this by always supplying the digest virtual and + physical address fields in the rte_crypto_sym_op for an auth operation. + API Changes --- -- 2.5.0
[dpdk-dev] [PATCH] doc: add known issue on QAT PMD into release notes
Issue is with the digest appended feature on QAT PMD. A workaround is also documented. Signed-off-by: Fiona Trahe --- doc/guides/rel_notes/release_16_11.rst | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 365b5a3..5f925b5 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -213,7 +213,18 @@ Known Issues Therefore, in order to use L3fwd-power, vector mode should be disabled from the config file. - +* **Digest address must be supplied for crypto auth operation on QAT PMD.** + + The cryptodev API specifies that if the rte_crypto_sym_op.digest.data field, + and by inference the digest.phys_addr field which points to the same location, + is not set for an auth operation the driver is to understand that the digest + result is located immediately following the region over which the digest is + computed. The QAT PMD doesn't correctly handle this case and reads and writes + to an incorrect location. + + Callers can workaround this by always supplying the digest virtual and + physical address fields in the rte_crypto_sym_op for an auth operation. + API Changes --- -- 2.5.0
[dpdk-dev] [PATCH] crypto: clarify how crypto operations affect buffers
Updated comments on API to clarify which parts of mbufs are copied or changed by crypto operations. Signed-off-by: Fiona Trahe --- lib/librte_cryptodev/rte_crypto_sym.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index 693774e..d3d38e4 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -366,6 +366,25 @@ struct rte_cryptodev_sym_session; * it must have a valid *rte_mbuf* structure attached, via m_src parameter, * which contains the source data which the crypto operation is to be performed * on. + * While the mbuf is in use by a crypto operation no part of the mbuf should be + * changed by the application as the device may read or write to any part of the + * mbuf. In the case of hardware crypto devices some or all of the mbuf + * may be DMAed in and out of the device, so writing over the original data, + * though only the part specified by the rte_crypto_sym_op for transformation + * will be changed. + * Out-of-place (OOP) operation, where the source mbuf is different to the + * destination mbuf, is a special case. Data will be copied from m_src to m_dst. + * The part copied includes all the parts of the source mbuf that will be + * operated on, based on the cipher.data.offset+cipher.data.length and + * auth.data.offset+auth.data.length values in the rte_crypto_sym_op. The part + * indicated by the cipher parameters will be transformed, any extra data around + * this indicated by the auth parameters will be copied unchanged from source to + * destination mbuf. + * Also in OOP operation the cipher.data.offset and auth.data.offset apply to + * both source and destination mbufs. As these offsets are relative to the + * data_off parameter in each mbuf this can result in the data written to the + * destination buffer being at a different alignment, relative to buffer start, + * to the data in the source buffer. */ struct rte_crypto_sym_op { struct rte_mbuf *m_src; /**< source mbuf */ -- 2.5.0
[dpdk-dev] [PATCH v2] doc/guides: add more info about VT-d/iommu settings
Add more information about VT-d/iommu settings for QAT PMD. Remove limitation indicating QAT driver is not performance tuned. Signed-off-by: Fiona Trahe --- v2: clarified commit message doc/guides/cryptodevs/qat.rst | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 70bc2b1..bbe0b12 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -77,7 +77,6 @@ Limitations * Hash only is not supported except SNOW 3G UIA2 and KASUMI F9. * Cipher only is not supported except SNOW 3G UEA2, KASUMI F8 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). -* Not performance tuned. * SNOW 3G (UEA2) and KASUMI (F8) supported only if cipher length, cipher offset fields are byte-aligned. * SNOW 3G (UIA2) and KASUMI (F9) supported only if hash length, hash offset fields are byte-aligned. * No BSD support as BSD QAT kernel driver not available. @@ -201,7 +200,7 @@ The steps below assume you are: * Running DPDK on a platform with one ``DH895xCC`` device. * On a kernel at least version 4.4. -In BIOS ensure that SRIOV is enabled and VT-d is disabled. +In BIOS ensure that SRIOV is enabled and either a) disable VT-d or b) enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file. Ensure the QAT driver is loaded on your system, by executing:: @@ -260,7 +259,7 @@ The steps below assume you are: * Running DPDK on a platform with one ``C62x`` device. * On a kernel at least version 4.5. -In BIOS ensure that SRIOV is enabled and VT-d is disabled. +In BIOS ensure that SRIOV is enabled and either a) disable VT-d or b) enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file. Ensure the QAT driver is loaded on your system, by executing:: @@ -304,7 +303,7 @@ The steps below assume you are: * Running DPDK on a platform with one ``C3xxx`` device. * On a kernel at least version 4.5. -In BIOS ensure that SRIOV is enabled and VT-d is disabled. +In BIOS ensure that SRIOV is enabled and either a) disable VT-d or b) enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file. Ensure the QAT driver is loaded on your system, by executing:: -- 2.5.0
[dpdk-dev] [PATCH 2/2] app/test: use correct offsets in AES perf test
offsets for digest and data need to be adjusted to take prepended IV into account Signed-off-by: Fiona Trahe --- app/test/test_cryptodev_perf.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index e05e11b..53dd8f5 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -2714,26 +2714,27 @@ test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m, } /* Authentication Parameters */ - op->sym->auth.digest.data = (uint8_t *)m->buf_addr + - (m->data_off + data_len); - op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, data_len); + op->sym->auth.digest.data = rte_pktmbuf_mtod_offset(m, uint8_t *, + AES_CIPHER_IV_LENGTH + data_len); + op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m, + AES_CIPHER_IV_LENGTH + data_len); op->sym->auth.digest.length = digest_len; op->sym->auth.aad.data = aes_iv; op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH; /* Cipher Parameters */ - op->sym->cipher.iv.data = (uint8_t *)m->buf_addr + m->data_off; + op->sym->cipher.iv.data = rte_pktmbuf_mtod(m, uint8_t *); op->sym->cipher.iv.phys_addr = rte_pktmbuf_mtophys(m); op->sym->cipher.iv.length = AES_CIPHER_IV_LENGTH; rte_memcpy(op->sym->cipher.iv.data, aes_iv, AES_CIPHER_IV_LENGTH); /* Data lengths/offsets Parameters */ - op->sym->auth.data.offset = 0; + op->sym->auth.data.offset = AES_CIPHER_IV_LENGTH; op->sym->auth.data.length = data_len; - op->sym->cipher.data.offset = AES_BLOCK_SIZE; - op->sym->cipher.data.length = data_len - AES_BLOCK_SIZE; + op->sym->cipher.data.offset = AES_CIPHER_IV_LENGTH; + op->sym->cipher.data.length = data_len; op->sym->m_src = m; -- 2.5.0
[dpdk-dev] [PATCH 1/2] crypto/qat: rework request builder for performance
QAT PMD adjusts the buffer start address and offsets passed to the device so that the DMAs in and out of the device are 64-byte aligned. This gives more consistent throughput, which had been variable depending on how the application set up the mbuf. The message builder code had to be considerably re-factored to do this efficiently. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 5 + drivers/crypto/qat/qat_adf/qat_algs.h| 1 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 2 + drivers/crypto/qat/qat_crypto.c | 239 --- 4 files changed, 176 insertions(+), 71 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/crypto/qat/qat_adf/icp_qat_hw.h index a08094f..ebe245f 100644 --- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h +++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h @@ -237,6 +237,11 @@ enum icp_qat_hw_cipher_dir { ICP_QAT_HW_CIPHER_DECRYPT = 1, }; +enum icp_qat_hw_auth_op { + ICP_QAT_HW_AUTH_VERIFY = 0, + ICP_QAT_HW_AUTH_GENERATE = 1, +}; + enum icp_qat_hw_cipher_convert { ICP_QAT_HW_CIPHER_NO_CONVERT = 0, ICP_QAT_HW_CIPHER_KEY_CONVERT = 1, diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 78a92f3..dcc0df5 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -98,6 +98,7 @@ struct qat_session { enum icp_qat_hw_cipher_dir qat_dir; enum icp_qat_hw_cipher_mode qat_mode; enum icp_qat_hw_auth_algo qat_hash_alg; + enum icp_qat_hw_auth_op auth_op; struct qat_alg_cd cd; uint8_t *cd_cur_ptr; phys_addr_t cd_paddr; diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 0b66b37..8900668 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -625,11 +625,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, ICP_QAT_FW_LA_NO_RET_AUTH_RES); ICP_QAT_FW_LA_CMP_AUTH_SET(header->serv_specif_flags, ICP_QAT_FW_LA_CMP_AUTH_RES); + cdesc->auth_op = ICP_QAT_HW_AUTH_VERIFY; } else { ICP_QAT_FW_LA_RET_AUTH_SET(header->serv_specif_flags, ICP_QAT_FW_LA_RET_AUTH_RES); ICP_QAT_FW_LA_CMP_AUTH_SET(header->serv_specif_flags, ICP_QAT_FW_LA_NO_CMP_AUTH_RES); + cdesc->auth_op = ICP_QAT_HW_AUTH_GENERATE; } /* diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index f8db12f..798cd98 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -951,6 +951,13 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) struct icp_qat_fw_la_cipher_req_params *cipher_param; struct icp_qat_fw_la_auth_req_params *auth_param; register struct icp_qat_fw_la_bulk_req *qat_req; + uint8_t do_auth = 0, do_cipher = 0; + uint32_t cipher_len = 0, cipher_ofs = 0; + uint32_t auth_len = 0, auth_ofs = 0; + uint32_t min_ofs = 0; + uint32_t digest_appended = 1; + uint64_t buf_start = 0; + #ifdef RTE_LIBRTE_PMD_QAT_DEBUG_TX if (unlikely(op->type != RTE_CRYPTO_OP_TYPE_SYMMETRIC)) { @@ -975,88 +982,173 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) qat_req = (struct icp_qat_fw_la_bulk_req *)out_msg; rte_mov128((uint8_t *)qat_req, (const uint8_t *)&(ctx->fw_req)); qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op; + cipher_param = (void *)_req->serv_specif_rqpars; + auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); - qat_req->comn_mid.dst_length = - qat_req->comn_mid.src_length = - rte_pktmbuf_data_len(op->sym->m_src); + if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_HASH_CIPHER || + ctx->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER_HASH) { + do_auth = 1; + do_cipher = 1; + } else if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_AUTH) { + do_auth = 1; + do_cipher = 0; + } else if (ctx->qat_cmd == ICP_QAT_FW_LA_CMD_CIPHER) { + do_auth = 0; + do_cipher = 1; + } - qat_req->comn_mid.dest_data_addr = - qat_req->comn_mid.src_data_addr = - rte_pktmbuf_mtophys(op->sym->m_src); + if (do_cipher) { - if (unlikely(op->sym->m_dst != NULL)) { - qat_req->comn_mid.dest_data_addr = - rte_pktmbuf_mtophys(op->sym->m_dst); - qat_
[dpdk-dev] [PATCH 0/2] crypto/qat: performance optimisation
QAT PMD adjusts the buffer start address and offsets passed to the device so that the DMAs in and out of the device are 64-byte aligned. This gives more consistent throughput, which had been variable depending on how the application set up the mbuf. The message builder code had to be considerably re-factored to do this efficiently. Also performance test not taking IV prepend offsets into account were corrected. Fiona Trahe (2): crypto/qat: rework request builder for performance app/test: use correct offsets in AES perf test app/test/test_cryptodev_perf.c | 15 +- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 5 + drivers/crypto/qat/qat_adf/qat_algs.h| 1 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 2 + drivers/crypto/qat/qat_crypto.c | 242 --- 5 files changed, 185 insertions(+), 80 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH v3 4/4] app/test: remove hard-coding of crypto num qps
ts_params->conf.nb_queue_pairs should not be hard coded with device specific number. It should be retrieved from the device info. Any test which changes it should restore it to orig value. Signed-off-by: Akhil Goyal Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 5 - app/test/test_cryptodev_perf.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index e0b0252..83036a1 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -414,7 +414,6 @@ ut_setup(void) memset(ut_params, 0, sizeof(*ut_params)); /* Reconfigure device to default parameters */ - ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = DEFAULT_NUM_OPS_INFLIGHT; @@ -526,6 +525,7 @@ static int test_device_configure_invalid_queue_pair_ids(void) { struct crypto_testsuite_params *ts_params = _params; + uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs; /* Stop the device in case it's started so it can be configured */ rte_cryptodev_stop(ts_params->valid_devs[0]); @@ -580,6 +580,9 @@ test_device_configure_invalid_queue_pair_ids(void) ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + /* revert to original testsuite value */ + ts_params->conf.nb_queue_pairs = orig_nb_qps; + return TEST_SUCCESS; } diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 27d8cf8..4aee9af 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -431,7 +431,7 @@ testsuite_setup(void) rte_cryptodev_info_get(ts_params->dev_id, ); - ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; + ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; -- 2.5.0
[dpdk-dev] [PATCH v3 3/4] app/test: cleanup unnecessary ring size setup
Removed obsolete comments re inability to free and re-allocate queue memory and obsolete workaround for it which used to create maximum size queues first, then later create smaller queues. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 15 +-- app/test/test_cryptodev_perf.c | 17 + 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index db2f23c..e0b0252 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -362,13 +362,6 @@ testsuite_setup(void) rte_cryptodev_info_get(dev_id, ); - /* -* Since we can't free and re-allocate queue memory always set -* the queues on this device up to max size first so enough -* memory is allocated for any later re-configures needed by -* other tests -*/ - ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; @@ -378,7 +371,7 @@ testsuite_setup(void) "Failed to configure cryptodev %u with %u qps", dev_id, ts_params->conf.nb_queue_pairs); - ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; + ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( @@ -430,12 +423,6 @@ ut_setup(void) "Failed to configure cryptodev %u", ts_params->valid_devs[0]); - /* -* Now reconfigure queues to size we actually want to use in this -* test suite. -*/ - ts_params->qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT; - for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( ts_params->valid_devs[0], qp_id, diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index e8fc097..27d8cf8 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -426,9 +426,7 @@ testsuite_setup(void) /* * Using Crypto Device Id 0 by default. -* Since we can't free and re-allocate queue memory always set the queues -* on this device up to max size first so enough memory is allocated for -* any later re-configures needed by other tests +* Set up all the qps on this device */ rte_cryptodev_info_get(ts_params->dev_id, ); @@ -442,19 +440,6 @@ testsuite_setup(void) "Failed to configure cryptodev %u", ts_params->dev_id); - - ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; - - for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { - TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( - ts_params->dev_id, qp_id, - _params->qp_conf, - rte_cryptodev_socket_id(ts_params->dev_id)), - "Failed to setup queue pair %u on cryptodev %u", - qp_id, ts_params->dev_id); - } - - /*Now reconfigure queues to size we actually want to use in this testsuite.*/ ts_params->qp_conf.nb_descriptors = PERF_NUM_OPS_INFLIGHT; for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs ; qp_id++) { -- 2.5.0
[dpdk-dev] [PATCH v3 2/4] app/test: remove pointless for loop
Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 49 +++ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 8f40dea..db2f23c 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -357,37 +357,35 @@ testsuite_setup(void) return TEST_FAILED; /* Set up all the qps on the first of the valid devices found */ - for (i = 0; i < 1; i++) { - dev_id = ts_params->valid_devs[i]; - rte_cryptodev_info_get(dev_id, ); + dev_id = ts_params->valid_devs[0]; - /* -* Since we can't free and re-allocate queue memory always set -* the queues on this device up to max size first so enough -* memory is allocated for any later re-configures needed by -* other tests -*/ + rte_cryptodev_info_get(dev_id, ); - ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; - ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; + /* +* Since we can't free and re-allocate queue memory always set +* the queues on this device up to max size first so enough +* memory is allocated for any later re-configures needed by +* other tests +*/ - TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, - _params->conf), - "Failed to configure cryptodev %u with %u qps", - dev_id, ts_params->conf.nb_queue_pairs); + ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; + ts_params->conf.socket_id = SOCKET_ID_ANY; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; - ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, + _params->conf), + "Failed to configure cryptodev %u with %u qps", + dev_id, ts_params->conf.nb_queue_pairs); - for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { - TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( - dev_id, qp_id, _params->qp_conf, - rte_cryptodev_socket_id(dev_id)), - "Failed to setup queue pair %u on " - "cryptodev %u", - qp_id, dev_id); - } + ts_params->qp_conf.nb_descriptors = MAX_NUM_OPS_INFLIGHT; + + for (qp_id = 0; qp_id < info.max_nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + dev_id, qp_id, _params->qp_conf, + rte_cryptodev_socket_id(dev_id)), + "Failed to setup queue pair %u on cryptodev %u", + qp_id, dev_id); } return TEST_SUCCESS; -- 2.5.0
[dpdk-dev] [PATCH v3 1/4] crypto/aesni_mb: free ring memory on qp release in PMD
Free ring memory on queue_pair release, else releasing and setting up queue-pair of a different size fails. Signed-off-by: Fiona Trahe --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c index d3c46ac..3d49e2a 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -311,8 +311,14 @@ aesni_mb_pmd_info_get(struct rte_cryptodev *dev, static int aesni_mb_pmd_qp_release(struct rte_cryptodev *dev, uint16_t qp_id) { - if (dev->data->queue_pairs[qp_id] != NULL) { - rte_free(dev->data->queue_pairs[qp_id]); + struct aesni_mb_qp *qp = dev->data->queue_pairs[qp_id]; + struct rte_ring *r = NULL; + + if (qp != NULL) { + r = rte_ring_lookup(qp->name); + if (r) + rte_ring_free(r); + rte_free(qp); dev->data->queue_pairs[qp_id] = NULL; } return 0; -- 2.5.0
[dpdk-dev] [PATCH v3 0/4] remove hard-coding of crypto num qps and cleanup
ts_params->conf.nb_queue_pairs should not be hard coded with device specific number. It should be retrieved from the device info. Any test which changes it should restore it to orig value. Also related cleanup of test code setting number and size of queue-pairs on a device, e.g. * Removed irrelevant ???for??? loop ??? was hardcoded to only loop once. * Removed obsolete comment re inability to free and re-allocate queu memory and obsolete workaround for it which used to create maximum size queues. And added freeing of ring memory on queue-pair release in aesni_mb PMD, else releasing and setting up queue-pair of a different size fails. v3: separate out into 4 patches v2: Fix for broken QAT PMD unit tests exposed by v1 i.e. In test_device_configure_invalid_queue_pair_ids() after running tests for invalid values restore original nb_queue_pairs. Also cleanup of test code setting number and size of queue-pairs on a device Also fix for aesni_mb PMD not freeing ring memory on qp release Fiona Trahe (4): crypto/aesni_mb: free ring memory on qp release in PMD app/test: remove pointless for loop app/test: cleanup unnecessary ring size setup app/test: remove hard-coding of crypto num qps Akhil Goyal (1): app/test: remove hard-coding of crypto num qps app/test/test_cryptodev.c | 53 ++ app/test/test_cryptodev_perf.c | 19 + drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 10 - 3 files changed, 31 insertions(+), 51 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH] app/test: improve error message in crypto test code
Resending patch as first send got to mailing list but didn't get to pachwork Improve error message if crypto PMD build is not enabled in config file Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 37 + app/test/test_cryptodev_perf.c | 23 +++ 2 files changed, 60 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index f17c84c..c30a421 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -189,6 +189,11 @@ testsuite_setup(void) /* Create 2 AESNI MB devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_MB + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_AESNI_MB_PMD); if (nb_devs < 2) { @@ -206,6 +211,11 @@ 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) { @@ -223,6 +233,11 @@ testsuite_setup(void) /* Create 2 AESNI GCM devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_GCM + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_AESNI_GCM_PMD); if (nb_devs < 2) { @@ -238,6 +253,11 @@ testsuite_setup(void) /* Create 2 Snow3G devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) { +#ifndef RTE_LIBRTE_PMD_SNOW3G + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { @@ -252,6 +272,11 @@ testsuite_setup(void) /* Create 2 KASUMI devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_KASUMI_PMD) { +#ifndef RTE_LIBRTE_PMD_KASUMI + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_KASUMI must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { @@ -266,6 +291,11 @@ testsuite_setup(void) /* Create 2 NULL devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) { +#ifndef RTE_LIBRTE_PMD_NULL_CRYPTO + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_NULL_PMD); if (nb_devs < 2) { @@ -281,6 +311,13 @@ testsuite_setup(void) } } +#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 " + "in config file to run this testsuite.\n"); + return TEST_FAILED; + } +#endif nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 0a0085d..c80c335 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -261,6 +261,11 @@ testsuite_setup(void) /* Create 2 AESNI MB devices if required */ if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_MB + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" + " enabled in config file to run this testsuite.\n"); + return TES
[dpdk-dev] [PATCH v3 2/2] crypto/qat: adding support for 3DES cipher algorithm
3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx This patch depends on following patch : crypto/qat: enable support of Kasumi F8 in QAT cryptodev http://dpdk.org/dev/patchwork/patch/15813/ Signed-off-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/qat_algs.h| 5 ++ drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 25 +- drivers/crypto/qat/qat_crypto.c | 59 +++- 5 files changed, 89 insertions(+), 5 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 3528499..16e5937 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -42,6 +42,8 @@ The QAT PMD has support for: Cipher algorithms: +* ``RTE_CRYPTO_CIPHER_3DES_CBC`` +* ``RTE_CRYPTO_CIPHER_3DES_CTR`` * ``RTE_CRYPTO_CIPHER_AES128_CBC`` * ``RTE_CRYPTO_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_CIPHER_AES256_CBC`` @@ -72,7 +74,7 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2 and Kasumi F9. -* Cipher only is not supported except Snow3G UEA2 and Kasumi F8. +* Cipher only is not supported except Snow3G UEA2, Kasumi F8 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) and Kasumi(F8) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 1dd0e6a..4eedc0e 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -51,6 +51,7 @@ New Features * Added support for SHA384-HMAC algorithm. * Added support for NULL algorithm. * Added support for KASUMI (F8 and F9) algorithm. + * Added support for 3DES block cipher algorithm. Resolved Issues --- diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 429f44f..530b9cc 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -59,6 +59,10 @@ #define KASUMI_F8_KEY_MODIFIER_4_BYTES 0x +/* 3DES key sizes */ +#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */ +#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */ + #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \ ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \ ICP_QAT_HW_CIPHER_NO_CONVERT, \ @@ -138,4 +142,5 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd, int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg); +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 8ca422f..b46702f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -512,6 +512,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3; cipher_cd_ctrl->cipher_padding_sz = (2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3; + } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) { + total_key_size = ICP_QAT_HW_3DES_KEY_SZ; + cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3; + proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); } else { total_key_size = cipherkeylen; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3; @@ -553,8 +557,12 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, if (total_key_size > cipherkeylen) { uint32_t padding_size = total_key_size-cipherkeylen; - - memset(cdesc->cd_cur_ptr, 0, padding_size); + if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) + && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) + /* K3 not provided so use K1 = K3*/ + memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size); + else + memset(cdesc->cd_cur_ptr, 0, padding_size); cdesc->cd_cur_ptr += padding_size; } cd_size = cdesc->cd_cur_ptr-(uint8_t *)>cd; @@ -845,3 +853,16 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
[dpdk-dev] [PATCH v3 1/2] crypto/qat: code cleanup
Cleanup of unused code. Rename and simplify a badly named struct element, was aes, but used for all types of ciphers Print correct error msg (Unsupported rather than Undefined) for all ciphers not supported by qat PMD. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++-- drivers/crypto/qat/qat_adf/qat_algs.h| 1 - drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 63 +++- drivers/crypto/qat/qat_crypto.c | 6 ++- 4 files changed, 16 insertions(+), 64 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/crypto/qat/qat_adf/icp_qat_hw.h index 4d4d8e4..a08094f 100644 --- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h +++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h @@ -293,14 +293,12 @@ enum icp_qat_hw_cipher_convert { #define ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ 16 #define ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ 16 #define ICP_QAT_HW_MODE_F8_NUM_REG_TO_CLEAR 2 -#define INIT_SHRAM_CONSTANTS_TABLE_SZ 1024 -struct icp_qat_hw_cipher_aes256_f8 { - struct icp_qat_hw_cipher_config cipher_config; - uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ]; -}; +#define ICP_QAT_HW_CIPHER_MAX_KEY_SZ ICP_QAT_HW_AES_256_F8_KEY_SZ struct icp_qat_hw_cipher_algo_blk { - struct icp_qat_hw_cipher_aes256_f8 aes; + struct icp_qat_hw_cipher_config cipher_config; + uint8_t key[ICP_QAT_HW_CIPHER_MAX_KEY_SZ]; } __rte_cache_aligned; + #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index fad8471..429f44f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -100,7 +100,6 @@ struct qat_session { struct icp_qat_fw_la_bulk_req fw_req; uint8_t aad_len; struct qat_crypto_instance *inst; - uint8_t salt[ICP_QAT_HW_AES_BLK_SZ]; rte_spinlock_t lock;/* protects this struct */ }; diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 198b551..8ca422f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -525,7 +525,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, qat_alg_init_common_hdr(header, proto); cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr; - cipher->aes.cipher_config.val = + + cipher->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode, cdesc->qat_cipher_alg, key_convert, cdesc->qat_dir); @@ -534,7 +535,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, temp_key = (uint32_t *)(cdesc->cd_cur_ptr + sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen); - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); memcpy(temp_key, cipherkey, cipherkeylen); /* XOR Key with KASUMI F8 key modifier at 4 bytes level */ @@ -545,7 +546,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen + cipherkeylen; } else { - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen; } @@ -727,13 +728,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, cipherconfig = (struct icp_qat_hw_cipher_algo_blk *) (cdesc->cd_cur_ptr + state1_size + state2_size); - cipherconfig->aes.cipher_config.val = + cipherconfig->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_ECB_MODE, ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2, ICP_QAT_HW_CIPHER_KEY_CONVERT, ICP_QAT_HW_CIPHER_ENCRYPT); - memcpy(cipherconfig->aes.key, authkey, authkeylen); - memset(cipherconfig->aes.key + authkeylen, + memcpy(cipherconfig->key, authkey, authkeylen); + memset(cipherconfig->key + authkeylen, 0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ; @@ -803,56 +804,6 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc,
[dpdk-dev] [PATCH v3 0/2] Add 3DES support to Quickassist PMD
resend of v3 patchset as first send didn't get to patchwork, just to mailing list. Some preparatory cleanup done in QAT PMD for adding 3DES 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx 3DES test code is included in the libcrypto patch, which will be sent separately. Changes since v1: * rebased qat.rst against Kasumi patch changes http://dpdk.org/dev/patchwork/patch/15320/ http://dpdk.org/dev/patchwork/patch/15322/ Changes since v2: * added 3DES to QAT PMD capabilities * added 3DES to 16.11 release notes. Fiona Trahe (2): crypto/qat: code cleanup crypto/qat: adding support for 3DES cipher algorithm doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++- drivers/crypto/qat/qat_adf/qat_algs.h| 6 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 88 drivers/crypto/qat/qat_crypto.c | 65 - 6 files changed, 105 insertions(+), 69 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH] app/test: improve error message in crypto test code
From: Fiona Trahe <fiona.tr...@intel.com> Improve error message if crypto PMD build is not enabled in config file Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 37 + app/test/test_cryptodev_perf.c | 23 +++ 2 files changed, 60 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index f17c84c..c30a421 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -189,6 +189,11 @@ testsuite_setup(void) /* Create 2 AESNI MB devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_MB_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_MB + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_AESNI_MB_PMD); if (nb_devs < 2) { @@ -206,6 +211,11 @@ 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) { @@ -223,6 +233,11 @@ testsuite_setup(void) /* Create 2 AESNI GCM devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_AESNI_GCM_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_GCM + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_GCM must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_AESNI_GCM_PMD); if (nb_devs < 2) { @@ -238,6 +253,11 @@ testsuite_setup(void) /* Create 2 Snow3G devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_SNOW3G_PMD) { +#ifndef RTE_LIBRTE_PMD_SNOW3G + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_SNOW3G must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_SNOW3G_PMD); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { @@ -252,6 +272,11 @@ testsuite_setup(void) /* Create 2 KASUMI devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_KASUMI_PMD) { +#ifndef RTE_LIBRTE_PMD_KASUMI + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_KASUMI must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype(RTE_CRYPTODEV_KASUMI_PMD); if (nb_devs < 2) { for (i = nb_devs; i < 2; i++) { @@ -266,6 +291,11 @@ testsuite_setup(void) /* Create 2 NULL devices if required */ if (gbl_cryptodev_type == RTE_CRYPTODEV_NULL_PMD) { +#ifndef RTE_LIBRTE_PMD_NULL_CRYPTO + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif nb_devs = rte_cryptodev_count_devtype( RTE_CRYPTODEV_NULL_PMD); if (nb_devs < 2) { @@ -281,6 +311,13 @@ testsuite_setup(void) } } +#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 " + "in config file to run this testsuite.\n"); + return TEST_FAILED; + } +#endif nb_devs = rte_cryptodev_count(); if (nb_devs < 1) { diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 0a0085d..c80c335 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -261,6 +261,11 @@ testsuite_setup(void) /* Create 2 AESNI MB devices if required */ if (gbl_cryptodev_perftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) { +#ifndef RTE_LIBRTE_PMD_AESNI_MB + RTE_LOG(ERR, USER1, "CONFIG_RTE_LIBRTE_PMD_AESNI_MB must be" + " enabled in config file to run this testsuite.\n"); + return TEST_FAILED; +#endif
[dpdk-dev] [PATCH v3 2/2] crypto/qat: adding support for 3DES cipher algorithm
From: Fiona Trahe <fiona.tr...@intel.com> 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx This patch depends on following patch : crypto/qat: enable support of Kasumi F8 in QAT cryptodev http://dpdk.org/dev/patchwork/patch/15813/ Signed-off-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/qat_algs.h| 5 ++ drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 25 +- drivers/crypto/qat/qat_crypto.c | 59 +++- 5 files changed, 89 insertions(+), 5 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 3528499..16e5937 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -42,6 +42,8 @@ The QAT PMD has support for: Cipher algorithms: +* ``RTE_CRYPTO_CIPHER_3DES_CBC`` +* ``RTE_CRYPTO_CIPHER_3DES_CTR`` * ``RTE_CRYPTO_CIPHER_AES128_CBC`` * ``RTE_CRYPTO_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_CIPHER_AES256_CBC`` @@ -72,7 +74,7 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2 and Kasumi F9. -* Cipher only is not supported except Snow3G UEA2 and Kasumi F8. +* Cipher only is not supported except Snow3G UEA2, Kasumi F8 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) and Kasumi(F8) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/doc/guides/rel_notes/release_16_11.rst b/doc/guides/rel_notes/release_16_11.rst index 1dd0e6a..4eedc0e 100644 --- a/doc/guides/rel_notes/release_16_11.rst +++ b/doc/guides/rel_notes/release_16_11.rst @@ -51,6 +51,7 @@ New Features * Added support for SHA384-HMAC algorithm. * Added support for NULL algorithm. * Added support for KASUMI (F8 and F9) algorithm. + * Added support for 3DES block cipher algorithm. Resolved Issues --- diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 429f44f..530b9cc 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -59,6 +59,10 @@ #define KASUMI_F8_KEY_MODIFIER_4_BYTES 0x +/* 3DES key sizes */ +#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */ +#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */ + #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \ ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \ ICP_QAT_HW_CIPHER_NO_CONVERT, \ @@ -138,4 +142,5 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd, int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg); +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 8ca422f..b46702f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -512,6 +512,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3; cipher_cd_ctrl->cipher_padding_sz = (2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3; + } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) { + total_key_size = ICP_QAT_HW_3DES_KEY_SZ; + cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3; + proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); } else { total_key_size = cipherkeylen; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3; @@ -553,8 +557,12 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, if (total_key_size > cipherkeylen) { uint32_t padding_size = total_key_size-cipherkeylen; - - memset(cdesc->cd_cur_ptr, 0, padding_size); + if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) + && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) + /* K3 not provided so use K1 = K3*/ + memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size); + else + memset(cdesc->cd_cur_ptr, 0, padding_size); cdesc->cd_cur_ptr += padding_size; } cd_size = cdesc->cd_cur_ptr-(uint8_t *)>cd; @@ -845,3 +853,16 @@ int qat_alg_validate_kasumi_key(int k
[dpdk-dev] [PATCH v3 1/2] crypto/qat: code cleanup
From: Fiona Trahe <fiona.tr...@intel.com> Cleanup of unused code. Rename and simplify a badly named struct element, was aes, but used for all types of ciphers Print correct error msg (Unsupported rather than Undefined) for all ciphers not supported by qat PMD. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++-- drivers/crypto/qat/qat_adf/qat_algs.h| 1 - drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 63 +++- drivers/crypto/qat/qat_crypto.c | 6 ++- 4 files changed, 16 insertions(+), 64 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/crypto/qat/qat_adf/icp_qat_hw.h index 4d4d8e4..a08094f 100644 --- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h +++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h @@ -293,14 +293,12 @@ enum icp_qat_hw_cipher_convert { #define ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ 16 #define ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ 16 #define ICP_QAT_HW_MODE_F8_NUM_REG_TO_CLEAR 2 -#define INIT_SHRAM_CONSTANTS_TABLE_SZ 1024 -struct icp_qat_hw_cipher_aes256_f8 { - struct icp_qat_hw_cipher_config cipher_config; - uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ]; -}; +#define ICP_QAT_HW_CIPHER_MAX_KEY_SZ ICP_QAT_HW_AES_256_F8_KEY_SZ struct icp_qat_hw_cipher_algo_blk { - struct icp_qat_hw_cipher_aes256_f8 aes; + struct icp_qat_hw_cipher_config cipher_config; + uint8_t key[ICP_QAT_HW_CIPHER_MAX_KEY_SZ]; } __rte_cache_aligned; + #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index fad8471..429f44f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -100,7 +100,6 @@ struct qat_session { struct icp_qat_fw_la_bulk_req fw_req; uint8_t aad_len; struct qat_crypto_instance *inst; - uint8_t salt[ICP_QAT_HW_AES_BLK_SZ]; rte_spinlock_t lock;/* protects this struct */ }; diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 198b551..8ca422f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -525,7 +525,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, qat_alg_init_common_hdr(header, proto); cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr; - cipher->aes.cipher_config.val = + + cipher->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode, cdesc->qat_cipher_alg, key_convert, cdesc->qat_dir); @@ -534,7 +535,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, temp_key = (uint32_t *)(cdesc->cd_cur_ptr + sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen); - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); memcpy(temp_key, cipherkey, cipherkeylen); /* XOR Key with KASUMI F8 key modifier at 4 bytes level */ @@ -545,7 +546,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen + cipherkeylen; } else { - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen; } @@ -727,13 +728,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, cipherconfig = (struct icp_qat_hw_cipher_algo_blk *) (cdesc->cd_cur_ptr + state1_size + state2_size); - cipherconfig->aes.cipher_config.val = + cipherconfig->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_ECB_MODE, ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2, ICP_QAT_HW_CIPHER_KEY_CONVERT, ICP_QAT_HW_CIPHER_ENCRYPT); - memcpy(cipherconfig->aes.key, authkey, authkeylen); - memset(cipherconfig->aes.key + authkeylen, + memcpy(cipherconfig->key, authkey, authkeylen); + memset(cipherconfig->key + authkeylen, 0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ; @@ -803,56 +804,6 @@ int qat_alg_aead_session_
[dpdk-dev] [PATCH v3 0/2] Add 3DES support to Quickassist PMD
From: Fiona Trahe <fiona.tr...@intel.com> Some preparatory cleanup done in QAT PMD for adding 3DES 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx 3DES test code is included in the libcrypto patch, which will be sent separately. Changes since v1: * rebased qat.rst against Kasumi patch changes http://dpdk.org/dev/patchwork/patch/15320/ http://dpdk.org/dev/patchwork/patch/15322/ Changes since v2: * added 3DES to QAT PMD capabilities * added 3DES to 16.11 release notes. Fiona Trahe (2): crypto/qat: code cleanup crypto/qat: adding support for 3DES cipher algorithm doc/guides/cryptodevs/qat.rst| 4 +- doc/guides/rel_notes/release_16_11.rst | 1 + drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++- drivers/crypto/qat/qat_adf/qat_algs.h| 6 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 88 drivers/crypto/qat/qat_crypto.c | 65 - 6 files changed, 105 insertions(+), 69 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH] app/test: add 3DES tests into QuickAssist PMD testsuite
From: Fiona Trahe <fiona.tr...@intel.com> This patch depends on * 3DES QuickAssist driver patch: http://dpdk.org/dev/patchwork/patch/15413/ * libcrypto test patch: http://dpdk.org/dev/patchwork/patch/15344/ Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 68 +++ 1 file changed, 68 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index b7559b7..2c1d93a 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -3901,6 +3901,73 @@ authenticated_decryption_3DES192CTR_HMAC_SHA1(void) _des192ctr_hmac_sha1_test_vector); } +static int +test_3DES_qat_all(void) +{ + int status; + int i = 0; + + status = encryption_3DES128CBC(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES128CBC PASS\n", ++i); + status = decryption_3DES128CBC(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES128CBC PASS\n", ++i); + status = encryption_3DES192CBC(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES192CBC PASS\n", ++i); + status = decryption_3DES192CBC(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES192CBC PASS\n", ++i); + status = encryption_3DES128CTR(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES128CTR PASS\n", ++i); + status = decryption_3DES128CTR(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES128CTR PASS\n", ++i); + status = encryption_3DES192CTR(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES192CTR PASS\n", ++i); + status = decryption_3DES192CTR(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES192CTR PASS\n", ++i); + status = authenticated_encryption_3DES128CBC_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES128CBC_HMAC_SHA1 PASS\n", ++i); + status = authenticated_decryption_3DES128CBC_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES128CBC_HMAC_SHA1 PASS\n", ++i); + status = authenticated_encryption_3DES192CBC_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES192CBC_HMAC_SHA1 PASS\n", ++i); + status = authenticated_decryption_3DES192CBC_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES192CBC_HMAC_SHA1 PASS\n", ++i); + status = authenticated_encryption_3DES128CTR_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES128CTR_HMAC_SHA1 PASS\n", ++i); + status = authenticated_decryption_3DES128CTR_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES128CTR_HMAC_SHA1 PASS\n", ++i); + status = authenticated_encryption_3DES192CTR_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES192CTR_HMAC_SHA1 PASS\n", ++i); + status = authenticated_decryption_3DES192CTR_HMAC_SHA1(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES192CTR_HMAC_SHA1 PASS\n", ++i); + status = authenticated_encryption_3DES128CBC_HMAC_SHA1_out_of_place(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase encryption_3DES128CBC_HMAC_SHA1_oop PASS\n", + ++i); + status = authenticated_decryption_3DES128CBC_HMAC_SHA1_out_of_place(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + printf(" %2d) TestCase decryption_3DES128CBC_HMAC_SHA1_oop PASS\n", +++i); + + return TEST_SUCCESS; +} + + /* * AES-GCM Tests * */ static int @@ -4902,6 +4969,7 @@ static struct unit_test_suite cryptodev_qat_testsuite = { test_multi_session), TEST_CASE_ST(ut_setup, ut_teardown, test_AES_qat_all), + TEST_CASE_ST(ut_setup, ut_teardown, test_3DES_qat_all), TEST_CASE_ST(ut_setup, ut_teardown, test_stats), /** AES GCM Authenticated Encryption */ -- 2.5.0
[dpdk-dev] [PATCH v2 2/2] crypto/qat: adding support for 3DES cipher algorithm
From: Fiona Trahe <fiona.tr...@intel.com> 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx This patch depends on following patch : crypto/qat: enable support of Kasumi F8 in QAT cryptodev http://dpdk.org/dev/patchwork/patch/15320/ Signed-off-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 4 +++- drivers/crypto/qat/qat_adf/qat_algs.h| 5 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 25 ++-- drivers/crypto/qat/qat_crypto.c | 17 +++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 56f0fc4..f6d2d65 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -42,6 +42,8 @@ The QAT PMD has support for: Cipher algorithms: +* ``RTE_CRYPTO_CIPHER_3DES_CBC`` +* ``RTE_CRYPTO_CIPHER_3DES_CTR`` * ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC`` @@ -72,7 +74,7 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2 and KASUMI F9. -* Cipher only is not supported except Snow3G UEA2 and KASUMI F8. +* Cipher only is not supported except Snow3G UEA2, KASUMI F8 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) and KAUSMI(F8) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 429f44f..530b9cc 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -59,6 +59,10 @@ #define KASUMI_F8_KEY_MODIFIER_4_BYTES 0x +/* 3DES key sizes */ +#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */ +#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */ + #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \ ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \ ICP_QAT_HW_CIPHER_NO_CONVERT, \ @@ -138,4 +142,5 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd, int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg); +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index e131f8b..a0161cf 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -513,6 +513,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3; cipher_cd_ctrl->cipher_padding_sz = (2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3; + } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) { + total_key_size = ICP_QAT_HW_3DES_KEY_SZ; + cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3; + proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); } else { total_key_size = cipherkeylen; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3; @@ -554,8 +558,12 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, if (total_key_size > cipherkeylen) { uint32_t padding_size = total_key_size-cipherkeylen; - - memset(cdesc->cd_cur_ptr, 0, padding_size); + if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) + && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) + /* K3 not provided so use K1 = K3*/ + memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size); + else + memset(cdesc->cd_cur_ptr, 0, padding_size); cdesc->cd_cur_ptr += padding_size; } cd_size = cdesc->cd_cur_ptr-(uint8_t *)>cd; @@ -846,3 +854,16 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg) } return 0; } + +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg) +{ + switch (key_len) { + case QAT_3DES_KEY_SZ_OPT1: + case QAT_3DES_KEY_SZ_OPT2: + *alg = ICP_QAT_HW_CIPHER_ALGO_3DES; + break; + default: + return -EINVAL; + } + return 0; +} diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 620e82
[dpdk-dev] [PATCH v2 1/2] crypto/qat: code cleanup
From: Fiona Trahe <fiona.tr...@intel.com> Cleanup of unused code. Rename and simplify a badly named struct element, was aes, but used for all types of ciphers Print correct error msg (Unsupported rather than Undefined) for all ciphers not supported by qat PMD. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++-- drivers/crypto/qat/qat_adf/qat_algs.h| 1 - drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 63 +++- drivers/crypto/qat/qat_crypto.c | 6 ++- 4 files changed, 16 insertions(+), 64 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/crypto/qat/qat_adf/icp_qat_hw.h index 4d4d8e4..a08094f 100644 --- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h +++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h @@ -293,14 +293,12 @@ enum icp_qat_hw_cipher_convert { #define ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ 16 #define ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ 16 #define ICP_QAT_HW_MODE_F8_NUM_REG_TO_CLEAR 2 -#define INIT_SHRAM_CONSTANTS_TABLE_SZ 1024 -struct icp_qat_hw_cipher_aes256_f8 { - struct icp_qat_hw_cipher_config cipher_config; - uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ]; -}; +#define ICP_QAT_HW_CIPHER_MAX_KEY_SZ ICP_QAT_HW_AES_256_F8_KEY_SZ struct icp_qat_hw_cipher_algo_blk { - struct icp_qat_hw_cipher_aes256_f8 aes; + struct icp_qat_hw_cipher_config cipher_config; + uint8_t key[ICP_QAT_HW_CIPHER_MAX_KEY_SZ]; } __rte_cache_aligned; + #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index fad8471..429f44f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -100,7 +100,6 @@ struct qat_session { struct icp_qat_fw_la_bulk_req fw_req; uint8_t aad_len; struct qat_crypto_instance *inst; - uint8_t salt[ICP_QAT_HW_AES_BLK_SZ]; rte_spinlock_t lock;/* protects this struct */ }; diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 9d1df56..e131f8b 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -526,7 +526,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, qat_alg_init_common_hdr(header, proto); cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr; - cipher->aes.cipher_config.val = + + cipher->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode, cdesc->qat_cipher_alg, key_convert, cdesc->qat_dir); @@ -535,7 +536,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, temp_key = (uint32_t *)(cdesc->cd_cur_ptr + sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen); - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); memcpy(temp_key, cipherkey, cipherkeylen); /* XOR Key with KASUMI F8 key modifier at 4 bytes level */ @@ -546,7 +547,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen + cipherkeylen; } else { - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen; } @@ -728,13 +729,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, cipherconfig = (struct icp_qat_hw_cipher_algo_blk *) (cdesc->cd_cur_ptr + state1_size + state2_size); - cipherconfig->aes.cipher_config.val = + cipherconfig->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_ECB_MODE, ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2, ICP_QAT_HW_CIPHER_KEY_CONVERT, ICP_QAT_HW_CIPHER_ENCRYPT); - memcpy(cipherconfig->aes.key, authkey, authkeylen); - memset(cipherconfig->aes.key + authkeylen, + memcpy(cipherconfig->key, authkey, authkeylen); + memset(cipherconfig->key + authkeylen, 0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ; @@ -804,56 +805,6 @@ int qat_alg_aead_session_
[dpdk-dev] [PATCH v2 0/2] Add 3DES support to Quickassist PMD
From: Fiona Trahe <fiona.tr...@intel.com> Some preparatory cleanup done in QAT PMD for adding 3DES 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx 3DES test code is dependent on the libcrypto patch, so will be sent separately after that patch Changes since v1: * rebased qat.rst against Kasumi patch changes http://dpdk.org/dev/patchwork/patch/15320/ http://dpdk.org/dev/patchwork/patch/15322/ Fiona Trahe (2): crypto/qat: code cleanup crypto/qat: adding support for 3DES cipher algorithm doc/guides/cryptodevs/qat.rst| 4 +- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++- drivers/crypto/qat/qat_adf/qat_algs.h| 6 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 88 drivers/crypto/qat/qat_crypto.c | 23 ++- 5 files changed, 63 insertions(+), 68 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH 2/2] crypto/qat: adding support for 3DES cipher algorithm
From: Fiona Trahe <fiona.tr...@intel.com> 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx This patch depends on following patch : crypto/qat: enable support of Kasumi F8 in QAT cryptodev http://dpdk.org/dev/patchwork/patch/15277/ Signed-off-by: Fiona Trahe --- doc/guides/cryptodevs/qat.rst| 4 +++- drivers/crypto/qat/qat_adf/qat_algs.h| 5 + drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 25 ++-- drivers/crypto/qat/qat_crypto.c | 17 +++- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index 7a78a1c..639a2e6 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -42,6 +42,8 @@ The QAT PMD has support for: Cipher algorithms: +* ``RTE_CRYPTO_CIPHER_3DES_CBC`` +* ``RTE_CRYPTO_CIPHER_3DES_CTR`` * ``RTE_CRYPTO_SYM_CIPHER_AES128_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_AES192_CBC`` * ``RTE_CRYPTO_SYM_CIPHER_AES256_CBC`` @@ -69,7 +71,7 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2. -* Cipher only is not supported except Snow3G UEA2. +* Cipher only is not supported except Snow3G UEA2 and 3DES. * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index 429f44f..530b9cc 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -59,6 +59,10 @@ #define KASUMI_F8_KEY_MODIFIER_4_BYTES 0x +/* 3DES key sizes */ +#define QAT_3DES_KEY_SZ_OPT1 24 /* Keys are independent */ +#define QAT_3DES_KEY_SZ_OPT2 16 /* K3=K1 */ + #define QAT_AES_HW_CONFIG_CBC_ENC(alg) \ ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_CBC_MODE, alg, \ ICP_QAT_HW_CIPHER_NO_CONVERT, \ @@ -138,4 +142,5 @@ void qat_alg_ablkcipher_init_dec(struct qat_alg_ablkcipher_cd *cd, int qat_alg_validate_aes_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_snow3g_key(int key_len, enum icp_qat_hw_cipher_algo *alg); int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg); +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg); #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index e131f8b..a0161cf 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -513,6 +513,10 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_KASUMI_BLK_SZ >> 3; cipher_cd_ctrl->cipher_padding_sz = (2 * ICP_QAT_HW_KASUMI_BLK_SZ) >> 3; + } else if (cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) { + total_key_size = ICP_QAT_HW_3DES_KEY_SZ; + cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_3DES_BLK_SZ >> 3; + proto = ICP_QAT_FW_LA_PROTO_GET(header->serv_specif_flags); } else { total_key_size = cipherkeylen; cipher_cd_ctrl->cipher_state_sz = ICP_QAT_HW_AES_BLK_SZ >> 3; @@ -554,8 +558,12 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, if (total_key_size > cipherkeylen) { uint32_t padding_size = total_key_size-cipherkeylen; - - memset(cdesc->cd_cur_ptr, 0, padding_size); + if ((cdesc->qat_cipher_alg == ICP_QAT_HW_CIPHER_ALGO_3DES) + && (cipherkeylen == QAT_3DES_KEY_SZ_OPT2)) + /* K3 not provided so use K1 = K3*/ + memcpy(cdesc->cd_cur_ptr, cipherkey, padding_size); + else + memset(cdesc->cd_cur_ptr, 0, padding_size); cdesc->cd_cur_ptr += padding_size; } cd_size = cdesc->cd_cur_ptr-(uint8_t *)>cd; @@ -846,3 +854,16 @@ int qat_alg_validate_kasumi_key(int key_len, enum icp_qat_hw_cipher_algo *alg) } return 0; } + +int qat_alg_validate_3des_key(int key_len, enum icp_qat_hw_cipher_algo *alg) +{ + switch (key_len) { + case QAT_3DES_KEY_SZ_OPT1: + case QAT_3DES_KEY_SZ_OPT2: + *alg = ICP_QAT_HW_CIPHER_ALGO_3DES; + break; + default: + return -EINVAL; + } + return 0; +} diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 67d0445..72979ca 100644 --- a/drivers
[dpdk-dev] [PATCH 1/2] crypto/qat: code cleanup
From: Fiona Trahe <fiona.tr...@intel.com> Cleanup of unused code. Rename and simplify a badly named struct element, was aes, but used for all types of ciphers Print correct error msg (Unsupported rather than Undefined) for all ciphers not supported by qat PMD. Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++-- drivers/crypto/qat/qat_adf/qat_algs.h| 1 - drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 63 +++- drivers/crypto/qat/qat_crypto.c | 6 ++- 4 files changed, 16 insertions(+), 64 deletions(-) diff --git a/drivers/crypto/qat/qat_adf/icp_qat_hw.h b/drivers/crypto/qat/qat_adf/icp_qat_hw.h index 4d4d8e4..a08094f 100644 --- a/drivers/crypto/qat/qat_adf/icp_qat_hw.h +++ b/drivers/crypto/qat/qat_adf/icp_qat_hw.h @@ -293,14 +293,12 @@ enum icp_qat_hw_cipher_convert { #define ICP_QAT_HW_ZUC_3G_EEA3_KEY_SZ 16 #define ICP_QAT_HW_ZUC_3G_EEA3_IV_SZ 16 #define ICP_QAT_HW_MODE_F8_NUM_REG_TO_CLEAR 2 -#define INIT_SHRAM_CONSTANTS_TABLE_SZ 1024 -struct icp_qat_hw_cipher_aes256_f8 { - struct icp_qat_hw_cipher_config cipher_config; - uint8_t key[ICP_QAT_HW_AES_256_F8_KEY_SZ]; -}; +#define ICP_QAT_HW_CIPHER_MAX_KEY_SZ ICP_QAT_HW_AES_256_F8_KEY_SZ struct icp_qat_hw_cipher_algo_blk { - struct icp_qat_hw_cipher_aes256_f8 aes; + struct icp_qat_hw_cipher_config cipher_config; + uint8_t key[ICP_QAT_HW_CIPHER_MAX_KEY_SZ]; } __rte_cache_aligned; + #endif diff --git a/drivers/crypto/qat/qat_adf/qat_algs.h b/drivers/crypto/qat/qat_adf/qat_algs.h index fad8471..429f44f 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs.h +++ b/drivers/crypto/qat/qat_adf/qat_algs.h @@ -100,7 +100,6 @@ struct qat_session { struct icp_qat_fw_la_bulk_req fw_req; uint8_t aad_len; struct qat_crypto_instance *inst; - uint8_t salt[ICP_QAT_HW_AES_BLK_SZ]; rte_spinlock_t lock;/* protects this struct */ }; diff --git a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c index 9d1df56..e131f8b 100644 --- a/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c +++ b/drivers/crypto/qat/qat_adf/qat_algs_build_desc.c @@ -526,7 +526,8 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, qat_alg_init_common_hdr(header, proto); cipher = (struct icp_qat_hw_cipher_algo_blk *)cdesc->cd_cur_ptr; - cipher->aes.cipher_config.val = + + cipher->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(cdesc->qat_mode, cdesc->qat_cipher_alg, key_convert, cdesc->qat_dir); @@ -535,7 +536,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, temp_key = (uint32_t *)(cdesc->cd_cur_ptr + sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen); - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); memcpy(temp_key, cipherkey, cipherkeylen); /* XOR Key with KASUMI F8 key modifier at 4 bytes level */ @@ -546,7 +547,7 @@ int qat_alg_aead_session_create_content_desc_cipher(struct qat_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen + cipherkeylen; } else { - memcpy(cipher->aes.key, cipherkey, cipherkeylen); + memcpy(cipher->key, cipherkey, cipherkeylen); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + cipherkeylen; } @@ -728,13 +729,13 @@ int qat_alg_aead_session_create_content_desc_auth(struct qat_session *cdesc, cipherconfig = (struct icp_qat_hw_cipher_algo_blk *) (cdesc->cd_cur_ptr + state1_size + state2_size); - cipherconfig->aes.cipher_config.val = + cipherconfig->cipher_config.val = ICP_QAT_HW_CIPHER_CONFIG_BUILD(ICP_QAT_HW_CIPHER_ECB_MODE, ICP_QAT_HW_CIPHER_ALGO_SNOW_3G_UEA2, ICP_QAT_HW_CIPHER_KEY_CONVERT, ICP_QAT_HW_CIPHER_ENCRYPT); - memcpy(cipherconfig->aes.key, authkey, authkeylen); - memset(cipherconfig->aes.key + authkeylen, + memcpy(cipherconfig->key, authkey, authkeylen); + memset(cipherconfig->key + authkeylen, 0, ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ); cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_cipher_config) + authkeylen + ICP_QAT_HW_SNOW_3G_UEA2_IV_SZ; @@ -804,56 +805,6 @@ int qat_alg_aead_session_
[dpdk-dev] [PATCH 0/2] Add 3DES support to Quickassist PMD
From: Fiona Trahe <fiona.tr...@intel.com> Some preparatory cleanup done in QAT PMD for adding 3DES 3DES support added to QuickAssist PMD With CTR and CBC mode. Both cipher-only and chained with HMAC_SHAx 3DES test code is dependent on the libcrypto patch, so will be sent separately after that patch Fiona Trahe (2): crypto/qat: code cleanup crypto/qat: adding support for 3DES cipher algorithm doc/guides/cryptodevs/qat.rst| 4 +- drivers/crypto/qat/qat_adf/icp_qat_hw.h | 10 ++- drivers/crypto/qat/qat_adf/qat_algs.h| 6 +- drivers/crypto/qat/qat_adf/qat_algs_build_desc.c | 88 drivers/crypto/qat/qat_crypto.c | 23 ++- 5 files changed, 63 insertions(+), 68 deletions(-) -- 2.5.0
[dpdk-dev] [PATCH] crypto/qat: optimisation of request copy
From: Fiona Trahe <fiona.tr...@intel.com> using rte_mov128 instead of structure assignment to copy template request from session context into request Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index e2a501b..ff0c691 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -832,7 +832,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) ctx = (struct qat_session *)op->sym->session->_private; qat_req = (struct icp_qat_fw_la_bulk_req *)out_msg; - *qat_req = ctx->fw_req; + rte_mov128((uint8_t *)qat_req, (const uint8_t *)&(ctx->fw_req)); qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op; qat_req->comn_mid.dst_length = -- 2.1.0
[dpdk-dev] [PATCH v2] cryptodev: Remove EXPERIMENTAL label
The cryptodev API was introduced in the DPDK 2.2 release. Since then it has - been reviewed and iterated for the DPDK 16.04 release - had extensive use by the l2fwd-crypto app, the ipsec-secgw example app, the test app. We believe it is now stable and the EXPERIMENTAL label should be removed. v2: - remove extra empty line Signed-off-by: Fiona Trahe --- MAINTAINERS | 2 +- config/common_base | 1 - lib/librte_cryptodev/rte_cryptodev.h | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 85d72ca..a7570cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -231,7 +231,7 @@ M: Thomas Monjalon F: lib/librte_ether/ F: scripts/test-null.sh -Crypto API - EXPERIMENTAL +Crypto API M: Declan Doherty F: lib/librte_cryptodev/ F: app/test/test_cryptodev* diff --git a/config/common_base b/config/common_base index abd6a64..0124e86 100644 --- a/config/common_base +++ b/config/common_base @@ -327,7 +327,6 @@ CONFIG_RTE_PMD_PACKET_PREFETCH=y # # Compile generic crypto device library -# EXPERIMENTAL: API may change without prior notice # CONFIG_RTE_LIBRTE_CRYPTODEV=y CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 568ffbb..d47f1e8 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -39,9 +39,6 @@ * * Defines RTE Crypto Device APIs for the provisioning of cipher and * authentication operations. - * - * @b EXPERIMENTAL: this API may change without prior notice - * */ #ifdef __cplusplus -- 2.1.0
[dpdk-dev] [PATCH] cryptodev: Remove EXPERIMENTAL label
The cryptodev API was introduced in the DPDK 2.2 release. Since then it has - been reviewed and iterated for the DPDK 16.04 release - had extensive use by the l2fwd-crypto app, the ipsec-secgw example app, the test app. We believe it is now stable and the EXPERIMENTAL label should be removed. v2: - remove extra empty line Signed-off-by: Fiona Trahe --- MAINTAINERS | 2 +- config/common_base | 1 - lib/librte_cryptodev/rte_cryptodev.h | 3 --- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 85d72ca..a7570cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -231,7 +231,7 @@ M: Thomas Monjalon F: lib/librte_ether/ F: scripts/test-null.sh -Crypto API - EXPERIMENTAL +Crypto API M: Declan Doherty F: lib/librte_cryptodev/ F: app/test/test_cryptodev* diff --git a/config/common_base b/config/common_base index abd6a64..0124e86 100644 --- a/config/common_base +++ b/config/common_base @@ -327,7 +327,6 @@ CONFIG_RTE_PMD_PACKET_PREFETCH=y # # Compile generic crypto device library -# EXPERIMENTAL: API may change without prior notice # CONFIG_RTE_LIBRTE_CRYPTODEV=y CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 568ffbb..d47f1e8 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -39,9 +39,6 @@ * * Defines RTE Crypto Device APIs for the provisioning of cipher and * authentication operations. - * - * @b EXPERIMENTAL: this API may change without prior notice - * */ #ifdef __cplusplus -- 2.1.0
[dpdk-dev] [PATCH] cryptodev: Remove EXPERIMENTAL label
The cryptodev API was introduced in the DPDK 2.2 release. Since then it has - been reviewed and iterated for the DPDK 16.04 release - had extensive use by the l2fwd-crypto app, the ipsec-secgw example app, the test app. We believe it is now stable and the EXPERIMENTAL label should be removed. Signed-off-by: Fiona Trahe --- MAINTAINERS | 2 +- config/common_base | 1 - lib/librte_cryptodev/rte_cryptodev.h | 2 -- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 85d72ca..a7570cd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -231,7 +231,7 @@ M: Thomas Monjalon F: lib/librte_ether/ F: scripts/test-null.sh -Crypto API - EXPERIMENTAL +Crypto API M: Declan Doherty F: lib/librte_cryptodev/ F: app/test/test_cryptodev* diff --git a/config/common_base b/config/common_base index abd6a64..0124e86 100644 --- a/config/common_base +++ b/config/common_base @@ -327,7 +327,6 @@ CONFIG_RTE_PMD_PACKET_PREFETCH=y # # Compile generic crypto device library -# EXPERIMENTAL: API may change without prior notice # CONFIG_RTE_LIBRTE_CRYPTODEV=y CONFIG_RTE_LIBRTE_CRYPTODEV_DEBUG=n diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index b599c95..1427dcf 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -40,8 +40,6 @@ * Defines RTE Crypto Device APIs for the provisioning of cipher and * authentication operations. * - * @b EXPERIMENTAL: this API may change without prior notice - * */ #ifdef __cplusplus -- 2.1.0
[dpdk-dev] [PATCH] cryptodev: renaming 2 elements for clarity
renamed rte_cryptodev_sym_session.type -> dev_type (as it's not a session type, but a device type) renamed rte_crypto_sym_op.type -> sess_type (as it's not an op type, but a session type) Signed-off-by: Fiona Trahe --- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 7 --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 6 +++--- drivers/crypto/null/null_crypto_pmd.c | 4 ++-- drivers/crypto/qat/qat_crypto.c| 4 ++-- drivers/crypto/snow3g/rte_snow3g_pmd.c | 6 +++--- lib/librte_cryptodev/rte_crypto_sym.h | 6 +++--- lib/librte_cryptodev/rte_cryptodev.c | 4 ++-- lib/librte_cryptodev/rte_cryptodev.h | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index 35577bc..2987ef6 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -180,8 +180,9 @@ aesni_gcm_get_session(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op) { struct aesni_gcm_session *sess = NULL; - if (op->type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->session->type != RTE_CRYPTODEV_AESNI_GCM_PMD)) + if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (unlikely(op->session->dev_type + != RTE_CRYPTODEV_AESNI_GCM_PMD)) return sess; sess = (struct aesni_gcm_session *)op->session->_private; @@ -339,7 +340,7 @@ handle_completed_gcm_crypto_op(struct aesni_gcm_qp *qp, post_process_gcm_crypto_op(op); /* Free session if a session-less crypto op */ - if (op->sym->type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index a4b8807..3415ac1 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -299,8 +299,8 @@ get_session(struct aesni_mb_qp *qp, struct rte_crypto_op *op) { struct aesni_mb_session *sess = NULL; - if (op->sym->type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { - if (unlikely(op->sym->session->type != + if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_AESNI_MB_PMD)) return NULL; @@ -475,7 +475,7 @@ post_process_mb_job(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) } /* Free session if a session-less crypto op */ - if (op->sym->type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { + if (op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS) { rte_mempool_put(qp->sess_mp, op->sym->session); op->sym->session = NULL; } diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index 82b990c..bdaf13c 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -114,9 +114,9 @@ get_session(struct null_crypto_qp *qp, struct rte_crypto_sym_op *op) { struct null_crypto_session *sess; - if (op->type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { + if (op->sess_type == RTE_CRYPTO_SYM_OP_WITH_SESSION) { if (unlikely(op->session == NULL || - op->session->type != RTE_CRYPTODEV_NULL_PMD)) +op->session->dev_type != RTE_CRYPTODEV_NULL_PMD)) return NULL; sess = (struct null_crypto_session *)op->session->_private; diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 45bb8b3..495ea1c 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -676,13 +676,13 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) return -EINVAL; } #endif - if (unlikely(op->sym->type == RTE_CRYPTO_SYM_OP_SESSIONLESS)) { + if (unlikely(op->sym->sess_type == RTE_CRYPTO_SYM_OP_SESSIONLESS)) { PMD_DRV_LOG(ERR, "QAT PMD only supports session oriented" " requests, op (%p) is sessionless.", op); return -EINVAL; } - if (unlikely(op->sym->session->type != RTE_CRYPTODEV_QAT_SYM_PMD)) { + if (unlikely(op->sym->session->dev_type != RTE_CRYPTODEV_QAT_SYM_PMD)) { PMD_DRV_LOG(ERR, "Session was not created for this device"); return -EINVAL; } diff --git a/drivers/crypto/s
[dpdk-dev] [PATCH v2] drivers/crypto: Fix anonymous union initialization in crypto PMDs
In SUSE11-SP3 i686 platform, with gcc 4.5.1, there are compile issues, e.g: null_crypto_pmd_ops.c:44:3: error: unknown field 'sym' specified in initializer cc1: warnings being treated as errors The member in anonymous union initialization should be inside '{}', otherwise it will report an error. Fixes: 26c2e4ad5ad4 ("cryptodev: add capabilities discovery") v2: - extends fix to cover all crypto pmds. Signed-off-by: Michael Qiu Signed-off-by: Fiona Trahe --- drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c | 16 +++--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 64 +++--- drivers/crypto/null/null_crypto_pmd_ops.c | 16 +++--- drivers/crypto/qat/qat_crypto.c| 74 +- drivers/crypto/snow3g/rte_snow3g_pmd_ops.c | 16 +++--- 5 files changed, 93 insertions(+), 93 deletions(-) diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c index 387f8d1..4dec8dd 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd_ops.c @@ -41,9 +41,9 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = { { /* AES GCM (AUTH) */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - .sym = { + {.sym = { .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, - .auth = { + {.auth = { .algo = RTE_CRYPTO_AUTH_AES_GCM, .block_size = 16, .key_size = { @@ -61,14 +61,14 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = { .max = 12, .increment = 4 } - } - } + }, } + }, } }, { /* AES GCM (CIPHER) */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - .sym = { + {.sym = { .xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER, - .cipher = { + {.cipher = { .algo = RTE_CRYPTO_CIPHER_AES_GCM, .block_size = 16, .key_size = { @@ -81,8 +81,8 @@ static const struct rte_cryptodev_capabilities aesni_gcm_pmd_capabilities[] = { .max = 16, .increment = 0 } - } - } + }, } + }, } }, RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c index 5a439e6..3806a66 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -42,9 +42,9 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = { { /* MD5 HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - .sym = { + {.sym = { .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, - .auth = { + {.auth = { .algo = RTE_CRYPTO_AUTH_MD5_HMAC, .block_size = 64, .key_size = { @@ -58,14 +58,14 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = { .increment = 0 }, .aad_size = { 0 } - } - } + }, } + }, } }, { /* SHA1 HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - .sym = { + {.sym = { .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, - .auth = { + {.auth = { .algo = RTE_CRYPTO_AUTH_SHA1_HMAC, .block_size = 64, .key_size = { @@ -79,14 +79,14 @@ static const struct rte_cryptodev_capabilities aesni_mb_pmd_capabilities[] = { .increment = 0 }, .aad_size = { 0 } - } - } + }, } + }, } }, { /* SHA224 HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, - .sym = { + {.sym = { .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH, - .auth = { +
[dpdk-dev] [PATCH] qat: Fix for crash when nb_ops=0 on enqueue_burst
Crash seen in qat pmd when nb_ops=0 on rte_cryptodev_enqueue_burst() API Signed-off-by: Fiona Trahe --- drivers/crypto/qat/qat_crypto.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 5c41a89..90b5e6c 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -570,6 +570,9 @@ qat_pmd_enqueue_op_burst(void *qp, struct rte_crypto_op **ops, register uint32_t tail; int overflow; + if (unlikely(nb_ops == 0)) + return 0; + /* read params used a lot in main loop into registers */ queue = &(tmp_qp->tx_q); base_addr = (uint8_t *)queue->base_addr; -- 1.7.0.7
[dpdk-dev] [PATCH v2 2/2] app/test: added test for out-of-place symmetric operations
From: Arek KusztalAdded AES and snow3g Authenticated encryption and decryption tests for out-of-place operations. Signed-off-by: Arek Kusztal --- app/test/test_cryptodev.c | 495 - 1 files changed, 491 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 2494bae..0c26804 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -101,12 +101,27 @@ setup_test_string(struct rte_mempool *mpool, rte_pktmbuf_free(m); return NULL; } - - rte_memcpy(dst, string, t_len); + if (string != NULL) + rte_memcpy(dst, string, t_len); + else + memset(dst, 0, t_len); } return m; } +static int +setup_oop_test_mbufs(struct rte_mbuf **ibuf, struct rte_mbuf **obuf, + struct rte_mempool *mpool, const char *string, size_t len, + uint8_t blocksize) { + *ibuf = setup_test_string(mpool, string, len, blocksize); + if (*ibuf == NULL) + return -(EFAULT); + *obuf = setup_test_string(mpool, NULL, len, blocksize); + if (*obuf == NULL) + return -(EFAULT); + + return 0; +} #if HEX_DUMP static void @@ -907,6 +922,241 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) return TEST_SUCCESS; } + +static int +test_AES_CBC_HMAC_SHA1_encrypt_digest_oop(void) +{ + struct crypto_testsuite_params *ts_params = _params; + struct crypto_unittest_params *ut_params = _params; + + /* Generate test mbuf data and space for digest */ + + TEST_ASSERT_EQUAL(setup_oop_test_mbufs(_params->ibuf, + _params->obuf, ts_params->mbuf_pool, catch_22_quote, + QUOTE_512_BYTES, 0), 0, + "Allocation of rte_mbuf failed"); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->obuf, + DIGEST_BYTE_LENGTH_SHA1); + + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + ut_params->cipher_xform.next = _params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; + + ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; + ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1; + ut_params->auth_xform.auth.key.data = hmac_sha1_key; + ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->sess = rte_cryptodev_sym_session_create( + ts_params->valid_devs[0], + _params->cipher_xform); + + TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + + ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, + RTE_CRYPTO_OP_TYPE_SYMMETRIC); + + + TEST_ASSERT_NOT_NULL(ut_params->op, + "Failed to allocate symmetric crypto operation struct"); + + rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); + + struct rte_crypto_sym_op *sym_op = ut_params->op->sym; + + /* set crypto operation source mbuf */ + sym_op->m_src = ut_params->ibuf; + sym_op->m_dst = ut_params->obuf; + + sym_op->auth.digest.data = ut_params->digest; + + sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->obuf, QUOTE_512_BYTES); + + sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; + sym_op->auth.data.length = QUOTE_512_BYTES; + + /* Set crypto operation cipher parameters */ + sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + + TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, + "Failed to prepend place for iv input"); + + TEST_ASSERT_NOT_NULL(rte_pktmbuf_prepend(ut_params->obuf, + CIPHER_IV_LENGTH_AES_CBC), + "Failed to prepend place for iv output"); + + sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; + + sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, + CIPHER_IV_LENGTH_AES_CBC); + + sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC;
[dpdk-dev] [PATCH v2 1/2] driver/crypto: out-of-place symmetric operations
From: Arek KusztalThis patch adds out-of-place operations to qat symmetric crypto PMD, i.e. the result of the operation can be written to the destination buffer instead of overwriting the source buffer as done in "in-place" operation. Both buffers can be of different sizes. Previously the qat PMD assumed that m_src and m_dst in rte_crypto_sym_op were identical. Signed-off-by: Arek Kusztal --- doc/guides/cryptodevs/qat.rst |1 - drivers/crypto/qat/qat_crypto.c | 22 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index af90b46..4b8f782 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -62,7 +62,6 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2. * Cipher only is not supported except Snow3G UEA2. -* Only in-place is currently supported (destination address is the same as source address). * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 29c1fe5..55884d6 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -689,17 +689,21 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) *qat_req = ctx->fw_req; qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op; - /* -* The following code assumes: -* - single entry buffer. -* - always in place. -*/ qat_req->comn_mid.dst_length = - qat_req->comn_mid.src_length = - rte_pktmbuf_data_len(op->sym->m_src); + qat_req->comn_mid.src_length = + rte_pktmbuf_data_len(op->sym->m_src); + qat_req->comn_mid.dest_data_addr = - qat_req->comn_mid.src_data_addr = - rte_pktmbuf_mtophys(op->sym->m_src); + qat_req->comn_mid.src_data_addr = + rte_pktmbuf_mtophys(op->sym->m_src); + + if (unlikely(op->sym->m_dst != NULL)) { + qat_req->comn_mid.dest_data_addr = + rte_pktmbuf_mtophys(op->sym->m_dst); + qat_req->comn_mid.dst_length = + rte_pktmbuf_data_len(op->sym->m_dst); + } + cipher_param = (void *)_req->serv_specif_rqpars; auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); -- 1.7.0.7
[dpdk-dev] [PATCH v2 0/2] Out of place operations for symmetric crypto
From: Arek KusztalThis patch adds out of place operations for qat symmetric crypto PMD, i.e. the result of the operation can be written to the destination buffer instead of overwriting the source buffer as done in "in-place" operation. v2: - updated commit message to clarify out-of-place meaning Arek Kusztal (2): driver/crypto: out-of-place symmetric operations app/test: added test for out-of-place symmetric operations app/test/test_cryptodev.c | 495 ++- doc/guides/cryptodevs/qat.rst |1 - drivers/crypto/qat/qat_crypto.c | 22 +- 3 files changed, 504 insertions(+), 14 deletions(-)
[dpdk-dev] [PATCH 2/2] app/test: added test for out-of-place symmetric operations
From: Arek KusztalAdded AES and snow3g Authenticated encryption and decryption tests Signed-off-by: Arek Kusztal --- app/test/test_cryptodev.c | 495 - 1 files changed, 491 insertions(+), 4 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 2494bae..0c26804 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -101,12 +101,27 @@ setup_test_string(struct rte_mempool *mpool, rte_pktmbuf_free(m); return NULL; } - - rte_memcpy(dst, string, t_len); + if (string != NULL) + rte_memcpy(dst, string, t_len); + else + memset(dst, 0, t_len); } return m; } +static int +setup_oop_test_mbufs(struct rte_mbuf **ibuf, struct rte_mbuf **obuf, + struct rte_mempool *mpool, const char *string, size_t len, + uint8_t blocksize) { + *ibuf = setup_test_string(mpool, string, len, blocksize); + if (*ibuf == NULL) + return -(EFAULT); + *obuf = setup_test_string(mpool, NULL, len, blocksize); + if (*obuf == NULL) + return -(EFAULT); + + return 0; +} #if HEX_DUMP static void @@ -907,6 +922,241 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) return TEST_SUCCESS; } + +static int +test_AES_CBC_HMAC_SHA1_encrypt_digest_oop(void) +{ + struct crypto_testsuite_params *ts_params = _params; + struct crypto_unittest_params *ut_params = _params; + + /* Generate test mbuf data and space for digest */ + + TEST_ASSERT_EQUAL(setup_oop_test_mbufs(_params->ibuf, + _params->obuf, ts_params->mbuf_pool, catch_22_quote, + QUOTE_512_BYTES, 0), 0, + "Allocation of rte_mbuf failed"); + + ut_params->digest = (uint8_t *)rte_pktmbuf_append(ut_params->obuf, + DIGEST_BYTE_LENGTH_SHA1); + + TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); + + ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; + ut_params->cipher_xform.next = _params->auth_xform; + + ut_params->cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_AES_CBC; + ut_params->cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT; + ut_params->cipher_xform.cipher.key.data = aes_cbc_key; + ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; + + ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; + ut_params->auth_xform.next = NULL; + + ut_params->auth_xform.auth.op = RTE_CRYPTO_AUTH_OP_GENERATE; + ut_params->auth_xform.auth.algo = RTE_CRYPTO_AUTH_SHA1_HMAC; + ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA1; + ut_params->auth_xform.auth.key.data = hmac_sha1_key; + ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; + + ut_params->sess = rte_cryptodev_sym_session_create( + ts_params->valid_devs[0], + _params->cipher_xform); + + TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); + + ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, + RTE_CRYPTO_OP_TYPE_SYMMETRIC); + + + TEST_ASSERT_NOT_NULL(ut_params->op, + "Failed to allocate symmetric crypto operation struct"); + + rte_crypto_op_attach_sym_session(ut_params->op, ut_params->sess); + + struct rte_crypto_sym_op *sym_op = ut_params->op->sym; + + /* set crypto operation source mbuf */ + sym_op->m_src = ut_params->ibuf; + sym_op->m_dst = ut_params->obuf; + + sym_op->auth.digest.data = ut_params->digest; + + sym_op->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset( + ut_params->obuf, QUOTE_512_BYTES); + + sym_op->auth.digest.length = DIGEST_BYTE_LENGTH_SHA1; + sym_op->auth.data.length = QUOTE_512_BYTES; + + /* Set crypto operation cipher parameters */ + sym_op->cipher.iv.data = (uint8_t *)rte_pktmbuf_prepend(ut_params->ibuf, + CIPHER_IV_LENGTH_AES_CBC); + + TEST_ASSERT_NOT_NULL(sym_op->cipher.iv.data, + "Failed to prepend place for iv input"); + + TEST_ASSERT_NOT_NULL(rte_pktmbuf_prepend(ut_params->obuf, + CIPHER_IV_LENGTH_AES_CBC), + "Failed to prepend place for iv output"); + + sym_op->auth.data.offset = CIPHER_IV_LENGTH_AES_CBC; + + sym_op->cipher.iv.phys_addr = rte_pktmbuf_mtophys(ut_params->ibuf); + sym_op->cipher.iv.length = CIPHER_IV_LENGTH_AES_CBC; + + rte_memcpy(sym_op->cipher.iv.data, aes_cbc_iv, + CIPHER_IV_LENGTH_AES_CBC); + + sym_op->cipher.data.offset = CIPHER_IV_LENGTH_AES_CBC; +
[dpdk-dev] [PATCH 1/2] driver/crypto: out-of-place symmetric operations
From: Arek KusztalDriver now support out of place crypto operations, driver assumes both buffers can be of different size. Signed-off-by: Arek Kusztal --- doc/guides/cryptodevs/qat.rst |1 - drivers/crypto/qat/qat_crypto.c | 22 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst index af90b46..4b8f782 100644 --- a/doc/guides/cryptodevs/qat.rst +++ b/doc/guides/cryptodevs/qat.rst @@ -62,7 +62,6 @@ Limitations * Chained mbufs are not supported. * Hash only is not supported except Snow3G UIA2. * Cipher only is not supported except Snow3G UEA2. -* Only in-place is currently supported (destination address is the same as source address). * Only supports the session-oriented API implementation (session-less APIs are not supported). * Not performance tuned. * Snow3g(UEA2) supported only if cipher length, cipher offset fields are byte-aligned. diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 29c1fe5..55884d6 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -689,17 +689,21 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg) *qat_req = ctx->fw_req; qat_req->comn_mid.opaque_data = (uint64_t)(uintptr_t)op; - /* -* The following code assumes: -* - single entry buffer. -* - always in place. -*/ qat_req->comn_mid.dst_length = - qat_req->comn_mid.src_length = - rte_pktmbuf_data_len(op->sym->m_src); + qat_req->comn_mid.src_length = + rte_pktmbuf_data_len(op->sym->m_src); + qat_req->comn_mid.dest_data_addr = - qat_req->comn_mid.src_data_addr = - rte_pktmbuf_mtophys(op->sym->m_src); + qat_req->comn_mid.src_data_addr = + rte_pktmbuf_mtophys(op->sym->m_src); + + if (unlikely(op->sym->m_dst != NULL)) { + qat_req->comn_mid.dest_data_addr = + rte_pktmbuf_mtophys(op->sym->m_dst); + qat_req->comn_mid.dst_length = + rte_pktmbuf_data_len(op->sym->m_dst); + } + cipher_param = (void *)_req->serv_specif_rqpars; auth_param = (void *)((uint8_t *)cipher_param + sizeof(*cipher_param)); -- 1.7.0.7
[dpdk-dev] [PATCH 0/2] Out of place operations for symmetric crypto
From: Arek KusztalThis patch adds out of place operations for qat symmetric crypto operations. Arek Kusztal (2): driver/crypto: out-of-place symmetric operations app/test: added test for out-of-place symmetric operations app/test/test_cryptodev.c | 495 ++- doc/guides/cryptodevs/qat.rst |1 - drivers/crypto/qat/qat_crypto.c | 22 +- 3 files changed, 504 insertions(+), 14 deletions(-)
[dpdk-dev] [PATCH v9 5/5] mbuf_offload: remove library
From: Declan DohertyAs cryptodev library does not depend on mbuf_offload library any longer, this patch removes it. Signed-off-by: Declan Doherty --- MAINTAINERS| 4 - app/test/test_cryptodev.c | 1 - app/test/test_cryptodev_perf.c | 1 - config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 1 - drivers/crypto/qat/qat_crypto.c| 1 - examples/l2fwd-crypto/main.c | 1 - lib/Makefile | 1 - lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 - .../rte_mbuf_offload_version.map | 7 - 14 files changed, 493 deletions(-) delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map diff --git a/MAINTAINERS b/MAINTAINERS index e253bf7..421c317 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -223,10 +223,6 @@ F: lib/librte_mbuf/ F: doc/guides/prog_guide/mbuf_lib.rst F: app/test/test_mbuf.c -Packet buffer offload - EXPERIMENTAL -M: Declan Doherty -F: lib/librte_mbuf_offload/ - Ethernet API M: Thomas Monjalon F: lib/librte_ether/ diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 55367df..3240ecd 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index b43f9aa..b3f4fd9 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/config/common_base b/config/common_base index c73f71a..0a02924 100644 --- a/config/common_base +++ b/config/common_base @@ -361,13 +361,6 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 # -# Compile librte_mbuf_offload -# EXPERIMENTAL: API may change without prior notice -# -CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y -CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n - -# # Compile librte_timer # CONFIG_RTE_LIBRTE_TIMER=y diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 7a91001..f626386 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -104,7 +104,6 @@ There are many libraries, so their headers may be grouped by topics: - **containers**: [mbuf] (@ref rte_mbuf.h), - [mbuf_offload] (@ref rte_mbuf_offload.h), [ring] (@ref rte_ring.h), [distributor](@ref rte_distributor.h), [reorder](@ref rte_reorder.h), diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index f28b29f..9599cc4 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "rte_aesni_mb_pmd_private.h" diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 11f7fb2..3533f37 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include "qat_logs.h" diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 6aaa7c0..65e90b5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/Makefile b/lib/Makefile index 6840f87..f254dba 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -36,7 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf -DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index e39ad28..52f96c3 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -728,9 +728,6 @@ typedef uint8_t MARKER8[0]; /**< generic marker with 1B alignment */ typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes * with a single assignment */ -/** Opaque rte_mbuf_offload
[dpdk-dev] [PATCH v9 4/5] cryptodev: change burst API to be crypto op oriented
From: Declan DohertyThis patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the use of crypto operations in general, including new functions for managing rte_crypto_op pools. These changes continues the separation of the symmetric operation parameters from the more general operation parameters, which will simplify the integration of asymmetric crypto operations in the future. PMDs, unit tests and sample applications are also modified to work with the modified and new API. Signed-off-by: Declan Doherty --- app/test/test_cryptodev.c | 640 +++-- app/test/test_cryptodev_perf.c | 221 --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 133 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 132 +++-- drivers/crypto/qat/qat_crypto.h| 12 +- drivers/crypto/qat/rte_qat_cryptodev.c | 4 +- examples/l2fwd-crypto/main.c | 164 +++--- lib/librte_cryptodev/rte_crypto.h | 352 +++- lib/librte_cryptodev/rte_crypto_sym.h | 374 ++-- lib/librte_cryptodev/rte_cryptodev.c | 76 +++ lib/librte_cryptodev/rte_cryptodev.h | 108 ++-- lib/librte_cryptodev/rte_cryptodev_version.map | 3 +- 14 files changed, 1397 insertions(+), 838 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 5ced183..55367df 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -48,7 +48,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; - struct rte_mempool *mbuf_ol_pool; + struct rte_mempool *op_mpool; struct rte_cryptodev_config conf; struct rte_cryptodev_qp_conf qp_conf; @@ -62,8 +62,7 @@ struct crypto_unittest_params { struct rte_cryptodev_sym_session *sess; - struct rte_mbuf_offload *ol; - struct rte_crypto_sym_op *op; + struct rte_crypto_op *op; struct rte_mbuf *obuf, *ibuf; @@ -112,19 +111,21 @@ hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) } #endif -static struct rte_mbuf * -process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +static struct rte_crypto_op * +process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { - struct rte_mbuf *obuf = NULL; #if HEX_DUMP hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); #endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { + if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { printf("Error sending packet for encryption"); return NULL; } - while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) + + op = NULL; + + while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) rte_pause(); #if HEX_DUMP @@ -132,7 +133,7 @@ process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); #endif - return obuf; + return op; } static struct crypto_testsuite_params testsuite_params = { NULL }; @@ -162,13 +163,14 @@ testsuite_setup(void) } } - ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( - "MBUF_OFFLOAD_POOL", + ts_params->op_mpool = rte_crypto_op_pool_create( + "MBUF_CRYPTO_SYM_OP_POOL", + RTE_CRYPTO_OP_TYPE_SYMMETRIC, NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_sym_xform), rte_socket_id()); - if (ts_params->mbuf_ol_pool == NULL) { + if (ts_params->op_mpool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); return TEST_FAILED; } @@ -253,10 +255,9 @@ testsuite_teardown(void) rte_mempool_count(ts_params->mbuf_pool)); } - - if (ts_params->mbuf_ol_pool != NULL) { + if (ts_params->op_mpool != NULL) { RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n", - rte_mempool_count(ts_params->mbuf_ol_pool)); + rte_mempool_count(ts_params->op_mpool)); } } @@ -326,8 +327,8 @@ ut_teardown(void) } /* free crypto operation structure */ - if (ut_params->ol) - rte_pktmbuf_offload_free(ut_params->ol); + if (ut_params->op) + rte_crypto_op_free(ut_params->op); /* * free mbuf - both obuf and ibuf are usually
[dpdk-dev] [PATCH v9 3/5] cryptodev: remove unused phys_addr field from key
Remove unused phys_addr field from key in crypto_xform, simplifiy struct and fix knock-on impacts in l2fwd-crypto app Signed-off-by: Fiona Trahe --- examples/l2fwd-crypto/main.c | 42 ++- lib/librte_cryptodev/rte_crypto_sym.h | 16 ++--- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index ee519e7..9b6b7ef 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -112,6 +112,12 @@ enum l2fwd_crypto_xform_chain { L2FWD_CRYPTO_HASH_CIPHER }; +struct l2fwd_key { + uint8_t *data; + uint32_t length; + phys_addr_t phys_addr; +}; + /** l2fwd crypto application command line options */ struct l2fwd_crypto_options { unsigned portmask; @@ -127,7 +133,7 @@ struct l2fwd_crypto_options { struct rte_crypto_sym_xform cipher_xform; uint8_t ckey_data[32]; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; uint8_t ivkey_data[16]; struct rte_crypto_sym_xform auth_xform; @@ -141,7 +147,7 @@ struct l2fwd_crypto_params { unsigned digest_length; unsigned block_size; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; struct rte_cryptodev_sym_session *session; }; @@ -744,7 +750,7 @@ parse_cipher_op(enum rte_crypto_cipher_operation *op, char *optarg) /** Parse crypto key command line argument */ static int -parse_key(struct rte_crypto_key *key __rte_unused, +parse_key(struct l2fwd_key *key __rte_unused, unsigned length __rte_unused, char *arg __rte_unused) { printf("Currently an unsupported argument!\n"); @@ -820,11 +826,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_cipher_op(>cipher_xform.cipher.op, optarg); - else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) - return parse_key(>cipher_xform.cipher.key, - sizeof(options->ckey_data), optarg); + else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(, sizeof(options->ckey_data), optarg); + + options->cipher_xform.cipher.key.data = key.data; + options->cipher_xform.cipher.key.length = key.length; - else if (strcmp(lgopts[option_index].name, "iv") == 0) + return retval; + + } else if (strcmp(lgopts[option_index].name, "iv") == 0) return parse_key(>iv_key, sizeof(options->ivkey_data), optarg); @@ -837,11 +850,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_auth_op(>auth_xform.auth.op, optarg); - else if (strcmp(lgopts[option_index].name, "auth_key") == 0) - return parse_key(>auth_xform.auth.key, - sizeof(options->akey_data), optarg); + else if (strcmp(lgopts[option_index].name, "auth_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(, sizeof(options->akey_data), optarg); + + options->auth_xform.auth.key.data = key.data; + options->auth_xform.auth.key.length = key.length; + + return retval; - else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { + } else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { options->sessionless = 1; return 0; } diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index de6c701..270510e 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -111,12 +111,6 @@ enum rte_crypto_cipher_operation { /**< Decrypt cipher operation */ }; -/** Crypto key structure */ -struct rte_crypto_key { - uint8_t *data; /**< pointer to key data */ - phys_addr_t phys_addr; - size_t length; /**< key length in bytes */ -}; /** * Symmetric Cipher Setup Data. @@ -133,7 +127,10 @@ struct rte_crypto_cipher_xform { enum rte_crypto_cipher_algorithm algo; /**< Cipher algorithm */ - struct rte_crypto_key key; + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } key; /**< Cipher key * * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will @@ -257,7 +254,10 @@ struct rte_crypto_auth_xform { enum rte_crypto_auth_algorith
[dpdk-dev] [PATCH v9 2/5] cryptodev: refactor to partition common from symmetric-specific code
This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, in order to allow asymmetric crypto operations to be introduced at a later date, as well as to clean the logical structure of the public includes. The patch also introduces the _sym prefix to symmetric specific structure and functions to improve clarity in the API. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 161 +++--- app/test/test_cryptodev_perf.c | 42 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 44 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 6 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 51 +- drivers/crypto/qat/qat_crypto.h| 10 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 31 +- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 547 +-- lib/librte_cryptodev/rte_crypto_sym.h | 598 + lib/librte_cryptodev/rte_cryptodev.c | 39 +- lib/librte_cryptodev/rte_cryptodev.h | 46 +- lib/librte_cryptodev/rte_cryptodev_pmd.h | 22 +- lib/librte_cryptodev/rte_cryptodev_version.map | 6 +- lib/librte_mbuf_offload/rte_mbuf_offload.h | 22 +- 17 files changed, 867 insertions(+), 771 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1a0f204..5ced183 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-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 @@ -57,13 +57,13 @@ struct crypto_testsuite_params { }; struct crypto_unittest_params { - struct rte_crypto_xform cipher_xform; - struct rte_crypto_xform auth_xform; + struct rte_crypto_sym_xform cipher_xform; + struct rte_crypto_sym_xform auth_xform; - struct rte_cryptodev_session *sess; + struct rte_cryptodev_sym_session *sess; struct rte_mbuf_offload *ol; - struct rte_crypto_op *op; + struct rte_crypto_sym_op *op; struct rte_mbuf *obuf, *ibuf; @@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( struct crypto_unittest_params *ut_params); static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, +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); @@ -166,7 +166,7 @@ testsuite_setup(void) "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS * - sizeof(struct rte_crypto_xform), + sizeof(struct rte_crypto_sym_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -221,7 +221,7 @@ testsuite_setup(void) ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, _params->conf), @@ -276,7 +276,7 @@ ut_setup(void) ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = - (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ? DEFAULT_NUM_OPS_INFLIGHT : DEFAULT_NUM_OPS_INFLIGHT; @@ -320,7 +320,7 @@ ut_teardown(void) /* free crypto session structure */ if (ut_params->sess) { - rte_cryptodev_session_free(ts_params->valid_devs[0], + rte_cryptodev_sym_session_free(ts_params->valid_devs[0], ut_params->sess); ut_params->sess = NULL; } @@ -465,7 +465,7 @@ test_queue_pair_descriptor_setup(void) rte_cryptodev
[dpdk-dev] [PATCH v9 1/5] cryptodev: code cleanup
- Fixed >80char lines in test file - Removed unused elements from stats struct - Removed unused objects in rte_cryptodev_pmd.h - Renamed variables - Replaced leading spaces with tabs - Improved performance results display in test Signed-off-by: Fiona Trahe Signed-off-by: Declan Doherty --- app/test/test_cryptodev.c | 151 ++--- app/test/test_cryptodev.h | 5 +- app/test/test_cryptodev_perf.c | 54 +--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 28 ++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 35 + lib/librte_cryptodev/rte_cryptodev_pmd.h | 10 +- 8 files changed, 139 insertions(+), 158 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..1a0f204 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -679,76 +680,77 @@ static uint8_t aes_cbc_iv[] = { /* * AES-CBC / HMAC-SHA1 Hash Tests * */ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = { - 0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31, - 0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76, - 0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E, - 0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A, - 0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E, - 0X42, 0X3C, 0XFB, 0XE9, 0X1A, 0X24, 0XD6, 0X08, - 0XDD, 0XFD, 0X16, 0XFB, 0XE9, 0X55, 0XEF, 0XF0, - 0XA0, 0X8D, 0X13, 0XAB, 0X81, 0XC6, 0X90, 0X01, - 0XB5, 0X18, 0X84, 0XB3, 0XF6, 0XE6, 0X11, 0X57, - 0XD6, 0X71, 0XC6, 0X3C, 0X3F, 0X2F, 0X33, 0XEE, - 0X24, 0X42, 0X6E, 0XAC, 0X0B, 0XCA, 0XEC, 0XF9, - 0X84, 0XF8, 0X22, 0XAA, 0X60, 0XF0, 0X32, 0XA9, - 0X75, 0X75, 0X3B, 0XCB, 0X70, 0X21, 0X0A, 0X8D, - 0X0F, 0XE0, 0XC4, 0X78, 0X2B, 0XF8, 0X97, 0XE3, - 0XE4, 0X26, 0X4B, 0X29, 0XDA, 0X88, 0XCD, 0X46, - 0XEC, 0XAA, 0XF9, 0X7F, 0XF1, 0X15, 0XEA, 0XC3, - 0X87, 0XE6, 0X31, 0XF2, 0XCF, 0XDE, 0X4D, 0X80, - 0X70, 0X91, 0X7E, 0X0C, 0XF7, 0X26, 0X3A, 0X92, - 0X4F, 0X18, 0X83, 0XC0, 0X8F, 0X59, 0X01, 0XA5, - 0X88, 0XD1, 0XDB, 0X26, 0X71, 0X27, 0X16, 0XF5, - 0XEE, 0X10, 0X82, 0XAC, 0X68, 0X26, 0X9B, 0XE2, - 0X6D, 0XD8, 0X9A, 0X80, 0XDF, 0X04, 0X31, 0XD5, - 0XF1, 0X35, 0X5C, 0X3B, 0XDD, 0X9A, 0X65, 0XBA, - 0X58, 0X34, 0X85, 0X61, 0X1C, 0X42, 0X10, 0X76, - 0X73, 0X02, 0X42, 0XC9, 0X23, 0X18, 0X8E, 0XB4, - 0X6F, 0XB4, 0XA3, 0X54, 0X6E, 0X88, 0X3B, 0X62, - 0X7C, 0X02, 0X8D, 0X4C, 0X9F, 0XC8, 0X45, 0XF4, - 0XC9, 0XDE, 0X4F, 0XEB, 0X22, 0X83, 0X1B, 0XE4, - 0X49, 0X37, 0XE4, 0XAD, 0XE7, 0XCD, 0X21, 0X54, - 0XBC, 0X1C, 0XC2, 0X04, 0X97, 0XB4, 0X10, 0X61, - 0XF0, 0XE4, 0XEF, 0X27, 0X63, 0X3A, 0XDA, 0X91, - 0X41, 0X25, 0X62, 0X1C, 0X5C, 0XB6, 0X38, 0X4A, - 0X88, 0X71, 0X59, 0X5A, 0X8D, 0XA0, 0X09, 0XAF, - 0X72, 0X94, 0XD7, 0X79, 0X5C, 0X60, 0X7C, 0X8F, - 0X4C, 0XF5, 0XD9, 0XA1, 0X39, 0X6D, 0X81, 0X28, - 0XEF, 0X13, 0X28, 0XDF, 0XF5, 0X3E, 0XF7, 0X8E, - 0X09, 0X9C, 0X78, 0X18, 0X79, 0XB8, 0X68, 0XD7, - 0XA8, 0X29, 0X62, 0XAD, 0XDE, 0XE1, 0X61, 0X76, - 0X1B, 0X05, 0X16, 0XCD, 0XBF, 0X02, 0X8E, 0XA6, - 0X43, 0X6E, 0X92, 0X55, 0X4F, 0X60, 0X9C, 0X03, - 0XB8, 0X4F, 0XA3, 0X02, 0XAC, 0XA8, 0XA7, 0X0C, - 0X1E, 0XB5, 0X6B, 0XF8, 0XC8, 0X4D, 0XDE, 0XD2, - 0XB0, 0X29, 0X6E, 0X40, 0XE6, 0XD6, 0XC9, 0XE6, - 0XB9, 0X0F, 0XB6, 0X63, 0XF5, 0XAA, 0X2B, 0X96, - 0XA7, 0X16, 0XAC, 0X4E, 0X0A, 0X33, 0X1C, 0XA6, - 0XE6, 0XBD, 0X8A, 0XCF, 0X40, 0XA9, 0XB2, 0XFA, - 0X63, 0X27, 0XFD, 0X9B, 0XD9, 0XFC, 0XD5, 0X87, - 0X8D, 0X4C, 0XB6, 0XA4, 0XCB, 0XE7, 0X74, 0X55, - 0XF4, 0XFB, 0X41, 0X25, 0XB5, 0X4B, 0X0A, 0X1B, - 0XB1, 0XD6, 0XB7, 0XD9, 0X47, 0X2A, 0XC3, 0X98, - 0X6A, 0XC4, 0X03, 0X73, 0X1F, 0X93, 0X6E, 0X53, - 0X19, 0X25, 0X64, 0X15, 0X83, 0XF9, 0X73, 0X2A, - 0X74, 0XB4, 0X93, 0X69, 0XC4, 0X72, 0XFC, 0X26, - 0XA2, 0X9F, 0X43, 0X45, 0XDD, 0XB9, 0XEF, 0X36, - 0XC8, 0X3A, 0XCD, 0X99, 0X9B, 0X54, 0X1A, 0X36, - 0XC1, 0X59, 0XF8, 0X98, 0XA8, 0XCC, 0X28, 0X0D, - 0X73, 0X4C, 0XEE, 0X98, 0XCB, 0X7C, 0X58, 0X7E, - 0X20, 0X75, 0X1E,
[dpdk-dev] [PATCH v9 0/5] cryptodev API changes
From: Pablo de Lara <pablo.de.lara.gua...@intel.com> This patch set separates the symmetric crypto operations from generic operations and then modifies the cryptodev burst API to accept bursts of rte_crypto_op rather than rte_mbufs. v9: - include missing casting that was making C++ complain v8: - split patchset for easier review - fix broken /examples/l2fwd-crypto build in intermediate patch - split removal of rte_mbuf_offload into separate commit v7: - remove trailing spaces introduced in v6 - rebase against recent config file changes v6: - restore EXPERIMENTAL label to cryptodev. Will handle removal in separate thread. (email subject was incorrect in v5, so v5 hasn't arrived in patchwork, therefore v6 is in-reply-to v4 message id) V5: - updates .map file - removes EXPERIMENTAL label from rte_cryptodev.h V4: - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset. - Typo fix in cached attribute on rte_crypto_op structure. V3: - Addresses V2 comments - Rebased for head Declan Doherty (2): cryptodev: change burst API to be crypto op oriented mbuf_offload: remove library Fiona Trahe (3): cryptodev: code cleanup cryptodev: refactor to partition common from symmetric-specific code cryptodev: remove unused phys_addr field from key MAINTAINERS| 4 - app/test/test_cryptodev.c | 883 +++-- app/test/test_cryptodev.h | 5 +- app/test/test_cryptodev_perf.c | 270 --- config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 190 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 30 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 10 +- drivers/crypto/qat/qat_crypto.c| 160 ++-- drivers/crypto/qat/qat_crypto.h| 14 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 234 +++--- lib/Makefile | 1 - lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 819 --- lib/librte_cryptodev/rte_crypto_sym.h | 642 +++ lib/librte_cryptodev/rte_cryptodev.c | 115 ++- lib/librte_cryptodev/rte_cryptodev.h | 189 ++--- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 9 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 .../rte_mbuf_offload_version.map | 7 - 26 files changed, 2131 insertions(+), 1968 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map -- 2.5.0
[dpdk-dev] [PATCH v8 5/5] mbuf_offload: remove library
From: Declan DohertyAs cryptodev library does not depend on mbuf_offload library any longer, this patch removes it. Signed-off-by: Declan Doherty --- MAINTAINERS| 4 - app/test/test_cryptodev.c | 1 - app/test/test_cryptodev_perf.c | 1 - config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 1 - drivers/crypto/qat/qat_crypto.c| 1 - examples/l2fwd-crypto/main.c | 1 - lib/Makefile | 1 - lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 - .../rte_mbuf_offload_version.map | 7 - 14 files changed, 493 deletions(-) delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map diff --git a/MAINTAINERS b/MAINTAINERS index e253bf7..421c317 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -223,10 +223,6 @@ F: lib/librte_mbuf/ F: doc/guides/prog_guide/mbuf_lib.rst F: app/test/test_mbuf.c -Packet buffer offload - EXPERIMENTAL -M: Declan Doherty -F: lib/librte_mbuf_offload/ - Ethernet API M: Thomas Monjalon F: lib/librte_ether/ diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 55367df..3240ecd 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index b43f9aa..b3f4fd9 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/config/common_base b/config/common_base index c73f71a..0a02924 100644 --- a/config/common_base +++ b/config/common_base @@ -361,13 +361,6 @@ CONFIG_RTE_MBUF_REFCNT_ATOMIC=y CONFIG_RTE_PKTMBUF_HEADROOM=128 # -# Compile librte_mbuf_offload -# EXPERIMENTAL: API may change without prior notice -# -CONFIG_RTE_LIBRTE_MBUF_OFFLOAD=y -CONFIG_RTE_LIBRTE_MBUF_OFFLOAD_DEBUG=n - -# # Compile librte_timer # CONFIG_RTE_LIBRTE_TIMER=y diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 7a91001..f626386 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -104,7 +104,6 @@ There are many libraries, so their headers may be grouped by topics: - **containers**: [mbuf] (@ref rte_mbuf.h), - [mbuf_offload] (@ref rte_mbuf_offload.h), [ring] (@ref rte_ring.h), [distributor](@ref rte_distributor.h), [reorder](@ref rte_reorder.h), diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index f28b29f..9599cc4 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "rte_aesni_mb_pmd_private.h" diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 11f7fb2..3533f37 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include "qat_logs.h" diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index 6aaa7c0..65e90b5 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -62,7 +62,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/Makefile b/lib/Makefile index 6840f87..f254dba 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -36,7 +36,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_EAL) += librte_eal DIRS-$(CONFIG_RTE_LIBRTE_RING) += librte_ring DIRS-$(CONFIG_RTE_LIBRTE_MEMPOOL) += librte_mempool DIRS-$(CONFIG_RTE_LIBRTE_MBUF) += librte_mbuf -DIRS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD) += librte_mbuf_offload DIRS-$(CONFIG_RTE_LIBRTE_TIMER) += librte_timer DIRS-$(CONFIG_RTE_LIBRTE_CFGFILE) += librte_cfgfile DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += librte_cmdline diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index e39ad28..52f96c3 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -728,9 +728,6 @@ typedef uint8_t MARKER8[0]; /**< generic marker with 1B alignment */ typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes * with a single assignment */ -/** Opaque rte_mbuf_offload
[dpdk-dev] [PATCH v8 4/5] cryptodev: change burst API to be crypto op oriented
From: Declan DohertyThis patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the use of crypto operations in general, including new functions for managing rte_crypto_op pools. These changes continues the separation of the symmetric operation parameters from the more general operation parameters, which will simplify the integration of asymmetric crypto operations in the future. PMDs, unit tests and sample applications are also modified to work with the modified and new API. Signed-off-by: Declan Doherty --- app/test/test_cryptodev.c | 640 +++-- app/test/test_cryptodev_perf.c | 221 --- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 133 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 132 +++-- drivers/crypto/qat/qat_crypto.h| 12 +- drivers/crypto/qat/rte_qat_cryptodev.c | 4 +- examples/l2fwd-crypto/main.c | 164 +++--- lib/librte_cryptodev/rte_crypto.h | 352 +++- lib/librte_cryptodev/rte_crypto_sym.h | 374 ++-- lib/librte_cryptodev/rte_cryptodev.c | 76 +++ lib/librte_cryptodev/rte_cryptodev.h | 108 ++-- lib/librte_cryptodev/rte_cryptodev_version.map | 5 +- 14 files changed, 1398 insertions(+), 839 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 5ced183..55367df 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -48,7 +48,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; - struct rte_mempool *mbuf_ol_pool; + struct rte_mempool *op_mpool; struct rte_cryptodev_config conf; struct rte_cryptodev_qp_conf qp_conf; @@ -62,8 +62,7 @@ struct crypto_unittest_params { struct rte_cryptodev_sym_session *sess; - struct rte_mbuf_offload *ol; - struct rte_crypto_sym_op *op; + struct rte_crypto_op *op; struct rte_mbuf *obuf, *ibuf; @@ -112,19 +111,21 @@ hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) } #endif -static struct rte_mbuf * -process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +static struct rte_crypto_op * +process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { - struct rte_mbuf *obuf = NULL; #if HEX_DUMP hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); #endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { + if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { printf("Error sending packet for encryption"); return NULL; } - while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) + + op = NULL; + + while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) rte_pause(); #if HEX_DUMP @@ -132,7 +133,7 @@ process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); #endif - return obuf; + return op; } static struct crypto_testsuite_params testsuite_params = { NULL }; @@ -162,13 +163,14 @@ testsuite_setup(void) } } - ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( - "MBUF_OFFLOAD_POOL", + ts_params->op_mpool = rte_crypto_op_pool_create( + "MBUF_CRYPTO_SYM_OP_POOL", + RTE_CRYPTO_OP_TYPE_SYMMETRIC, NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_sym_xform), rte_socket_id()); - if (ts_params->mbuf_ol_pool == NULL) { + if (ts_params->op_mpool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); return TEST_FAILED; } @@ -253,10 +255,9 @@ testsuite_teardown(void) rte_mempool_count(ts_params->mbuf_pool)); } - - if (ts_params->mbuf_ol_pool != NULL) { + if (ts_params->op_mpool != NULL) { RTE_LOG(DEBUG, USER1, "CRYPTO_OP_POOL count %u\n", - rte_mempool_count(ts_params->mbuf_ol_pool)); + rte_mempool_count(ts_params->op_mpool)); } } @@ -326,8 +327,8 @@ ut_teardown(void) } /* free crypto operation structure */ - if (ut_params->ol) - rte_pktmbuf_offload_free(ut_params->ol); + if (ut_params->op) + rte_crypto_op_free(ut_params->op); /* * free mbuf - both obuf and ibuf are usually
[dpdk-dev] [PATCH v8 3/5] cryptodev: remove unused phys_addr field from key
Remove unused phys_addr field from key in crypto_xform, simplifiy struct and fix knock-on impacts in l2fwd-crypto app Signed-off-by: Fiona Trahe --- examples/l2fwd-crypto/main.c | 42 ++- lib/librte_cryptodev/rte_crypto_sym.h | 16 ++--- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c index ee519e7..9b6b7ef 100644 --- a/examples/l2fwd-crypto/main.c +++ b/examples/l2fwd-crypto/main.c @@ -112,6 +112,12 @@ enum l2fwd_crypto_xform_chain { L2FWD_CRYPTO_HASH_CIPHER }; +struct l2fwd_key { + uint8_t *data; + uint32_t length; + phys_addr_t phys_addr; +}; + /** l2fwd crypto application command line options */ struct l2fwd_crypto_options { unsigned portmask; @@ -127,7 +133,7 @@ struct l2fwd_crypto_options { struct rte_crypto_sym_xform cipher_xform; uint8_t ckey_data[32]; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; uint8_t ivkey_data[16]; struct rte_crypto_sym_xform auth_xform; @@ -141,7 +147,7 @@ struct l2fwd_crypto_params { unsigned digest_length; unsigned block_size; - struct rte_crypto_key iv_key; + struct l2fwd_key iv_key; struct rte_cryptodev_sym_session *session; }; @@ -744,7 +750,7 @@ parse_cipher_op(enum rte_crypto_cipher_operation *op, char *optarg) /** Parse crypto key command line argument */ static int -parse_key(struct rte_crypto_key *key __rte_unused, +parse_key(struct l2fwd_key *key __rte_unused, unsigned length __rte_unused, char *arg __rte_unused) { printf("Currently an unsupported argument!\n"); @@ -820,11 +826,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_cipher_op(>cipher_xform.cipher.op, optarg); - else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) - return parse_key(>cipher_xform.cipher.key, - sizeof(options->ckey_data), optarg); + else if (strcmp(lgopts[option_index].name, "cipher_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(, sizeof(options->ckey_data), optarg); + + options->cipher_xform.cipher.key.data = key.data; + options->cipher_xform.cipher.key.length = key.length; - else if (strcmp(lgopts[option_index].name, "iv") == 0) + return retval; + + } else if (strcmp(lgopts[option_index].name, "iv") == 0) return parse_key(>iv_key, sizeof(options->ivkey_data), optarg); @@ -837,11 +850,18 @@ l2fwd_crypto_parse_args_long_options(struct l2fwd_crypto_options *options, return parse_auth_op(>auth_xform.auth.op, optarg); - else if (strcmp(lgopts[option_index].name, "auth_key") == 0) - return parse_key(>auth_xform.auth.key, - sizeof(options->akey_data), optarg); + else if (strcmp(lgopts[option_index].name, "auth_key") == 0) { + struct l2fwd_key key = { 0 }; + int retval = 0; + + retval = parse_key(, sizeof(options->akey_data), optarg); + + options->auth_xform.auth.key.data = key.data; + options->auth_xform.auth.key.length = key.length; + + return retval; - else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { + } else if (strcmp(lgopts[option_index].name, "sessionless") == 0) { options->sessionless = 1; return 0; } diff --git a/lib/librte_cryptodev/rte_crypto_sym.h b/lib/librte_cryptodev/rte_crypto_sym.h index de6c701..270510e 100644 --- a/lib/librte_cryptodev/rte_crypto_sym.h +++ b/lib/librte_cryptodev/rte_crypto_sym.h @@ -111,12 +111,6 @@ enum rte_crypto_cipher_operation { /**< Decrypt cipher operation */ }; -/** Crypto key structure */ -struct rte_crypto_key { - uint8_t *data; /**< pointer to key data */ - phys_addr_t phys_addr; - size_t length; /**< key length in bytes */ -}; /** * Symmetric Cipher Setup Data. @@ -133,7 +127,10 @@ struct rte_crypto_cipher_xform { enum rte_crypto_cipher_algorithm algo; /**< Cipher algorithm */ - struct rte_crypto_key key; + struct { + uint8_t *data; /**< pointer to key data */ + size_t length; /**< key length in bytes */ + } key; /**< Cipher key * * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will @@ -257,7 +254,10 @@ struct rte_crypto_auth_xform { enum rte_crypto_auth_algorith
[dpdk-dev] [PATCH v8 2/5] cryptodev: refactor to partition common from symmetric-specific code
This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, in order to allow asymmetric crypto operations to be introduced at a later date, as well as to clean the logical structure of the public includes. The patch also introduces the _sym prefix to symmetric specific structure and functions to improve clarity in the API. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 161 +++--- app/test/test_cryptodev_perf.c | 42 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 44 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 6 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 51 +- drivers/crypto/qat/qat_crypto.h| 10 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 31 +- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 547 +-- lib/librte_cryptodev/rte_crypto_sym.h | 598 + lib/librte_cryptodev/rte_cryptodev.c | 39 +- lib/librte_cryptodev/rte_cryptodev.h | 46 +- lib/librte_cryptodev/rte_cryptodev_pmd.h | 22 +- lib/librte_cryptodev/rte_cryptodev_version.map | 6 +- lib/librte_mbuf_offload/rte_mbuf_offload.h | 22 +- 17 files changed, 867 insertions(+), 771 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1a0f204..5ced183 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-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 @@ -57,13 +57,13 @@ struct crypto_testsuite_params { }; struct crypto_unittest_params { - struct rte_crypto_xform cipher_xform; - struct rte_crypto_xform auth_xform; + struct rte_crypto_sym_xform cipher_xform; + struct rte_crypto_sym_xform auth_xform; - struct rte_cryptodev_session *sess; + struct rte_cryptodev_sym_session *sess; struct rte_mbuf_offload *ol; - struct rte_crypto_op *op; + struct rte_crypto_sym_op *op; struct rte_mbuf *obuf, *ibuf; @@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( struct crypto_unittest_params *ut_params); static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, +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); @@ -166,7 +166,7 @@ testsuite_setup(void) "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, DEFAULT_NUM_XFORMS * - sizeof(struct rte_crypto_xform), + sizeof(struct rte_crypto_sym_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -221,7 +221,7 @@ testsuite_setup(void) ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, _params->conf), @@ -276,7 +276,7 @@ ut_setup(void) ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = - (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ? DEFAULT_NUM_OPS_INFLIGHT : DEFAULT_NUM_OPS_INFLIGHT; @@ -320,7 +320,7 @@ ut_teardown(void) /* free crypto session structure */ if (ut_params->sess) { - rte_cryptodev_session_free(ts_params->valid_devs[0], + rte_cryptodev_sym_session_free(ts_params->valid_devs[0], ut_params->sess); ut_params->sess = NULL; } @@ -465,7 +465,7 @@ test_queue_pair_descriptor_setup(void) rte_cryptodev
[dpdk-dev] [PATCH v8 1/5] cryptodev: code cleanup
- Fixed >80char lines in test file - Removed unused elements from stats struct - Removed unused objects in rte_cryptodev_pmd.h - Renamed variables - Replaced leading spaces with tabs - Improved performance results display in test Signed-off-by: Fiona Trahe Signed-off-by: Declan Doherty --- app/test/test_cryptodev.c | 151 ++--- app/test/test_cryptodev.h | 5 +- app/test/test_cryptodev_perf.c | 54 +--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 28 ++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 35 + lib/librte_cryptodev/rte_cryptodev_pmd.h | 10 +- 8 files changed, 139 insertions(+), 158 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..1a0f204 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -679,76 +680,77 @@ static uint8_t aes_cbc_iv[] = { /* * AES-CBC / HMAC-SHA1 Hash Tests * */ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = { - 0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31, - 0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76, - 0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E, - 0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A, - 0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E, - 0X42, 0X3C, 0XFB, 0XE9, 0X1A, 0X24, 0XD6, 0X08, - 0XDD, 0XFD, 0X16, 0XFB, 0XE9, 0X55, 0XEF, 0XF0, - 0XA0, 0X8D, 0X13, 0XAB, 0X81, 0XC6, 0X90, 0X01, - 0XB5, 0X18, 0X84, 0XB3, 0XF6, 0XE6, 0X11, 0X57, - 0XD6, 0X71, 0XC6, 0X3C, 0X3F, 0X2F, 0X33, 0XEE, - 0X24, 0X42, 0X6E, 0XAC, 0X0B, 0XCA, 0XEC, 0XF9, - 0X84, 0XF8, 0X22, 0XAA, 0X60, 0XF0, 0X32, 0XA9, - 0X75, 0X75, 0X3B, 0XCB, 0X70, 0X21, 0X0A, 0X8D, - 0X0F, 0XE0, 0XC4, 0X78, 0X2B, 0XF8, 0X97, 0XE3, - 0XE4, 0X26, 0X4B, 0X29, 0XDA, 0X88, 0XCD, 0X46, - 0XEC, 0XAA, 0XF9, 0X7F, 0XF1, 0X15, 0XEA, 0XC3, - 0X87, 0XE6, 0X31, 0XF2, 0XCF, 0XDE, 0X4D, 0X80, - 0X70, 0X91, 0X7E, 0X0C, 0XF7, 0X26, 0X3A, 0X92, - 0X4F, 0X18, 0X83, 0XC0, 0X8F, 0X59, 0X01, 0XA5, - 0X88, 0XD1, 0XDB, 0X26, 0X71, 0X27, 0X16, 0XF5, - 0XEE, 0X10, 0X82, 0XAC, 0X68, 0X26, 0X9B, 0XE2, - 0X6D, 0XD8, 0X9A, 0X80, 0XDF, 0X04, 0X31, 0XD5, - 0XF1, 0X35, 0X5C, 0X3B, 0XDD, 0X9A, 0X65, 0XBA, - 0X58, 0X34, 0X85, 0X61, 0X1C, 0X42, 0X10, 0X76, - 0X73, 0X02, 0X42, 0XC9, 0X23, 0X18, 0X8E, 0XB4, - 0X6F, 0XB4, 0XA3, 0X54, 0X6E, 0X88, 0X3B, 0X62, - 0X7C, 0X02, 0X8D, 0X4C, 0X9F, 0XC8, 0X45, 0XF4, - 0XC9, 0XDE, 0X4F, 0XEB, 0X22, 0X83, 0X1B, 0XE4, - 0X49, 0X37, 0XE4, 0XAD, 0XE7, 0XCD, 0X21, 0X54, - 0XBC, 0X1C, 0XC2, 0X04, 0X97, 0XB4, 0X10, 0X61, - 0XF0, 0XE4, 0XEF, 0X27, 0X63, 0X3A, 0XDA, 0X91, - 0X41, 0X25, 0X62, 0X1C, 0X5C, 0XB6, 0X38, 0X4A, - 0X88, 0X71, 0X59, 0X5A, 0X8D, 0XA0, 0X09, 0XAF, - 0X72, 0X94, 0XD7, 0X79, 0X5C, 0X60, 0X7C, 0X8F, - 0X4C, 0XF5, 0XD9, 0XA1, 0X39, 0X6D, 0X81, 0X28, - 0XEF, 0X13, 0X28, 0XDF, 0XF5, 0X3E, 0XF7, 0X8E, - 0X09, 0X9C, 0X78, 0X18, 0X79, 0XB8, 0X68, 0XD7, - 0XA8, 0X29, 0X62, 0XAD, 0XDE, 0XE1, 0X61, 0X76, - 0X1B, 0X05, 0X16, 0XCD, 0XBF, 0X02, 0X8E, 0XA6, - 0X43, 0X6E, 0X92, 0X55, 0X4F, 0X60, 0X9C, 0X03, - 0XB8, 0X4F, 0XA3, 0X02, 0XAC, 0XA8, 0XA7, 0X0C, - 0X1E, 0XB5, 0X6B, 0XF8, 0XC8, 0X4D, 0XDE, 0XD2, - 0XB0, 0X29, 0X6E, 0X40, 0XE6, 0XD6, 0XC9, 0XE6, - 0XB9, 0X0F, 0XB6, 0X63, 0XF5, 0XAA, 0X2B, 0X96, - 0XA7, 0X16, 0XAC, 0X4E, 0X0A, 0X33, 0X1C, 0XA6, - 0XE6, 0XBD, 0X8A, 0XCF, 0X40, 0XA9, 0XB2, 0XFA, - 0X63, 0X27, 0XFD, 0X9B, 0XD9, 0XFC, 0XD5, 0X87, - 0X8D, 0X4C, 0XB6, 0XA4, 0XCB, 0XE7, 0X74, 0X55, - 0XF4, 0XFB, 0X41, 0X25, 0XB5, 0X4B, 0X0A, 0X1B, - 0XB1, 0XD6, 0XB7, 0XD9, 0X47, 0X2A, 0XC3, 0X98, - 0X6A, 0XC4, 0X03, 0X73, 0X1F, 0X93, 0X6E, 0X53, - 0X19, 0X25, 0X64, 0X15, 0X83, 0XF9, 0X73, 0X2A, - 0X74, 0XB4, 0X93, 0X69, 0XC4, 0X72, 0XFC, 0X26, - 0XA2, 0X9F, 0X43, 0X45, 0XDD, 0XB9, 0XEF, 0X36, - 0XC8, 0X3A, 0XCD, 0X99, 0X9B, 0X54, 0X1A, 0X36, - 0XC1, 0X59, 0XF8, 0X98, 0XA8, 0XCC, 0X28, 0X0D, - 0X73, 0X4C, 0XEE, 0X98, 0XCB, 0X7C, 0X58, 0X7E, - 0X20, 0X75, 0X1E,
[dpdk-dev] [PATCH v8 0/5] cryptodev API changes
This patch set separates the symmetric crypto operations from generic operations and then modifies the cryptodev burst API to accept bursts of rte_crypto_op rather than rte_mbufs. v8: - split patchset for easier review - fix broken /examples/l2fwd-crypto build in intermediate patch - split removal of rte_mbuf_offload into separate commit v7: - remove trailing spaces introduced in v6 - rebase against recent config file changes v6: - restore EXPERIMENTAL label to cryptodev. Will handle removal in separate thread. (email subject was incorrect in v5, so v5 hasn't arrived in patchwork, therefore v6 is in-reply-to v4 message id) V5: - updates .map file - removes EXPERIMENTAL label from rte_cryptodev.h V4: - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset. - Typo fix in cached attribute on rte_crypto_op structure. V3: - Addresses V2 comments - Rebased for head Declan Doherty (2): cryptodev: change burst API to be crypto op oriented mbuf_offload: remove library Fiona Trahe (3): cryptodev: code cleanup cryptodev: refactor to partition common from symmetric-specific code cryptodev: remove unused phys_addr field from key MAINTAINERS| 4 - app/test/test_cryptodev.c | 883 +++-- app/test/test_cryptodev.h | 5 +- app/test/test_cryptodev_perf.c | 270 --- config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 190 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 30 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 10 +- drivers/crypto/qat/qat_crypto.c| 160 ++-- drivers/crypto/qat/qat_crypto.h| 14 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 234 +++--- lib/Makefile | 1 - lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 819 --- lib/librte_cryptodev/rte_crypto_sym.h | 642 +++ lib/librte_cryptodev/rte_cryptodev.c | 115 ++- lib/librte_cryptodev/rte_cryptodev.h | 189 ++--- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 7 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 .../rte_mbuf_offload_version.map | 7 - 26 files changed, 2130 insertions(+), 1967 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map -- 2.1.0
[dpdk-dev] [PATCH v7 2/2] cryptodev: change burst API to be crypto op oriented
This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the use of crypto operations in general. The changes also continues the separatation of the symmetric operation parameters from the more general operation parameters, this will simplify the integration of asymmetric crypto operations in the future. As well as the changes to the crypto APIs this patch adds functions for managing rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit tests and sample application to work with the modified APIs and finally removes the now unused rte_mbuf_offload library. Signed-off-by: Declan Doherty Signed-off-by: Fiona Trahe --- MAINTAINERS| 4 - app/test/test_cryptodev.c | 804 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 253 +++ config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 171 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- drivers/crypto/qat/qat_crypto.c| 123 ++-- drivers/crypto/qat/qat_crypto.h| 12 +- drivers/crypto/qat/rte_qat_cryptodev.c | 4 +- examples/l2fwd-crypto/main.c | 283 lib/Makefile | 1 - lib/librte_cryptodev/rte_crypto.h | 364 +- lib/librte_cryptodev/rte_crypto_sym.h | 379 +- lib/librte_cryptodev/rte_cryptodev.c | 76 ++ lib/librte_cryptodev/rte_cryptodev.h | 113 ++- lib/librte_cryptodev/rte_cryptodev_version.map | 5 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 .../rte_mbuf_offload_version.map | 7 - 24 files changed, 1576 insertions(+), 1522 deletions(-) delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 628bc05..8d84dda 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -222,10 +222,6 @@ F: lib/librte_mbuf/ F: doc/guides/prog_guide/mbuf_lib.rst F: app/test/test_mbuf.c -Packet buffer offload - EXPERIMENTAL -M: Declan Doherty -F: lib/librte_mbuf_offload/ - Ethernet API M: Thomas Monjalon F: lib/librte_ether/ diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 951b443..208fc14 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; - struct rte_mempool *mbuf_ol_pool; + struct rte_mempool *op_mpool; struct rte_cryptodev_config conf; struct rte_cryptodev_qp_conf qp_conf; @@ -62,8 +61,7 @@ struct crypto_unittest_params { struct rte_cryptodev_sym_session *sess; - struct rte_mbuf_offload *ol; - struct rte_crypto_sym_op *op; + struct rte_crypto_op *op; struct rte_mbuf *obuf, *ibuf; @@ -104,7 +102,7 @@ setup_test_string(struct rte_mempool *mpool, return m; } -#if HEX_DUMP +#ifdef HEX_DUMP static void hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) { @@ -112,27 +110,29 @@ hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) } #endif -static struct rte_mbuf * -process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +static struct rte_crypto_op * +process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { - struct rte_mbuf *obuf = NULL; -#if HEX_DUMP +#ifdef HEX_DUMP hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); #endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { + if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { printf("Error sending packet for encryption"); return NULL; } - while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) + + op = NULL; + + while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) rte_pause(); -#if HEX_DUMP +#ifdef HEX_DUMP if (obuf) hexdump_mbuf_data(stdout, "Dequeue
[dpdk-dev] [PATCH v7 1/2] cryptodev: API tidy and changes to support future extensions
This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, in order to allow asymmetric crypto operations to be introduced at a later date, as well as to clean the logical structure of the public includes. The patch also introduces the _sym prefix to symmetric specific structure and functions to improve clarity in the API. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 164 +++--- app/test/test_cryptodev_perf.c | 79 +-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 44 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 6 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 51 +- drivers/crypto/qat/qat_crypto.h| 10 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 33 +- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 563 +-- lib/librte_cryptodev/rte_crypto_sym.h | 613 + lib/librte_cryptodev/rte_cryptodev.c | 39 +- lib/librte_cryptodev/rte_cryptodev.h | 80 ++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 6 +- lib/librte_mbuf_offload/rte_mbuf_offload.h | 22 +- 17 files changed, 915 insertions(+), 840 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..951b443 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-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 @@ -57,13 +57,13 @@ struct crypto_testsuite_params { }; struct crypto_unittest_params { - struct rte_crypto_xform cipher_xform; - struct rte_crypto_xform auth_xform; + struct rte_crypto_sym_xform cipher_xform; + struct rte_crypto_sym_xform auth_xform; - struct rte_cryptodev_session *sess; + struct rte_cryptodev_sym_session *sess; struct rte_mbuf_offload *ol; - struct rte_crypto_op *op; + struct rte_crypto_sym_op *op; struct rte_mbuf *obuf, *ibuf; @@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( struct crypto_unittest_params *ut_params); static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, +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); @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_sym_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -220,7 +221,7 @@ testsuite_setup(void) ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, _params->conf), @@ -275,7 +276,7 @@ ut_setup(void) ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = - (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ? DEFAULT_NUM_OPS_INFLIGHT : DEFAULT_NUM_OPS_INFLIGHT; @@ -319,7 +320,7 @@ ut_teardown(void) /* free crypto session structure */ if (ut_params->sess) { - rte_cryptodev_session_free(ts_params->valid_devs[0], + rte_cryptodev_sym_session_free(ts_params->valid_devs[0], ut_params->sess);
[dpdk-dev] [PATCH v7 0/2] cryptodev API changes
This patch set separates the symmetric crypto operations from generic operations and then modifies the cryptodev burst API to accept bursts of rte_crypto_op rather than rte_mbufs. v7: - remove trailing spaces introduced in v6 - rebase against recent config file changes v6: - restore EXPERIMENTAL label to cryptodev. Will handle removal in separate thread. (email subject was incorrect in v5, so v5 hasn't arrived in patchwork, therefore v6 is in-reply-to v4 message id) V5: - updates .map file - removes EXPERIMENTAL label from rte_cryptodev.h V4: - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset. - Typo fix in cached attribute on rte_crypto_op structure. V3: - Addresses V2 comments - Rebased for head Declan Doherty (1): cryptodev: change burst API to be crypto op oriented Fiona Trahe (2): cryptodev: API tidy and changes to support future extensions cryptodev: change burst API to be crypto op oriented MAINTAINERS| 4 - app/test/test_cryptodev.c | 894 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 270 --- config/common_base | 7 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 18 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 6 +- drivers/crypto/qat/qat_crypto.c| 150 ++-- drivers/crypto/qat/qat_crypto.h| 14 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 300 --- lib/Makefile | 1 - lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 819 +++ lib/librte_cryptodev/rte_crypto_sym.h | 642 +++ lib/librte_cryptodev/rte_cryptodev.c | 115 ++- lib/librte_cryptodev/rte_cryptodev.h | 189 ++--- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 7 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 --- .../rte_mbuf_offload_version.map | 7 - 26 files changed, 2145 insertions(+), 2016 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map -- 2.1.0
[dpdk-dev] [PATCH v6 2/2] cryptodev: change burst API to be crypto op oriented
This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this simplifies the burst processing in the crypto PMDs and the use of crypto operations in general. The changes also continues the separatation of the symmetric operation parameters from the more general operation parameters, this will simplify the integration of asymmetric crypto operations in the future. As well as the changes to the crypto APIs this patch adds functions for managing rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit tests and sample application to work with the modified APIs and finally removes the now unused rte_mbuf_offload library. Signed-off-by: Declan Doherty Signed-off-by: Fiona Trahe --- MAINTAINERS| 4 - app/test/test_cryptodev.c | 804 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 253 +++ config/common_bsdapp | 9 +- config/common_linuxapp | 9 +- doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 171 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- drivers/crypto/qat/qat_crypto.c| 123 ++-- drivers/crypto/qat/qat_crypto.h| 12 +- drivers/crypto/qat/rte_qat_cryptodev.c | 4 +- examples/l2fwd-crypto/main.c | 283 lib/Makefile | 1 - lib/librte_cryptodev/rte_crypto.h | 364 +- lib/librte_cryptodev/rte_crypto_sym.h | 379 +- lib/librte_cryptodev/rte_cryptodev.c | 76 ++ lib/librte_cryptodev/rte_cryptodev.h | 115 ++- lib/librte_cryptodev/rte_cryptodev_version.map | 5 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 .../rte_mbuf_offload_version.map | 7 - 25 files changed, 1579 insertions(+), 1532 deletions(-) delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 628bc05..8d84dda 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -222,10 +222,6 @@ F: lib/librte_mbuf/ F: doc/guides/prog_guide/mbuf_lib.rst F: app/test/test_mbuf.c -Packet buffer offload - EXPERIMENTAL -M: Declan Doherty -F: lib/librte_mbuf_offload/ - Ethernet API M: Thomas Monjalon F: lib/librte_ether/ diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 951b443..208fc14 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; - struct rte_mempool *mbuf_ol_pool; + struct rte_mempool *op_mpool; struct rte_cryptodev_config conf; struct rte_cryptodev_qp_conf qp_conf; @@ -62,8 +61,7 @@ struct crypto_unittest_params { struct rte_cryptodev_sym_session *sess; - struct rte_mbuf_offload *ol; - struct rte_crypto_sym_op *op; + struct rte_crypto_op *op; struct rte_mbuf *obuf, *ibuf; @@ -104,7 +102,7 @@ setup_test_string(struct rte_mempool *mpool, return m; } -#if HEX_DUMP +#ifdef HEX_DUMP static void hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) { @@ -112,27 +110,29 @@ hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) } #endif -static struct rte_mbuf * -process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +static struct rte_crypto_op * +process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { - struct rte_mbuf *obuf = NULL; -#if HEX_DUMP +#ifdef HEX_DUMP hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); #endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { + if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { printf("Error sending packet for encryption"); return NULL; } - while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) + + op = NULL; + + while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) rte_pause(); -#if HEX_DUMP +#ifdef HEX_D
[dpdk-dev] [PATCH v6 1/2] cryptodev: API tidy and changes to support future extensions
This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, in order to allow asymmetric crypto operations to be introduced at a later date, as well as to clean the logical structure of the public includes. The patch also introduces the _sym prefix to symmetric specific structure and functions to improve clarity in the API. Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 164 +++--- app/test/test_cryptodev_perf.c | 79 +-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 44 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 6 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 51 +- drivers/crypto/qat/qat_crypto.h| 10 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 33 +- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 563 +-- lib/librte_cryptodev/rte_crypto_sym.h | 613 + lib/librte_cryptodev/rte_cryptodev.c | 39 +- lib/librte_cryptodev/rte_cryptodev.h | 80 ++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 6 +- lib/librte_mbuf_offload/rte_mbuf_offload.h | 22 +- 17 files changed, 915 insertions(+), 840 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..951b443 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-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 @@ -57,13 +57,13 @@ struct crypto_testsuite_params { }; struct crypto_unittest_params { - struct rte_crypto_xform cipher_xform; - struct rte_crypto_xform auth_xform; + struct rte_crypto_sym_xform cipher_xform; + struct rte_crypto_sym_xform auth_xform; - struct rte_cryptodev_session *sess; + struct rte_cryptodev_sym_session *sess; struct rte_mbuf_offload *ol; - struct rte_crypto_op *op; + struct rte_crypto_sym_op *op; struct rte_mbuf *obuf, *ibuf; @@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( struct crypto_unittest_params *ut_params); static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, +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); @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_sym_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -220,7 +221,7 @@ testsuite_setup(void) ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, _params->conf), @@ -275,7 +276,7 @@ ut_setup(void) ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = - (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ? DEFAULT_NUM_OPS_INFLIGHT : DEFAULT_NUM_OPS_INFLIGHT; @@ -319,7 +320,7 @@ ut_teardown(void) /* free crypto session structure */ if (ut_params->sess) { - rte_cryptodev_session_free(ts_params->valid_devs[0], + rte_cryptodev_sym_session_free(ts_params->valid_devs[0], ut_params->sess);
[dpdk-dev] [PATCH v6 0/2] cryptodev API changes
This patch set separates the symmetric crypto operations from generic operations and then modifies the cryptodev burst API to accept bursts of rte_crypto_op rather than rte_mbufs. v6: - restore EXPERIMENTAL label to cryptodev. Will handle removal in separate thread. (email subject was incorrect in v5, so v5 hasn't arrived in patchwork, therefore v6 is in-reply-to v4 message id) V5: - updates .map file - removes EXPERIMENTAL label from rte_cryptodev.h V4: - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset. - Typo fix in cached attribute on rte_crypto_op structure. V3: - Addresses V2 comments - Rebased for head Declan Doherty (1): cryptodev: change burst API to be crypto op oriented Fiona Trahe (1): cryptodev: API tidy and changes to support future extensions MAINTAINERS| 4 - app/test/test_cryptodev.c | 894 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 270 --- config/common_bsdapp | 9 +- config/common_linuxapp | 9 +- doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 18 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 6 +- drivers/crypto/qat/qat_crypto.c| 150 ++-- drivers/crypto/qat/qat_crypto.h| 14 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 300 --- lib/Makefile | 1 - lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 819 +++ lib/librte_cryptodev/rte_crypto_sym.h | 642 +++ lib/librte_cryptodev/rte_cryptodev.c | 115 ++- lib/librte_cryptodev/rte_cryptodev.h | 191 ++--- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 7 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 --- .../rte_mbuf_offload_version.map | 7 - 27 files changed, 2148 insertions(+), 2026 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map -- 2.1.0
[dpdk-dev] [PATCH v5 2/2] This patch modifies the crypto burst enqueue/dequeue APIs to operate on bursts rte_crypto_op's rather than the current implementation which operates on rte_mbuf bursts, this
The changes also continues the separatation of the symmetric operation parameters from the more general operation parameters, this will simplify the integration of asymmetric crypto operations in the future. As well as the changes to the crypto APIs this patch adds functions for managing rte_crypto_op pools to the cryptodev API. It modifies the existing PMDs, unit tests and sample application to work with the modified APIs and finally removes the now unused rte_mbuf_offload library. Signed-off-by: Declan Doherty Signed-off-by: Fiona Trahe --- MAINTAINERS| 6 +- app/test/test_cryptodev.c | 804 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 253 +++ config/common_bsdapp | 8 - config/common_linuxapp | 8 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 171 +++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- drivers/crypto/qat/qat_crypto.c| 123 ++-- drivers/crypto/qat/qat_crypto.h| 12 +- drivers/crypto/qat/rte_qat_cryptodev.c | 4 +- examples/l2fwd-crypto/main.c | 283 lib/Makefile | 1 - lib/librte_cryptodev/rte_crypto.h | 364 +- lib/librte_cryptodev/rte_crypto_sym.h | 379 +- lib/librte_cryptodev/rte_cryptodev.c | 76 ++ lib/librte_cryptodev/rte_cryptodev.h | 113 ++- lib/librte_cryptodev/rte_cryptodev_version.map | 5 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 .../rte_mbuf_offload_version.map | 7 - 25 files changed, 1576 insertions(+), 1533 deletions(-) delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map diff --git a/MAINTAINERS b/MAINTAINERS index 628bc05..ad6b45e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -222,16 +222,12 @@ F: lib/librte_mbuf/ F: doc/guides/prog_guide/mbuf_lib.rst F: app/test/test_mbuf.c -Packet buffer offload - EXPERIMENTAL -M: Declan Doherty -F: lib/librte_mbuf_offload/ - Ethernet API M: Thomas Monjalon F: lib/librte_ether/ F: scripts/test-null.sh -Crypto API - EXPERIMENTAL +Crypto API M: Declan Doherty F: lib/librte_cryptodev/ F: app/test/test_cryptodev* diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 951b443..208fc14 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,7 @@ static enum rte_cryptodev_type gbl_cryptodev_type; struct crypto_testsuite_params { struct rte_mempool *mbuf_pool; - struct rte_mempool *mbuf_ol_pool; + struct rte_mempool *op_mpool; struct rte_cryptodev_config conf; struct rte_cryptodev_qp_conf qp_conf; @@ -62,8 +61,7 @@ struct crypto_unittest_params { struct rte_cryptodev_sym_session *sess; - struct rte_mbuf_offload *ol; - struct rte_crypto_sym_op *op; + struct rte_crypto_op *op; struct rte_mbuf *obuf, *ibuf; @@ -104,7 +102,7 @@ setup_test_string(struct rte_mempool *mpool, return m; } -#if HEX_DUMP +#ifdef HEX_DUMP static void hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) { @@ -112,27 +110,29 @@ hexdump_mbuf_data(FILE *f, const char *title, struct rte_mbuf *m) } #endif -static struct rte_mbuf * -process_crypto_request(uint8_t dev_id, struct rte_mbuf *ibuf) +static struct rte_crypto_op * +process_crypto_request(uint8_t dev_id, struct rte_crypto_op *op) { - struct rte_mbuf *obuf = NULL; -#if HEX_DUMP +#ifdef HEX_DUMP hexdump_mbuf_data(stdout, "Enqueued Packet", ibuf); #endif - if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { + if (rte_cryptodev_enqueue_burst(dev_id, 0, , 1) != 1) { printf("Error sending packet for encryption"); return NULL; } - while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) + + op = NULL; + + while (rte_cryptodev_dequeue_burst(dev_id, 0, , 1) == 0) rte_pause(); -#if HEX_DUMP +#ifdef HEX_DUMP if (obuf) hexdump_mbuf_data(stdout, "Dequeued Packet", obuf); #endif - return obuf; + return op; } static
[dpdk-dev] [PATCH v5 1/2] This patch splits symmetric specific definitions and functions away from the common crypto APIs to facilitate the future extension and expansion of the cryptodev framework, i
Signed-off-by: Fiona Trahe --- app/test/test_cryptodev.c | 164 +++--- app/test/test_cryptodev_perf.c | 79 +-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 44 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 6 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 4 +- drivers/crypto/qat/qat_crypto.c| 51 +- drivers/crypto/qat/qat_crypto.h| 10 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 33 +- lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 563 +-- lib/librte_cryptodev/rte_crypto_sym.h | 613 + lib/librte_cryptodev/rte_cryptodev.c | 39 +- lib/librte_cryptodev/rte_cryptodev.h | 80 ++- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 6 +- lib/librte_mbuf_offload/rte_mbuf_offload.h | 22 +- 17 files changed, 915 insertions(+), 840 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..951b443 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -1,7 +1,7 @@ /*- * BSD LICENSE * - * Copyright(c) 2015 Intel Corporation. All rights reserved. + * Copyright(c) 2015-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 @@ -57,13 +57,13 @@ struct crypto_testsuite_params { }; struct crypto_unittest_params { - struct rte_crypto_xform cipher_xform; - struct rte_crypto_xform auth_xform; + struct rte_crypto_sym_xform cipher_xform; + struct rte_crypto_sym_xform auth_xform; - struct rte_cryptodev_session *sess; + struct rte_cryptodev_sym_session *sess; struct rte_mbuf_offload *ol; - struct rte_crypto_op *op; + struct rte_crypto_sym_op *op; struct rte_mbuf *obuf, *ibuf; @@ -78,7 +78,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( struct crypto_unittest_params *ut_params); static int -test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, +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); @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_sym_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -220,7 +221,7 @@ testsuite_setup(void) ts_params->conf.nb_queue_pairs = info.max_nb_queue_pairs; ts_params->conf.socket_id = SOCKET_ID_ANY; - ts_params->conf.session_mp.nb_objs = info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, _params->conf), @@ -275,7 +276,7 @@ ut_setup(void) ts_params->conf.nb_queue_pairs = DEFAULT_NUM_QPS_PER_QAT_DEVICE; ts_params->conf.socket_id = SOCKET_ID_ANY; ts_params->conf.session_mp.nb_objs = - (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_PMD) ? + (gbl_cryptodev_type == RTE_CRYPTODEV_QAT_SYM_PMD) ? DEFAULT_NUM_OPS_INFLIGHT : DEFAULT_NUM_OPS_INFLIGHT; @@ -319,7 +320,7 @@ ut_teardown(void) /* free crypto session structure */ if (ut_params->sess) { - rte_cryptodev_session_free(ts_params->valid_devs[0], + rte_cryptodev_sym_session_free(ts_params->valid_devs[0], ut_params->sess); ut_params->sess = NULL; } @@ -464,7 +465,7 @@ test_queue_pair_descriptor_setup(void) rte_cryptodev_info_get(ts_params->valid_devs[0], _info); - ts_params->conf.session_mp.nb_objs = dev_info.max_nb_sessions; + ts_params->conf.session_mp.nb_objs = dev_info.sym.max_nb_sessions; TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], _params->conf), "Failed
[dpdk-dev] [PATCH v5 0/2] cryptodev API changes
This patch set separates the symmetric crypto operations from generic operations and then modifies the cryptodev burst API to accept bursts of rte_crypto_op rather than rte_mbufs. V5: - updates .map file - removes EXPERIMENTAL label from rte_cryptodev.h V4: - Fixes for issues introduced in __rte_crypto_op_raw_bulk_alloc in V3 patcheset. - Typo fix in cached attribute on rte_crypto_op structure. V3: - Addresses V2 comments - Rebased for head Declan Doherty (1): cryptodev: change burst API to be crypto op oriented Fiona Trahe (1): cryptodev: API tidy and changes to support future extensions MAINTAINERS| 6 +- app/test/test_cryptodev.c | 894 +++-- app/test/test_cryptodev.h | 9 +- app/test/test_cryptodev_perf.c | 270 --- config/common_bsdapp | 8 - config/common_linuxapp | 8 - doc/api/doxy-api-index.md | 1 - drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 199 ++--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 18 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 6 +- drivers/crypto/qat/qat_crypto.c| 150 ++-- drivers/crypto/qat/qat_crypto.h| 14 +- drivers/crypto/qat/rte_qat_cryptodev.c | 8 +- examples/l2fwd-crypto/main.c | 300 --- lib/Makefile | 1 - lib/librte_cryptodev/Makefile | 1 + lib/librte_cryptodev/rte_crypto.h | 819 +++ lib/librte_cryptodev/rte_crypto_sym.h | 642 +++ lib/librte_cryptodev/rte_cryptodev.c | 115 ++- lib/librte_cryptodev/rte_cryptodev.h | 189 ++--- lib/librte_cryptodev/rte_cryptodev_pmd.h | 32 +- lib/librte_cryptodev/rte_cryptodev_version.map | 7 +- lib/librte_mbuf/rte_mbuf.h | 6 - lib/librte_mbuf_offload/Makefile | 52 -- lib/librte_mbuf_offload/rte_mbuf_offload.c | 100 --- lib/librte_mbuf_offload/rte_mbuf_offload.h | 310 --- .../rte_mbuf_offload_version.map | 7 - 27 files changed, 2145 insertions(+), 2027 deletions(-) create mode 100644 lib/librte_cryptodev/rte_crypto_sym.h delete mode 100644 lib/librte_mbuf_offload/Makefile delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.c delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload.h delete mode 100644 lib/librte_mbuf_offload/rte_mbuf_offload_version.map -- 2.1.0
[dpdk-dev] [PATCH] Adding maintainers for Intel QAT PMD
Signed-off-by: Fiona Trahe --- MAINTAINERS |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index b90aeea..748197f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -353,6 +353,9 @@ M: Declan Doherty F: drivers/crypto/aesni_mb/ Intel QuickAssist +M: John Griffin +M: Fiona Trahe +M: Deepak Kumar Jain F: drivers/crypto/qat/ -- 1.7.0.7