drivers/ipsec_mb: fix aesni_mb set session ID
PATCH 1/1 drivers/ipsec_mb: fix aesni_mb set session ID
In the case of multiprocess, when the same session is being used for both primary and secondary processes, the session ID will be the same. However the pointers are not available to the secondary process, so in this case when the session was created by a different process ID, then copy the template session to the job again.
--- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 8 +++++++- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_aesni_mb.c +7 -1
@@ -2,6 +2,8 @@* Copyright(c) 2015-2021 Intel Corporation */ +#include <unistd.h> +#include "pmd_aesni_mb_priv.h" struct aesni_mb_op_buf_data {
@@ -847,6 +849,7 @@ aesni_mb_session_configure(IMB_MGR *mb_mgr,#if IMB_VERSION (1 ,3 ,0 ) <IMB_VERSION_NUM sess->session_id =imb_set_session (mb_mgr, &sess->template_job); + sess->pid =getpid ();#endif return 0 ;
@@ -1482,7 +1485,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, session->template_job.cipher_mode;#if IMB_VERSION (1 ,3 ,0 ) <IMB_VERSION_NUM - if (job->session_id != session->session_id) +if (session->pid !=getpid ()) { +memcpy (job, &session->template_job,sizeof (IMB_JOB )); +imb_set_session (mb_mgr, job); + } else if (job->session_id != session->session_id)#endif memcpy (job, &session->template_job,sizeof (IMB_JOB ));
drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +2 -0
@@ -854,6 +854,8 @@ struct aesni_mb_session {/*< Template job structure */ uint32_t session_id;/*< IPSec MB session ID */ +pid_t pid; +/*< Process ID that created session */ struct {uint16_t offset; } iv;
Signature · 1 line
2.25.1
________________________________
From: Power, Ciara <[email protected]>
Sent: 30 June 2023 09:34
To: [email protected] <[email protected]>
Cc: Ji, Kai <[email protected]>; Power, Ciara <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID
In the case of multiprocess, when the same session is being used for both primary and secondary processes, the session ID will be the same. However the pointers are not available to the secondary process, so in this case when the session was created by a different process ID, then copy the template session to the job again.
--- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 8 +++++++- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-)
drivers/crypto/ipsec_mb/pmd_aesni_mb.c +7 -1
@@ -2,6 +2,8 @@* Copyright(c) 2015-2021 Intel Corporation */ +#include <unistd.h> +#include "pmd_aesni_mb_priv.h" struct aesni_mb_op_buf_data {
@@ -847,6 +849,7 @@ aesni_mb_session_configure(IMB_MGR *mb_mgr,#if IMB_VERSION (1 ,3 ,0 ) <IMB_VERSION_NUM sess->session_id =imb_set_session (mb_mgr, &sess->template_job); + sess->pid =getpid ();#endif return 0 ;
@@ -1482,7 +1485,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, session->template_job.cipher_mode;#if IMB_VERSION (1 ,3 ,0 ) <IMB_VERSION_NUM - if (job->session_id != session->session_id) +if (session->pid !=getpid ()) { +memcpy (job, &session->template_job,sizeof (IMB_JOB )); +imb_set_session (mb_mgr, job); + } else if (job->session_id != session->session_id)#endif memcpy (job, &session->template_job,sizeof (IMB_JOB ));
drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +2 -0
@@ -854,6 +854,8 @@ struct aesni_mb_session {/*< Template job structure */ uint32_t session_id;/*< IPSec MB session ID */ +pid_t pid; +/*< Process ID that created session */ struct {uint16_t offset; } iv;
--
2.25.1
Quoted 16 lines
-----Original Message-----
From: Power, Ciara <[email protected]>
Sent: Friday, June 30, 2023 9:35 AM
To: [email protected]
Cc: Ji, Kai <[email protected]>; Power, Ciara <[email protected]>; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH]drivers/ipsec_mb: fixaesni_mbset session IDIn the case of multiprocess, when the same session is being used for both primary and secondary processes, the session ID will be the same. However the pointers are not available to the secondary process, so in this case when the session was created by a different process ID, then copy the template session to the job again.
Quoted 4 lines
Fixes 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")Signed-off-by Ciara Power <[email protected]>
Akhil Goyal
AppliedQuoted 8 lines
Quoted 8 lines
Subject: [PATCH]
drivers/ipsec_mb: fixaesni_mbset session IDIn the case of multiprocess, when the same session is being used for both primary and secondary processes, the session ID will be the same. However the pointers are not available to the secondary process, so in this case when the session was created by a different process ID, then copy the template session to the job again.
Quoted 6 lines
Quoted 4 lines
Fixes 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")Signed-off-by Ciara Power <[email protected]>Acked-by Pablo de Lara <[email protected]>
Applied to dpdk-next-crypto
Thanks.