Hi Ciara,

> -----Original Message-----
> From: Power, Ciara <ciara.po...@intel.com>
> Sent: Thursday, April 7, 2022 11:31 AM
> To: dev@dpdk.org
> Cc: Zhang, Roy Fan <roy.fan.zh...@intel.com>; Ji, Kai <kai...@intel.com>;
> Power, Ciara <ciara.po...@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.gua...@intel.com>
> Subject: [PATCH 3/3] crypto/ipsec_mb: check SGL support for algorithm
> 
> This patch adds a check when dequeueing ops and processing, SGL support only
> exists for AES-GCM and CHACHA20_POLY1305 algorithms.
> If an SGL op for an unsupported algorithm is being processed, submit a NULL 
> job
> instead.
> 
> Signed-off-by: Ciara Power <ciara.po...@intel.com>
> ---
>  drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> index 606c8a0caf..9b21c14f58 100644
> --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
> @@ -1202,6 +1202,13 @@ set_mb_job_params(IMB_JOB *job, struct
> ipsec_mb_qp *qp,
>       if (op->sym->m_src->nb_segs > 1)
>               sgl = 1;
> 
> +     if (sgl && (session->cipher.mode != IMB_CIPHER_GCM
> +                     && session->cipher.mode !=
> IMB_CIPHER_CHACHA20_POLY1305)) {
> +             op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
> +             IPSEC_MB_LOG(ERR, "Device only supports SGL for AES-GCM or
> CHACHA20_POLY1305 algorithms.");

You can use check for cipher.mode inside the previous if, and avoid checking 
for "sgl" again.


Reply via email to