From: Aakash Sasidharan <asasidharan@marvell.com>
To: Ankur Dwivedi <adwivedi@marvell.com>,
Anoob Joseph <anoobj@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>,
Akhil Goyal <gakhil@marvell.com>
Cc: <jerinj@marvell.com>, <vvelumuri@marvell.com>,
<asasidharan@marvell.com>, <dev@dpdk.org>, <stable@dpdk.org>
Subject: [PATCH v3 10/12] crypto/cnxk: fix aes-gcm zero len input cases
Date: Wed, 26 Jun 2024 16:25:32 +0530 [thread overview]
Message-ID: <20240626105534.1386528-11-asasidharan@marvell.com> (raw)
In-Reply-To: <20240626105534.1386528-1-asasidharan@marvell.com>
For aes-gcm (AEAD) zero length input, sg code path is taken unlike
the digest only cases as AAD is treated as a separate input component.
Fix the zero len case in SG path by avoiding the gather component
only when it is a non AEAD algorithm. Also add sg version check as
the fix only applies to specific model.
Fixes: 4d8166d64988 ("crypto/cnxk: enable digest for zero length input")
Cc: stable@dpdk.org
Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
---
drivers/crypto/cnxk/cnxk_se.h | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index 6374718a82..63dbef4411 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -2468,13 +2468,14 @@ fill_sess_gmac(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)
}
static __rte_always_inline uint32_t
-prepare_iov_from_pkt(struct rte_mbuf *pkt, struct roc_se_iov_ptr *iovec, uint32_t start_offset)
+prepare_iov_from_pkt(struct rte_mbuf *pkt, struct roc_se_iov_ptr *iovec, uint32_t start_offset,
+ const bool is_aead, const bool is_sg_ver2)
{
uint16_t index = 0;
void *seg_data = NULL;
int32_t seg_size = 0;
- if (!pkt || pkt->data_len == 0) {
+ if (!pkt || (is_sg_ver2 && (pkt->data_len == 0) && !is_aead)) {
iovec->buf_cnt = 0;
return 0;
}
@@ -2619,13 +2620,13 @@ fill_sm_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
fc_params.dst_iov = (void *)dst;
/* Store SG I/O in the api for reuse */
- if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0)) {
+ if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2)) {
plt_dp_err("Prepare src iov failed");
ret = -EINVAL;
goto err_exit;
}
- if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) {
+ if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false, is_sg_ver2)) {
plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst);
ret = -EINVAL;
goto err_exit;
@@ -2816,14 +2817,15 @@ fill_fc_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
fc_params.dst_iov = (void *)dst;
/* Store SG I/O in the api for reuse */
- if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0)) {
+ if (prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, is_aead, is_sg_ver2)) {
plt_dp_err("Prepare src iov failed");
ret = -EINVAL;
goto err_exit;
}
if (unlikely(m_dst != NULL)) {
- if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) {
+ if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, is_aead,
+ is_sg_ver2)) {
plt_dp_err("Prepare dst iov failed for "
"m_dst %p",
m_dst);
@@ -2957,13 +2959,15 @@ fill_pdcp_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
fc_params.dst_iov = (void *)dst;
/* Store SG I/O in the api for reuse */
- if (unlikely(prepare_iov_from_pkt(m_src, fc_params.src_iov, 0))) {
+ if (unlikely(
+ prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2))) {
plt_dp_err("Prepare src iov failed");
ret = -EINVAL;
goto err_exit;
}
- if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) {
+ if (unlikely(
+ prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false, is_sg_ver2))) {
plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst);
ret = -EINVAL;
goto err_exit;
@@ -3080,14 +3084,16 @@ fill_pdcp_chain_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
fc_params.dst_iov = (void *)dst;
/* Store SG I/O in the api for reuse */
- if (unlikely(prepare_iov_from_pkt(m_src, fc_params.src_iov, 0))) {
+ if (unlikely(
+ prepare_iov_from_pkt(m_src, fc_params.src_iov, 0, false, is_sg_ver2))) {
plt_dp_err("Could not prepare src iov");
ret = -EINVAL;
goto err_exit;
}
if (unlikely(m_dst != NULL)) {
- if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0))) {
+ if (unlikely(prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0, false,
+ is_sg_ver2))) {
plt_dp_err("Could not prepare m_dst iov %p", m_dst);
ret = -EINVAL;
goto err_exit;
@@ -3306,7 +3312,7 @@ fill_digest_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
params.src_iov = (void *)src;
/*Store SG I/O in the api for reuse */
- if (prepare_iov_from_pkt(m_src, params.src_iov, auth_range_off)) {
+ if (prepare_iov_from_pkt(m_src, params.src_iov, auth_range_off, false, is_sg_ver2)) {
plt_dp_err("Prepare src iov failed");
ret = -EINVAL;
goto free_mdata_and_exit;
--
2.25.1
prev parent reply other threads:[~2024-06-26 11:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240624062401.4143606-1-asasidharan@marvell.com>
[not found] ` <20240626105534.1386528-1-asasidharan@marvell.com>
2024-06-26 10:55 ` [PATCH v3 02/12] crypto/cnxk: update version map file with PMD APIs Aakash Sasidharan
2024-06-26 10:55 ` Aakash Sasidharan [this message]
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=20240626105534.1386528-11-asasidharan@marvell.com \
--to=asasidharan@marvell.com \
--cc=adwivedi@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=ktejasree@marvell.com \
--cc=stable@dpdk.org \
--cc=vvelumuri@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).