From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org, gakhil@marvell.com
Cc: Gagandeep Singh <g.singh@nxp.com>
Subject: [dpdk-dev] [RFC 06/16] crypto/dpaa2_sec: support AUTH only with raw buffer APIs
Date: Thu, 12 Aug 2021 12:42:34 +0530 [thread overview]
Message-ID: <20210812071244.28799-7-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20210812071244.28799-1-hemant.agrawal@nxp.com>
From: Gagandeep Singh <g.singh@nxp.com>
Auth only with raw buffer APIs has been supported in this patch.
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h | 21 ----
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 114 ++++++++++++++++++--
2 files changed, 108 insertions(+), 27 deletions(-)
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
index 860c9b6520..f6507855e3 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
@@ -231,27 +231,6 @@ typedef struct dpaa2_sec_session_entry {
static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = {
/* Symmetric capabilities */
- { /* NULL (AUTH) */
- .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
- {.sym = {
- .xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
- {.auth = {
- .algo = RTE_CRYPTO_AUTH_NULL,
- .block_size = 1,
- .key_size = {
- .min = 0,
- .max = 0,
- .increment = 0
- },
- .digest_size = {
- .min = 0,
- .max = 0,
- .increment = 0
- },
- .iv_size = { 0 }
- }, },
- }, },
- },
{ /* MD5 */
.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
{.sym = {
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
index 10cb4247b0..4c11a79d90 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c
@@ -11,6 +11,8 @@
#include "dpaa2_sec_priv.h"
#include "dpaa2_sec_logs.h"
+#include <desc/algo.h>
+
struct dpaa2_sec_raw_dp_ctx {
dpaa2_sec_session *session;
uint32_t tail;
@@ -73,14 +75,114 @@ build_raw_dp_auth_fd(uint8_t *drv_ctx,
void *userdata,
struct qbman_fd *fd)
{
- RTE_SET_USED(drv_ctx);
- RTE_SET_USED(sgl);
RTE_SET_USED(iv);
- RTE_SET_USED(digest);
RTE_SET_USED(auth_iv);
- RTE_SET_USED(ofs);
- RTE_SET_USED(userdata);
- RTE_SET_USED(fd);
+
+ dpaa2_sec_session *sess =
+ ((struct dpaa2_sec_raw_dp_ctx *)drv_ctx)->session;
+ struct qbman_fle *fle, *sge, *ip_fle, *op_fle;
+ struct sec_flow_context *flc;
+ int total_len = 0, data_len = 0, data_offset;
+ uint8_t *old_digest;
+ struct ctxt_priv *priv = sess->ctxt;
+ unsigned int i;
+
+ for (i = 0; i < sgl->num; i++)
+ total_len += sgl->vec[i].len;
+
+ data_len = total_len - ofs.ofs.auth.head - ofs.ofs.auth.tail;
+ data_offset = ofs.ofs.auth.head;
+
+ if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2 ||
+ sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) {
+ if ((data_len & 7) || (data_offset & 7)) {
+ DPAA2_SEC_ERR("AUTH: len/offset must be full bytes");
+ return -ENOTSUP;
+ }
+
+ data_len = data_len >> 3;
+ data_offset = data_offset >> 3;
+ }
+ fle = (struct qbman_fle *)rte_malloc(NULL,
+ FLE_SG_MEM_SIZE(2 * sgl->num),
+ RTE_CACHE_LINE_SIZE);
+ if (unlikely(!fle)) {
+ DPAA2_SEC_ERR("AUTH SG: Memory alloc failed for SGE");
+ return -ENOMEM;
+ }
+ memset(fle, 0, FLE_SG_MEM_SIZE(2*sgl->num));
+ /* first FLE entry used to store mbuf and session ctxt */
+ DPAA2_SET_FLE_ADDR(fle, (size_t)userdata);
+ DPAA2_FLE_SAVE_CTXT(fle, (ptrdiff_t)priv);
+ op_fle = fle + 1;
+ ip_fle = fle + 2;
+ sge = fle + 3;
+
+ flc = &priv->flc_desc[DESC_INITFINAL].flc;
+
+ /* sg FD */
+ DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc));
+ DPAA2_SET_FD_ADDR(fd, DPAA2_VADDR_TO_IOVA(op_fle));
+ DPAA2_SET_FD_COMPOUND_FMT(fd);
+
+ /* o/p fle */
+ DPAA2_SET_FLE_ADDR(op_fle,
+ DPAA2_VADDR_TO_IOVA(digest->va));
+ op_fle->length = sess->digest_length;
+
+ /* i/p fle */
+ DPAA2_SET_FLE_SG_EXT(ip_fle);
+ DPAA2_SET_FLE_ADDR(ip_fle, DPAA2_VADDR_TO_IOVA(sge));
+ ip_fle->length = data_len;
+
+ if (sess->iv.length) {
+ uint8_t *iv_ptr;
+
+ iv_ptr = rte_crypto_op_ctod_offset(userdata, uint8_t *,
+ sess->iv.offset);
+
+ if (sess->auth_alg == RTE_CRYPTO_AUTH_SNOW3G_UIA2) {
+ iv_ptr = conv_to_snow_f9_iv(iv_ptr);
+ sge->length = 12;
+ } else if (sess->auth_alg == RTE_CRYPTO_AUTH_ZUC_EIA3) {
+ iv_ptr = conv_to_zuc_eia_iv(iv_ptr);
+ sge->length = 8;
+ } else {
+ sge->length = sess->iv.length;
+ }
+ DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(iv_ptr));
+ ip_fle->length += sge->length;
+ sge++;
+ }
+ /* i/p 1st seg */
+ DPAA2_SET_FLE_ADDR(sge, sgl->vec[0].iova);
+ DPAA2_SET_FLE_OFFSET(sge, data_offset);
+
+ if (data_len <= (int)(sgl->vec[0].len - data_offset)) {
+ sge->length = data_len;
+ data_len = 0;
+ } else {
+ sge->length = sgl->vec[0].len - data_offset;
+ for (i = 1; i < sgl->num; i++) {
+ sge++;
+ DPAA2_SET_FLE_ADDR(sge, sgl->vec[i].iova);
+ DPAA2_SET_FLE_OFFSET(sge, 0);
+ sge->length = sgl->vec[i].len;
+ }
+ }
+ if (sess->dir == DIR_DEC) {
+ /* Digest verification case */
+ sge++;
+ old_digest = (uint8_t *)(sge + 1);
+ rte_memcpy(old_digest, digest->va,
+ sess->digest_length);
+ DPAA2_SET_FLE_ADDR(sge, DPAA2_VADDR_TO_IOVA(old_digest));
+ sge->length = sess->digest_length;
+ ip_fle->length += sess->digest_length;
+ }
+ DPAA2_SET_FLE_FIN(sge);
+ DPAA2_SET_FLE_FIN(ip_fle);
+ DPAA2_SET_FD_LEN(fd, ip_fle->length);
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2021-08-12 7:16 UTC|newest]
Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-12 7:12 [dpdk-dev] [RFC 00/16] crypto: add raw vector support in DPAAx Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 01/16] crypto: change sgl to src_sgl in vector Hemant Agrawal
2021-08-12 8:22 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-12 7:12 ` [dpdk-dev] [RFC 02/16] crypto: add total raw buffer length Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 03/16] crypto: add dest_sgl in raw vector APIs Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 04/16] crypto: enhance raw process for protocol offload Hemant Agrawal
2021-08-12 8:11 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-12 7:12 ` [dpdk-dev] [RFC 05/16] crypto/dpaa2_sec: support raw datapath APIs Hemant Agrawal
2021-08-12 7:12 ` Hemant Agrawal [this message]
2021-08-12 7:12 ` [dpdk-dev] [RFC 07/16] crypto/dpaa2_sec: support AUTHENC with raw buffer APIs Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 08/16] crypto/dpaa2_sec: support AEAD " Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 09/16] crypto/dpaa2_sec: support OOP with raw buffer API Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 10/16] crypto/dpaa2_sec: fix ctx memset size Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 11/16] crypto/dpaa2_sec: enhance error checks with raw buffer APIs Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 12/16] crypto/dpaa_sec: support raw datapath APIs Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 13/16] crypto/dpaa_sec: support authonly and chain with raw APIs Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 14/16] crypto/dpaa_sec: support AEAD and proto " Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 15/16] test/crypto: add raw API test for dpaax Hemant Agrawal
2021-08-12 7:12 ` [dpdk-dev] [RFC 16/16] test/crypto: enabling raw API support in 5G algos Hemant Agrawal
2021-08-25 7:14 ` [dpdk-dev] [PATCH 00/15] crypto: add raw vector support in DPAAx Hemant Agrawal
2021-08-25 7:14 ` [dpdk-dev] [PATCH 01/15] crypto: change sgl to src_sgl in vector Hemant Agrawal
2021-09-06 18:36 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-25 7:14 ` [dpdk-dev] [PATCH 02/15] crypto: add total raw buffer length Hemant Agrawal
2021-09-06 18:36 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-25 7:14 ` [dpdk-dev] [PATCH 03/15] crypto: add dest_sgl in raw vector APIs Hemant Agrawal
2021-09-06 18:37 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-25 7:14 ` [dpdk-dev] [PATCH 04/15] crypto: fix raw process for multi-seg case Hemant Agrawal
2021-09-06 18:38 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 05/15] crypto/dpaa2_sec: support raw datapath APIs Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 06/15] crypto/dpaa2_sec: support AUTH only with raw buffer APIs Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 07/15] crypto/dpaa2_sec: support AUTHENC " Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 08/15] crypto/dpaa2_sec: support AEAD " Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 09/15] crypto/dpaa2_sec: support OOP with raw buffer API Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 10/15] crypto/dpaa2_sec: enhance error checks with raw buffer APIs Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 11/15] crypto/dpaa_sec: support raw datapath APIs Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 12/15] crypto/dpaa_sec: support authonly and chain with raw APIs Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 13/15] crypto/dpaa_sec: support AEAD and proto " Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 14/15] test/crypto: add raw API test for dpaax Hemant Agrawal
2021-08-25 7:15 ` [dpdk-dev] [PATCH 15/15] test/crypto: add raw API support in 5G algos Hemant Agrawal
2021-09-06 18:45 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-06 18:46 ` [dpdk-dev] [EXT] [PATCH 00/15] crypto: add raw vector support in DPAAx Akhil Goyal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 " Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 01/15] crypto: change sgl to src_sgl in vector Hemant Agrawal
2021-09-16 11:38 ` Ananyev, Konstantin
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 02/15] crypto: add total raw buffer length Hemant Agrawal
2021-09-16 11:42 ` Ananyev, Konstantin
2021-09-20 19:28 ` Akhil Goyal
2021-09-21 9:59 ` Hemant Agrawal
2021-09-21 10:04 ` Ananyev, Konstantin
2021-09-24 18:06 ` Akhil Goyal
2021-09-27 9:23 ` Ananyev, Konstantin
2021-09-28 7:05 ` Akhil Goyal
2021-09-28 8:20 ` Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 03/15] crypto: add dest_sgl in raw vector APIs Hemant Agrawal
2021-09-16 11:44 ` Ananyev, Konstantin
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 04/15] crypto: fix raw process for multi-seg case Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 05/15] crypto/dpaa2_sec: support raw datapath APIs Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 06/15] crypto/dpaa2_sec: support AUTH only with raw buffer APIs Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 07/15] crypto/dpaa2_sec: support AUTHENC " Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 08/15] crypto/dpaa2_sec: support AEAD " Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 09/15] crypto/dpaa2_sec: support OOP with raw buffer API Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 10/15] crypto/dpaa2_sec: enhance error checks with raw buffer APIs Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 11/15] crypto/dpaa_sec: support raw datapath APIs Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 12/15] crypto/dpaa_sec: support authonly and chain with raw APIs Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 13/15] crypto/dpaa_sec: support AEAD and proto " Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 14/15] test/crypto: add raw API test for dpaax Hemant Agrawal
2021-09-07 7:59 ` [dpdk-dev] [PATCH v2 15/15] test/crypto: add raw API support in 5G algos Hemant Agrawal
2021-09-15 16:01 ` [dpdk-dev] [PATCH v2 00/15] crypto: add raw vector support in DPAAx Troy, Rebecca
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 " Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 01/15] crypto: change sgl to src_sgl in vector Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 02/15] crypto: add total raw buffer length Hemant Agrawal
2021-10-14 12:39 ` Zhang, Roy Fan
2021-10-17 8:30 ` Hemant Agrawal
2021-10-15 17:45 ` Ananyev, Konstantin
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 03/15] crypto: add dest_sgl in raw vector APIs Hemant Agrawal
2021-10-17 12:21 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 04/15] crypto: fix raw process for multi-seg case Hemant Agrawal
2021-10-15 17:39 ` Ananyev, Konstantin
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 05/15] crypto/dpaa2_sec: support raw datapath APIs Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 06/15] crypto/dpaa2_sec: support AUTH only with raw buffer APIs Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 07/15] crypto/dpaa2_sec: support AUTHENC " Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 08/15] crypto/dpaa2_sec: support AEAD " Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 09/15] crypto/dpaa2_sec: support OOP with raw buffer API Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 10/15] crypto/dpaa2_sec: enhance error checks with raw buffer APIs Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 11/15] crypto/dpaa_sec: support raw datapath APIs Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 12/15] crypto/dpaa_sec: support authonly and chain with raw APIs Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 13/15] crypto/dpaa_sec: support AEAD and proto " Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 14/15] test/crypto: add raw API test for dpaax Hemant Agrawal
2021-10-13 19:00 ` [dpdk-dev] [PATCH v4 15/15] test/crypto: add raw API support in 5G algos Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 00/15] crypto: add raw vector support in DPAAx Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 01/15] crypto: change sgl to src_sgl in vector Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 02/15] crypto: add total raw buffer length Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 03/15] crypto: add dest_sgl in raw vector APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 04/15] crypto: fix raw process for multi-seg case Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 05/15] crypto/dpaa2_sec: support raw datapath APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 06/15] crypto/dpaa2_sec: support AUTH only with raw buffer APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 07/15] crypto/dpaa2_sec: support AUTHENC " Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 08/15] crypto/dpaa2_sec: support AEAD " Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 09/15] crypto/dpaa2_sec: support OOP with raw buffer API Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 10/15] crypto/dpaa2_sec: enhance error checks with raw buffer APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 11/15] crypto/dpaa_sec: support raw datapath APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 12/15] crypto/dpaa_sec: support authonly and chain with raw APIs Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 13/15] crypto/dpaa_sec: support AEAD and proto " Hemant Agrawal
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 14/15] test/crypto: add raw API test for dpaax Hemant Agrawal
2021-10-20 9:08 ` Thomas Monjalon
2021-10-20 9:15 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-20 9:21 ` Thomas Monjalon
2021-10-20 9:32 ` Akhil Goyal
2021-10-20 12:13 ` Thomas Monjalon
2021-10-20 12:25 ` Akhil Goyal
2021-10-20 12:43 ` Zhang, Roy Fan
2021-10-20 13:34 ` Thomas Monjalon
2021-10-17 16:16 ` [dpdk-dev] [PATCH v5 15/15] test/crypto: add raw API support in 5G algos Hemant Agrawal
2021-10-17 17:59 ` [dpdk-dev] [EXT] [PATCH v5 00/15] crypto: add raw vector support in DPAAx Akhil Goyal
2021-10-18 7:33 ` Zhang, Roy Fan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210812071244.28799-7-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=dev@dpdk.org \
--cc=g.singh@nxp.com \
--cc=gakhil@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).