[1/3] crypto/qat: improve out-of-place conditional check

Message ID 20200311122608.1262-1-adamx.dybkowski@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/3] crypto/qat: improve out-of-place conditional check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Dybkowski, AdamX March 11, 2020, 12:26 p.m. UTC
  From: Fiona Trahe <fiona.trahe@intel.com>

Improve case where application set m_dst to same as m_src
so really an in-place operation, though would have been treated
as out-of-place. No functional change but this path can now benefit
from DMA alignment.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
---
 drivers/crypto/qat/qat_sym.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
  

Comments

Arkadiusz Kusztal March 11, 2020, 3:45 p.m. UTC | #1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Adam Dybkowski
> Sent: Wednesday, March 11, 2020 1:26 PM
> To: dev@dpdk.org; Trahe, Fiona <fiona.trahe@intel.com>;
> akhil.goyal@nxp.com; Dybkowski, AdamX <adamx.dybkowski@intel.com>
> Subject: [dpdk-dev] [PATCH 1/3] crypto/qat: improve out-of-place
> conditional check
> 
> From: Fiona Trahe <fiona.trahe@intel.com>
> 
> Improve case where application set m_dst to same as m_src so really an in-
> place operation, though would have been treated as out-of-place. No
> functional change but this path can now benefit from DMA alignment.
> 
> Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> ---
>  drivers/crypto/qat/qat_sym.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
> index 5c9904cbf..cecced66d 100644
> 2.17.1
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
  
Akhil Goyal March 25, 2020, 7:06 p.m. UTC | #2
> > From: Fiona Trahe <fiona.trahe@intel.com>
> >
> > Improve case where application set m_dst to same as m_src so really an in-
> > place operation, though would have been treated as out-of-place. No
> > functional change but this path can now benefit from DMA alignment.
> >
> > Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
> > ---
> >  drivers/crypto/qat/qat_sym.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
> > index 5c9904cbf..cecced66d 100644
> > 2.17.1
> Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>

Series applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 5c9904cbf..cecced66d 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -62,7 +62,8 @@  qat_bpicipher_preprocess(struct qat_sym_session *ctx,
 		last_block = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_src,
 				uint8_t *, last_block_offset);
 
-		if (unlikely(sym_op->m_dst != NULL))
+		if (unlikely((sym_op->m_dst != NULL)
+				&& (sym_op->m_dst != sym_op->m_src)))
 			/* out-of-place operation (OOP) */
 			dst = (uint8_t *) rte_pktmbuf_mtod_offset(sym_op->m_dst,
 						uint8_t *, last_block_offset);
@@ -437,7 +438,8 @@  qat_sym_build_request(void *in_op, uint8_t *out_msg,
 	if (unlikely(min_ofs >= rte_pktmbuf_data_len(op->sym->m_src) && do_sgl))
 		min_ofs = 0;
 
-	if (unlikely(op->sym->m_dst != NULL)) {
+	if (unlikely((op->sym->m_dst != NULL) &&
+			(op->sym->m_dst != op->sym->m_src))) {
 		/* Out-of-place operation (OOP)
 		 * Don't align DMA start. DMA the minimum data-set
 		 * so as not to overwrite data in dest buffer
@@ -565,7 +567,7 @@  qat_sym_build_request(void *in_op, uint8_t *out_msg,
 			return ret;
 		}
 
-		if (likely(op->sym->m_dst == NULL))
+		if (in_place)
 			qat_req->comn_mid.dest_data_addr =
 				qat_req->comn_mid.src_data_addr =
 				cookie->qat_sgl_src_phys_addr;