[v1,1/2] crypto/qat: improve security instance setup

Message ID 20200716153600.66071-2-david.coyle@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: akhil goyal
Headers
Series improve security instance setup |

Checks

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

Commit Message

Coyle, David July 16, 2020, 3:35 p.m. UTC
  This patch makes some minor improvements to the security instance setup
for the QAT SYM PMD. All of this setup code is now in one '#ifdef
RTE_LIBRTE_SECURITY' block. Enabling the RTE_CRYPTODEV_FF_SECURITY
feature for the device is also moved to this block.

Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol")

Signed-off-by: David Coyle <david.coyle@intel.com>
---
 drivers/crypto/qat/qat_sym_pmd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Comments

Fiona Trahe July 17, 2020, 6:20 p.m. UTC | #1
> -----Original Message-----
> From: Coyle, David <david.coyle@intel.com>
> Sent: Thursday, July 16, 2020 4:36 PM
> To: akhil.goyal@nxp.com; Doherty, Declan <declan.doherty@intel.com>; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Trahe, Fiona <fiona.trahe@intel.com>
> Cc: dev@dpdk.org; Ryan, Brendan <brendan.ryan@intel.com>; O'loingsigh, Mairtin
> <mairtin.oloingsigh@intel.com>; Coyle, David <david.coyle@intel.com>
> Subject: [PATCH v1 1/2] crypto/qat: improve security instance setup
> 
> This patch makes some minor improvements to the security instance setup
> for the QAT SYM PMD. All of this setup code is now in one '#ifdef
> RTE_LIBRTE_SECURITY' block. Enabling the RTE_CRYPTODEV_FF_SECURITY
> feature for the device is also moved to this block.
> 
> Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol")
> 
> Signed-off-by: David Coyle <david.coyle@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
  
Akhil Goyal July 18, 2020, 9:36 p.m. UTC | #2
> > This patch makes some minor improvements to the security instance setup
> > for the QAT SYM PMD. All of this setup code is now in one '#ifdef
> > RTE_LIBRTE_SECURITY' block. Enabling the RTE_CRYPTODEV_FF_SECURITY
> > feature for the device is also moved to this block.
> >
> > Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol")
> >
> > Signed-off-by: David Coyle <david.coyle@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>

This patch is applied to dpdk-next-crypto

Please send next version for 2/2 of this series.
  
Akhil Goyal July 18, 2020, 9:40 p.m. UTC | #3
> 
> > > This patch makes some minor improvements to the security instance setup
> > > for the QAT SYM PMD. All of this setup code is now in one '#ifdef
> > > RTE_LIBRTE_SECURITY' block. Enabling the RTE_CRYPTODEV_FF_SECURITY
> > > feature for the device is also moved to this block.
> > >
> > > Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol")
> > >
> > > Signed-off-by: David Coyle <david.coyle@intel.com>
> > Acked-by: Fiona Trahe <fiona.trahe@intel.com>
> 
> This patch is applied to dpdk-next-crypto
> 
> Please send next version for 2/2 of this series.

No this patch is pulled back. I suppose the memory leak is there in this patch also.
  
Coyle, David July 20, 2020, 12:39 p.m. UTC | #4
Hi Akhil,

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Saturday, July 18, 2020 10:41 PM
> > > > This patch makes some minor improvements to the security instance
> > > > setup for the QAT SYM PMD. All of this setup code is now in one
> > > > '#ifdef RTE_LIBRTE_SECURITY' block. Enabling the
> > > > RTE_CRYPTODEV_FF_SECURITY feature for the device is also moved to
> this block.
> > > >
> > > > Fixes: 6f0ef237404b ("crypto/qat: support DOCSIS protocol")
> > > >
> > > > Signed-off-by: David Coyle <david.coyle@intel.com>
> > > Acked-by: Fiona Trahe <fiona.trahe@intel.com>
> >
> > This patch is applied to dpdk-next-crypto
> >
> > Please send next version for 2/2 of this series.
> 
> No this patch is pulled back. I suppose the memory leak is there in this patch
> also.

[DC] Yes, memory leak is here too and is fixed in v2
  

Patch

diff --git a/drivers/crypto/qat/qat_sym_pmd.c b/drivers/crypto/qat/qat_sym_pmd.c
index c7e323cce..7c760f9d2 100644
--- a/drivers/crypto/qat/qat_sym_pmd.c
+++ b/drivers/crypto/qat/qat_sym_pmd.c
@@ -346,10 +346,6 @@  qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 		}
 	}
 
-#ifdef RTE_LIBRTE_SECURITY
-	struct rte_security_ctx *security_instance;
-#endif
-
 	snprintf(name, RTE_CRYPTODEV_NAME_MAX_LEN, "%s_%s",
 			qat_pci_dev->name, "sym");
 	QAT_LOG(DEBUG, "Creating QAT SYM device %s", name);
@@ -381,8 +377,7 @@  qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 			RTE_CRYPTODEV_FF_OOP_SGL_IN_LB_OUT |
 			RTE_CRYPTODEV_FF_OOP_LB_IN_SGL_OUT |
 			RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT |
-			RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED |
-			RTE_CRYPTODEV_FF_SECURITY;
+			RTE_CRYPTODEV_FF_DIGEST_ENCRYPTED;
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
@@ -392,6 +387,7 @@  qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 			qat_pci_dev->qat_dev_gen);
 
 #ifdef RTE_LIBRTE_SECURITY
+	struct rte_security_ctx *security_instance;
 	security_instance = rte_malloc("qat_sec",
 				sizeof(struct rte_security_ctx),
 				RTE_CACHE_LINE_SIZE);
@@ -405,6 +401,7 @@  qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 	security_instance->ops = &security_qat_ops;
 	security_instance->sess_cnt = 0;
 	cryptodev->security_ctx = security_instance;
+	cryptodev->feature_flags |= RTE_CRYPTODEV_FF_SECURITY;
 #endif
 
 	internals = cryptodev->data->dev_private;