DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID
@ 2023-06-30  8:34 Ciara Power
  2023-07-04 22:30 ` Ji, Kai
  2023-07-05  7:32 ` De Lara Guarch, Pablo
  0 siblings, 2 replies; 4+ messages in thread
From: Ciara Power @ 2023-06-30  8:34 UTC (permalink / raw)
  To: dev; +Cc: kai.ji, Ciara Power, pablo.de.lara.guarch

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.

Fixes: 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")
Cc: pablo.de.lara.guarch@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 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(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index f4322d9af4..555b59621d 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -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));
 
diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
index 4ffbe4b282..3f6cf30c39 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
@@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID
  2023-06-30  8:34 [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID Ciara Power
@ 2023-07-04 22:30 ` Ji, Kai
  2023-07-05  7:32 ` De Lara Guarch, Pablo
  1 sibling, 0 replies; 4+ messages in thread
From: Ji, Kai @ 2023-07-04 22:30 UTC (permalink / raw)
  To: Power, Ciara, dev; +Cc: De Lara Guarch, Pablo

[-- Attachment #1: Type: text/plain, Size: 2776 bytes --]

Acked-by: Kai Ji <kai.ji@intel.com<mailto:kai.ji@intel.com>>
________________________________
From: Power, Ciara <ciara.power@intel.com>
Sent: 30 June 2023 09:34
To: dev@dpdk.org <dev@dpdk.org>
Cc: Ji, Kai <kai.ji@intel.com>; Power, Ciara <ciara.power@intel.com>; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
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.

Fixes: 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")
Cc: pablo.de.lara.guarch@intel.com

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 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(-)

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
index f4322d9af4..555b59621d 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c
@@ -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));

diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
index 4ffbe4b282..3f6cf30c39 100644
--- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
+++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h
@@ -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


[-- Attachment #2: Type: text/html, Size: 4968 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID
  2023-06-30  8:34 [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID Ciara Power
  2023-07-04 22:30 ` Ji, Kai
@ 2023-07-05  7:32 ` De Lara Guarch, Pablo
  2023-07-05 13:29   ` Akhil Goyal
  1 sibling, 1 reply; 4+ messages in thread
From: De Lara Guarch, Pablo @ 2023-07-05  7:32 UTC (permalink / raw)
  To: Power, Ciara, dev; +Cc: Ji, Kai



> -----Original Message-----
> From: Power, Ciara <ciara.power@intel.com>
> Sent: Friday, June 30, 2023 9:35 AM
> To: dev@dpdk.org
> Cc: Ji, Kai <kai.ji@intel.com>; Power, Ciara <ciara.power@intel.com>; De Lara
> Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> 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.
> 
> Fixes: 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")
> Cc: pablo.de.lara.guarch@intel.com
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID
  2023-07-05  7:32 ` De Lara Guarch, Pablo
@ 2023-07-05 13:29   ` Akhil Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2023-07-05 13:29 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Power, Ciara, dev; +Cc: Ji, Kai

> > 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.
> >
> > Fixes: 0fb4834e00af ("crypto/ipsec_mb: set and use session ID")
> > Cc: pablo.de.lara.guarch@intel.com
> >
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> 
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied to dpdk-next-crypto
Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-05 13:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  8:34 [PATCH] drivers/ipsec_mb: fix aesni_mb set session ID Ciara Power
2023-07-04 22:30 ` Ji, Kai
2023-07-05  7:32 ` De Lara Guarch, Pablo
2023-07-05 13:29   ` Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).