[v2] crypto/ipsec_mb: fix jobs array used for burst

Message ID 20230705102530.1127021-1-ciara.power@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [v2] crypto/ipsec_mb: fix jobs array used for burst |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-aarch-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Power, Ciara July 5, 2023, 10:25 a.m. UTC
  The jobs variable was global, which meant it was not thread safe.
This caused a segmentation fault when running the crypto performance
app, using more than one lcore for crypto processing.

Moving this to the dequeue function where it is used fixes the issue.

Fixes: b50b8b5b38f8 ("crypto/ipsec_mb: use burst API in AESNI")
Cc: marcel.d.cornu@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>

---
v2: fixed typo in commit
---
 drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

De Lara Guarch, Pablo July 5, 2023, 12:42 p.m. UTC | #1
> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Wednesday, July 5, 2023 11:26 AM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Power, Ciara <ciara.power@intel.com>;
> Cornu, Marcel D <marcel.d.cornu@intel.com>; Ji, Kai <kai.ji@intel.com>
> Subject: [PATCH v2] crypto/ipsec_mb: fix jobs array used for burst
> 
> The jobs variable was global, which meant it was not thread safe.
> This caused a segmentation fault when running the crypto performance app,
> using more than one lcore for crypto processing.
> 
> Moving this to the dequeue function where it is used fixes the issue.
> 
> Fixes: b50b8b5b38f8 ("crypto/ipsec_mb: use burst API in AESNI")
> Cc: marcel.d.cornu@intel.com
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> Acked-by: Kai Ji <kai.ji@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
  
Akhil Goyal July 5, 2023, 1:51 p.m. UTC | #2
> > Subject: [PATCH v2] crypto/ipsec_mb: fix jobs array used for burst
> >
> > The jobs variable was global, which meant it was not thread safe.
> > This caused a segmentation fault when running the crypto performance app,
> > using more than one lcore for crypto processing.
> >
> > Moving this to the dequeue function where it is used fixes the issue.
> >
> > Fixes: b50b8b5b38f8 ("crypto/ipsec_mb: use burst API in AESNI")
> > Cc: marcel.d.cornu@intel.com
> >
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> > Acked-by: Kai Ji <kai.ji@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied to dpdk-next-crypto

Thanks.
  

Patch

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index f4322d9af4..f702127f7f 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -9,10 +9,6 @@  struct aesni_mb_op_buf_data {
 	uint32_t offset;
 };
 
-#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM
-static IMB_JOB *jobs[IMB_MAX_BURST_SIZE] = {NULL};
-#endif
-
 /**
  * Calculate the authentication pre-computes
  *
@@ -2044,6 +2040,7 @@  aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops,
 	IMB_JOB *job;
 	int retval, processed_jobs = 0;
 	uint16_t i, nb_jobs;
+	IMB_JOB *jobs[IMB_MAX_BURST_SIZE] = {NULL};
 
 	if (unlikely(nb_ops == 0 || mb_mgr == NULL))
 		return 0;