From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Power, Ciara" <ciara.power@intel.com>,
"Zhang, Roy Fan" <roy.fan.zhang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Ji, Kai" <kai.ji@intel.com>
Subject: RE: [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support
Date: Thu, 15 Sep 2022 11:47:19 +0000 [thread overview]
Message-ID: <DM8PR11MB559130B1E04FBAF1A0ECC97784499@DM8PR11MB5591.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220825142901.898007-4-ciara.power@intel.com>
Hi Ciara,
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Thursday, August 25, 2022 3:29 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> Cc: dev@dpdk.org; Ji, Kai <kai.ji@intel.com>; Power, Ciara
> <ciara.power@intel.com>
> Subject: [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support
>
> The intel-ipsec-mb library supports SGL for GCM and ChaChaPoly algorithms
> using the JOB API.
> This support was added to AESNI_MB PMD previously, but the SGL feature
> flags could not be added due to no SGL support for other algorithms.
>
> This patch adds a workaround SGL approach for other algorithms using the
> JOB API. The segmented input buffers are copied into a linear buffer, which is
> passed as a single job to intel-ipsec-mb.
> The job is processed, and on return, the linear buffer is split into the original
> destination segments.
>
> Existing AESNI_MB testcases are passing with these feature flags added.
>
> Signed-off-by: Ciara Power <ciara.power@intel.com>
>
> ---
> v2:
> - Small improvements when copying segments to linear buffer.
> - Added documentation changes.
> ---
> doc/guides/cryptodevs/aesni_mb.rst | 1 -
> doc/guides/cryptodevs/features/aesni_mb.ini | 4 +
> doc/guides/rel_notes/release_22_11.rst | 4 +
> drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 191 ++++++++++++++++----
> 4 files changed, 166 insertions(+), 34 deletions(-)
>
...
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
...
>
> +static int
> +handle_sgl_linear(IMB_JOB *job, struct rte_crypto_op *op, uint32_t
> dst_offset,
> + struct aesni_mb_session *session)
> +{
> + uint64_t cipher_len, auth_len;
> + uint8_t *src, *linear_buf = NULL;
> + int total_len;
> + int lb_offset = 0;
Suggest using unsigned here (probably uint64_t for total_len, as it gets the value from max between cipher_len and auth_len).
> + struct rte_mbuf *src_seg;
> + uint16_t src_len;
> +
> + if (job->cipher_mode == IMB_CIPHER_SNOW3G_UEA2_BITLEN ||
> + job->cipher_mode ==
> IMB_CIPHER_KASUMI_UEA1_BITLEN)
> + cipher_len = (job->msg_len_to_cipher_in_bits >> 3) +
> + (job->cipher_start_src_offset_in_bits >> 3);
> + else
> + cipher_len = job->msg_len_to_cipher_in_bytes +
> + job->cipher_start_src_offset_in_bytes;
> +
> + if (job->hash_alg == IMB_AUTH_SNOW3G_UIA2_BITLEN ||
> + job->hash_alg == IMB_AUTH_ZUC_EIA3_BITLEN)
> + auth_len = (job->msg_len_to_hash_in_bits >> 3) +
> + job->hash_start_src_offset_in_bytes;
> + else if (job->hash_alg == IMB_AUTH_AES_GMAC)
> + auth_len = job->u.GCM.aad_len_in_bytes;
> + else
> + auth_len = job->msg_len_to_hash_in_bytes +
> + job->hash_start_src_offset_in_bytes;
> +
> + total_len = RTE_MAX(auth_len, cipher_len);
> + linear_buf = rte_zmalloc(NULL, total_len + job-
> >auth_tag_output_len_in_bytes, 0);
> + if (linear_buf == NULL) {
> + IPSEC_MB_LOG(ERR, "Error allocating memory for SGL Linear
> Buffer\n");
> + return -1;
> + }
> +
..
> +static void
> +post_process_sgl_linear(struct rte_crypto_op *op, IMB_JOB *job,
> + struct aesni_mb_session *sess, uint8_t *linear_buf) {
> +
> + int lb_offset = 0;
> + struct rte_mbuf *m_dst = op->sym->m_dst == NULL ?
> + op->sym->m_src : op->sym->m_dst;
> + uint16_t total_len, dst_len;
> + uint64_t cipher_len, auth_len;
> + uint8_t *dst;
> +
> + if (job->cipher_mode == IMB_CIPHER_SNOW3G_UEA2_BITLEN ||
> + job->cipher_mode ==
> IMB_CIPHER_KASUMI_UEA1_BITLEN)
> + cipher_len = (job->msg_len_to_cipher_in_bits >> 3) +
> + (job->cipher_start_src_offset_in_bits >> 3);
> + else
> + cipher_len = job->msg_len_to_cipher_in_bytes +
> + job->cipher_start_src_offset_in_bytes;
> +
> + if (job->hash_alg == IMB_AUTH_SNOW3G_UIA2_BITLEN ||
> + job->hash_alg == IMB_AUTH_ZUC_EIA3_BITLEN)
> + auth_len = (job->msg_len_to_hash_in_bits >> 3) +
> + job->hash_start_src_offset_in_bytes;
> + else if (job->hash_alg == IMB_AUTH_AES_GMAC)
> + auth_len = job->u.GCM.aad_len_in_bytes;
> + else
> + auth_len = job->msg_len_to_hash_in_bytes +
> + job->hash_start_src_offset_in_bytes;
> +
This code above is the same as the code in handle_sgl_linear.
Maybe you can have a separate function and remove duplication.
next prev parent reply other threads:[~2022-09-15 11:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 13:23 [PATCH 0/3] add remaining SGL support to AESNI_MB Ciara Power
2022-08-12 13:23 ` [PATCH 1/3] test/crypto: fix wireless auth digest segment Ciara Power
2022-08-12 13:23 ` [PATCH 2/3] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-08-12 13:23 ` [PATCH 3/3] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-08-25 14:28 ` [PATCH v2 0/5] add remaining SGL support to AESNI_MB Ciara Power
2022-08-25 14:28 ` [PATCH v2 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-08-25 14:28 ` [PATCH v2 2/5] crypto/ipsec_mb: fix sessionless cleanup Ciara Power
2022-09-15 11:38 ` De Lara Guarch, Pablo
2022-09-21 13:02 ` Power, Ciara
2022-08-25 14:28 ` [PATCH v2 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-09-15 11:47 ` De Lara Guarch, Pablo [this message]
2022-08-25 14:29 ` [PATCH v2 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-08-25 14:29 ` [PATCH v2 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-09-21 12:50 ` [PATCH v3 0/5] add remaining SGL support to AESNI_MB Ciara Power
2022-09-21 12:50 ` [PATCH v3 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-09-21 13:32 ` Zhang, Roy Fan
2022-09-21 12:50 ` [PATCH v3 2/5] crypto/ipsec_mb: fix session creation for sessionless Ciara Power
2022-09-21 13:33 ` Zhang, Roy Fan
2022-09-21 12:50 ` [PATCH v3 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-09-21 14:50 ` Zhang, Roy Fan
2022-09-21 12:50 ` [PATCH v3 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-09-21 14:54 ` Zhang, Roy Fan
2022-09-21 12:50 ` [PATCH v3 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-09-21 14:55 ` Zhang, Roy Fan
2022-09-26 8:06 ` [PATCH v3 0/5] add remaining SGL support to AESNI_MB De Lara Guarch, Pablo
2022-10-04 12:55 ` [PATCH v4 " Ciara Power
2022-10-04 12:55 ` [PATCH v4 1/5] test/crypto: fix wireless auth digest segment Ciara Power
2022-10-04 12:55 ` [PATCH v4 2/5] crypto/ipsec_mb: fix session creation for sessionless Ciara Power
2022-10-04 12:55 ` [PATCH v4 3/5] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-10-04 12:55 ` [PATCH v4 4/5] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-10-04 12:55 ` [PATCH v4 5/5] test/crypto: add remaining blockcipher " Ciara Power
2022-10-07 6:53 ` [EXT] [PATCH v4 0/5] add remaining SGL support to AESNI_MB Akhil Goyal
2022-10-07 13:46 ` [PATCH v5 0/4] " Ciara Power
2022-10-07 13:46 ` [PATCH v5 1/4] test/crypto: fix wireless auth digest segment Ciara Power
2022-10-07 13:46 ` [PATCH v5 2/4] crypto/ipsec_mb: add remaining SGL support Ciara Power
2022-10-07 13:46 ` [PATCH v5 3/4] test/crypto: add OOP snow3g SGL tests Ciara Power
2022-10-07 13:46 ` [PATCH v5 4/4] test/crypto: add remaining blockcipher " Ciara Power
2022-10-12 18:22 ` [EXT] [PATCH v5 0/4] add remaining SGL support to AESNI_MB Akhil Goyal
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=DM8PR11MB559130B1E04FBAF1A0ECC97784499@DM8PR11MB5591.namprd11.prod.outlook.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=kai.ji@intel.com \
--cc=roy.fan.zhang@intel.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).