[dpdk-dev,v3] test_cryptodev_perf: IV and digest should be stored at a DMAeble address

Message ID 20161012111629.14126-1-akhil.goyal@nxp.com
State Accepted, archived
Delegated to: Pablo de Lara Guarch
Headers show

Commit Message

Akhil Goyal Oct. 12, 2016, 11:16 a.m.
From: Akhil Goyal <akhil.goyal@nxp.com>

For physical crypto devices, IV and digest are processed by the crypto
device which need the contents to be written on some DMA able address.

So in order to do that, IV and digest are accomodated in the packet.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
v2: patch rebased
v3: fix broken compilation
---
 app/test/test_cryptodev_perf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Trahe, Fiona Oct. 12, 2016, 6:26 p.m. | #1
> -----Original Message-----
> From: akhil.goyal@nxp.com [mailto:akhil.goyal@nxp.com]
> Sent: Wednesday, October 12, 2016 12:16 PM
> To: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>
> Cc: Griffin, John <john.griffin@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Jain, Deepak K <deepak.k.jain@intel.com>;
> dev@dpdk.org; Akhil Goyal <akhil.goyal@nxp.com>
> Subject: [PATCH v3] test_cryptodev_perf: IV and digest should be stored at a
> DMAeble address
> 
> From: Akhil Goyal <akhil.goyal@nxp.com>
> 
> For physical crypto devices, IV and digest are processed by the crypto device
> which need the contents to be written on some DMA able address.
> 
> So in order to do that, IV and digest are accomodated in the packet.
> 
> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> v2: patch rebased
> v3: fix broken compilation
> ---
>  app/test/test_cryptodev_perf.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
> index 4aee9af..d498195 100644
> --- a/app/test/test_cryptodev_perf.c
> +++ b/app/test/test_cryptodev_perf.c
> @@ -2722,9 +2722,12 @@ test_perf_set_crypto_op_aes(struct
> rte_crypto_op *op, struct rte_mbuf *m,
>  	op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH;
> 
>  	/* Cipher Parameters */
> -	op->sym->cipher.iv.data = aes_iv;
> +	op->sym->cipher.iv.data = (uint8_t *)m->buf_addr + m->data_off;
> +	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.length = data_len;
> @@ -2893,7 +2896,9 @@ test_perf_aes_sha(uint8_t dev_id, uint16_t
> queue_id,
>  				rte_pktmbuf_free(mbufs[k]);
>  			return -1;
>  		}
> -
> +		/* Make room for Digest and IV in mbuf */
> +		rte_pktmbuf_append(mbufs[i], digest_length);
> +		rte_pktmbuf_prepend(mbufs[i], AES_CIPHER_IV_LENGTH);
>  	}
> 
> 
> --
> 2.9.3
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
De Lara Guarch, Pablo Oct. 13, 2016, 7:35 p.m. | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Trahe, Fiona
> Sent: Wednesday, October 12, 2016 11:26 AM
> To: akhil.goyal@nxp.com; Kusztal, ArkadiuszX; Doherty, Declan
> Cc: Griffin, John; Jain, Deepak K; dev@dpdk.org; Trahe, Fiona
> Subject: Re: [dpdk-dev] [PATCH v3] test_cryptodev_perf: IV and digest should
> be stored at a DMAeble address
> 
> 
> 
> > -----Original Message-----
> > From: akhil.goyal@nxp.com [mailto:akhil.goyal@nxp.com]
> > Sent: Wednesday, October 12, 2016 12:16 PM
> > To: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>; Doherty, Declan
> > <declan.doherty@intel.com>
> > Cc: Griffin, John <john.griffin@intel.com>; Trahe, Fiona
> > <fiona.trahe@intel.com>; Jain, Deepak K <deepak.k.jain@intel.com>;
> > dev@dpdk.org; Akhil Goyal <akhil.goyal@nxp.com>
> > Subject: [PATCH v3] test_cryptodev_perf: IV and digest should be stored at a
> > DMAeble address
> >
> > From: Akhil Goyal <akhil.goyal@nxp.com>
> >
> > For physical crypto devices, IV and digest are processed by the crypto device
> > which need the contents to be written on some DMA able address.
> >
> > So in order to do that, IV and digest are accomodated in the packet.
> >
> > Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>

Applied to dpdk-next-crypto.
Thanks,

Pablo

Patch

diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c
index 4aee9af..d498195 100644
--- a/app/test/test_cryptodev_perf.c
+++ b/app/test/test_cryptodev_perf.c
@@ -2722,9 +2722,12 @@  test_perf_set_crypto_op_aes(struct rte_crypto_op *op, struct rte_mbuf *m,
 	op->sym->auth.aad.length = AES_CIPHER_IV_LENGTH;
 
 	/* Cipher Parameters */
-	op->sym->cipher.iv.data = aes_iv;
+	op->sym->cipher.iv.data = (uint8_t *)m->buf_addr + m->data_off;
+	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.length = data_len;
@@ -2893,7 +2896,9 @@  test_perf_aes_sha(uint8_t dev_id, uint16_t queue_id,
 				rte_pktmbuf_free(mbufs[k]);
 			return -1;
 		}
-
+		/* Make room for Digest and IV in mbuf */
+		rte_pktmbuf_append(mbufs[i], digest_length);
+		rte_pktmbuf_prepend(mbufs[i], AES_CIPHER_IV_LENGTH);
 	}