DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
@ 2020-10-29 16:26 Fan Zhang
  2020-10-29 16:30 ` [dpdk-dev] [dpdk-dev v2] " Fan Zhang
  2020-11-02 19:56 ` [dpdk-dev] [PATCH] " Akhil Goyal
  0 siblings, 2 replies; 5+ messages in thread
From: Fan Zhang @ 2020-10-29 16:26 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Fan Zhang

This patch fixes the AESNI-MB PMD CPU crypto process function. Orignally
the function tried to access crypto vector's aad buffer even it is not
needed.

Fixes: 8d928d47a29a ("cryptodev: change crypto symmetric vector structure")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 69 +++++++++++++++-------
 1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index fbbb38af0..53834f9f3 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -1990,33 +1990,62 @@ aesni_mb_cpu_crypto_process_bulk(struct rte_cryptodev *dev,
 		RTE_PER_LCORE(sync_mb_mgr) = mb_mgr;
 	}
 
-	for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+	if (is_aead_algo(s->auth.algo, s->cipher.mode)) {
+		for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+			ret = check_crypto_sgl(sofs, vec->sgl + i);
+			if (ret != 0) {
+				vec->status[i] = ret;
+				continue;
+			}
 
+			buf = vec->sgl[i].vec[0].base;
+			len = vec->sgl[i].vec[0].len;
 
-		ret = check_crypto_sgl(sofs, vec->sgl + i);
-		if (ret != 0) {
-			vec->status[i] = ret;
-			continue;
+			job = IMB_GET_NEXT_JOB(mb_mgr);
+			if (job == NULL) {
+				k += flush_mb_sync_mgr(mb_mgr);
+				job = IMB_GET_NEXT_JOB(mb_mgr);
+				RTE_ASSERT(job != NULL);
+			}
+
+			/* Submit job for processing */
+			set_cpu_mb_job_params(job, s, sofs, buf, len,
+				vec->iv[i].va, vec->aad[i].va, tmp_dgst[i],
+				&vec->status[i]);
+			job = submit_sync_job(mb_mgr);
+			j++;
+
+			/* handle completed jobs */
+			k += handle_completed_sync_jobs(job, mb_mgr);
 		}
+	} else {
+		for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+			ret = check_crypto_sgl(sofs, vec->sgl + i);
+			if (ret != 0) {
+				vec->status[i] = ret;
+				continue;
+			}
 
-		buf = vec->sgl[i].vec[0].base;
-		len = vec->sgl[i].vec[0].len;
+			buf = vec->sgl[i].vec[0].base;
+			len = vec->sgl[i].vec[0].len;
 
-		job = IMB_GET_NEXT_JOB(mb_mgr);
-		if (job == NULL) {
-			k += flush_mb_sync_mgr(mb_mgr);
 			job = IMB_GET_NEXT_JOB(mb_mgr);
-			RTE_ASSERT(job != NULL);
+			if (job == NULL) {
+				k += flush_mb_sync_mgr(mb_mgr);
+				job = IMB_GET_NEXT_JOB(mb_mgr);
+				RTE_ASSERT(job != NULL);
+			}
+
+			/* Submit job for processing */
+			set_cpu_mb_job_params(job, s, sofs, buf, len,
+				vec->iv[i].va, NULL, tmp_dgst[i],
+				&vec->status[i]);
+			job = submit_sync_job(mb_mgr);
+			j++;
+
+			/* handle completed jobs */
+			k += handle_completed_sync_jobs(job, mb_mgr);
 		}
-
-		/* Submit job for processing */
-		set_cpu_mb_job_params(job, s, sofs, buf, len, vec->iv[i].va,
-			vec->aad[i].va, tmp_dgst[i], &vec->status[i]);
-		job = submit_sync_job(mb_mgr);
-		j++;
-
-		/* handle completed jobs */
-		k += handle_completed_sync_jobs(job, mb_mgr);
 	}
 
 	/* flush remaining jobs */
-- 
2.26.2


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

* [dpdk-dev] [dpdk-dev v2] crypto/aesni_mb: fix cpu crypto cipher auth
  2020-10-29 16:26 [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth Fan Zhang
@ 2020-10-29 16:30 ` Fan Zhang
  2020-11-02 19:56 ` [dpdk-dev] [PATCH] " Akhil Goyal
  1 sibling, 0 replies; 5+ messages in thread
From: Fan Zhang @ 2020-10-29 16:30 UTC (permalink / raw)
  To: dev; +Cc: akhil.goyal, Fan Zhang

This patch fixes the AESNI-MB PMD CPU crypto process function. Originally
the function tried to access crypto vector's aad buffer even it is not
needed.

Fixes: 8d928d47a29a ("cryptodev: change crypto symmetric vector structure")
Cc: roy.fan.zhang@intel.com

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
V2:
- fix typo.

 drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 69 +++++++++++++++-------
 1 file changed, 49 insertions(+), 20 deletions(-)

diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
index fbbb38af0..53834f9f3 100644
--- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
+++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c
@@ -1990,33 +1990,62 @@ aesni_mb_cpu_crypto_process_bulk(struct rte_cryptodev *dev,
 		RTE_PER_LCORE(sync_mb_mgr) = mb_mgr;
 	}
 
-	for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+	if (is_aead_algo(s->auth.algo, s->cipher.mode)) {
+		for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+			ret = check_crypto_sgl(sofs, vec->sgl + i);
+			if (ret != 0) {
+				vec->status[i] = ret;
+				continue;
+			}
 
+			buf = vec->sgl[i].vec[0].base;
+			len = vec->sgl[i].vec[0].len;
 
-		ret = check_crypto_sgl(sofs, vec->sgl + i);
-		if (ret != 0) {
-			vec->status[i] = ret;
-			continue;
+			job = IMB_GET_NEXT_JOB(mb_mgr);
+			if (job == NULL) {
+				k += flush_mb_sync_mgr(mb_mgr);
+				job = IMB_GET_NEXT_JOB(mb_mgr);
+				RTE_ASSERT(job != NULL);
+			}
+
+			/* Submit job for processing */
+			set_cpu_mb_job_params(job, s, sofs, buf, len,
+				vec->iv[i].va, vec->aad[i].va, tmp_dgst[i],
+				&vec->status[i]);
+			job = submit_sync_job(mb_mgr);
+			j++;
+
+			/* handle completed jobs */
+			k += handle_completed_sync_jobs(job, mb_mgr);
 		}
+	} else {
+		for (i = 0, j = 0, k = 0; i != vec->num; i++) {
+			ret = check_crypto_sgl(sofs, vec->sgl + i);
+			if (ret != 0) {
+				vec->status[i] = ret;
+				continue;
+			}
 
-		buf = vec->sgl[i].vec[0].base;
-		len = vec->sgl[i].vec[0].len;
+			buf = vec->sgl[i].vec[0].base;
+			len = vec->sgl[i].vec[0].len;
 
-		job = IMB_GET_NEXT_JOB(mb_mgr);
-		if (job == NULL) {
-			k += flush_mb_sync_mgr(mb_mgr);
 			job = IMB_GET_NEXT_JOB(mb_mgr);
-			RTE_ASSERT(job != NULL);
+			if (job == NULL) {
+				k += flush_mb_sync_mgr(mb_mgr);
+				job = IMB_GET_NEXT_JOB(mb_mgr);
+				RTE_ASSERT(job != NULL);
+			}
+
+			/* Submit job for processing */
+			set_cpu_mb_job_params(job, s, sofs, buf, len,
+				vec->iv[i].va, NULL, tmp_dgst[i],
+				&vec->status[i]);
+			job = submit_sync_job(mb_mgr);
+			j++;
+
+			/* handle completed jobs */
+			k += handle_completed_sync_jobs(job, mb_mgr);
 		}
-
-		/* Submit job for processing */
-		set_cpu_mb_job_params(job, s, sofs, buf, len, vec->iv[i].va,
-			vec->aad[i].va, tmp_dgst[i], &vec->status[i]);
-		job = submit_sync_job(mb_mgr);
-		j++;
-
-		/* handle completed jobs */
-		k += handle_completed_sync_jobs(job, mb_mgr);
 	}
 
 	/* flush remaining jobs */
-- 
2.26.2


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

* Re: [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
  2020-10-29 16:26 [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth Fan Zhang
  2020-10-29 16:30 ` [dpdk-dev] [dpdk-dev v2] " Fan Zhang
@ 2020-11-02 19:56 ` Akhil Goyal
  2020-11-03 11:31   ` Zhang, Roy Fan
  2020-11-03 12:24   ` Zhang, Roy Fan
  1 sibling, 2 replies; 5+ messages in thread
From: Akhil Goyal @ 2020-11-02 19:56 UTC (permalink / raw)
  To: Fan Zhang, dev

Hi Fan,
> Subject: [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
> 
> This patch fixes the AESNI-MB PMD CPU crypto process function. Orignally
> the function tried to access crypto vector's aad buffer even it is not
> needed.
> 
> Fixes: 8d928d47a29a ("cryptodev: change crypto symmetric vector structure")
> Cc: roy.fan.zhang@intel.com
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>

This patch need a rebase as it is conflicting with the recently added patch
From pablo.

Regards,
Akhil


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

* Re: [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
  2020-11-02 19:56 ` [dpdk-dev] [PATCH] " Akhil Goyal
@ 2020-11-03 11:31   ` Zhang, Roy Fan
  2020-11-03 12:24   ` Zhang, Roy Fan
  1 sibling, 0 replies; 5+ messages in thread
From: Zhang, Roy Fan @ 2020-11-03 11:31 UTC (permalink / raw)
  To: Akhil Goyal, dev

Hi Akhil,

Thanks. Will do.

Regards,
Fan

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Monday, November 2, 2020 7:57 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
> 
> Hi Fan,
> > Subject: [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
> >
> > This patch fixes the AESNI-MB PMD CPU crypto process function. Orignally
> > the function tried to access crypto vector's aad buffer even it is not
> > needed.
> >
> > Fixes: 8d928d47a29a ("cryptodev: change crypto symmetric vector
> structure")
> > Cc: roy.fan.zhang@intel.com
> >
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> 
> This patch need a rebase as it is conflicting with the recently added patch
> From pablo.
> 
> Regards,
> Akhil


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

* Re: [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
  2020-11-02 19:56 ` [dpdk-dev] [PATCH] " Akhil Goyal
  2020-11-03 11:31   ` Zhang, Roy Fan
@ 2020-11-03 12:24   ` Zhang, Roy Fan
  1 sibling, 0 replies; 5+ messages in thread
From: Zhang, Roy Fan @ 2020-11-03 12:24 UTC (permalink / raw)
  To: Akhil Goyal, dev

Hi Akhil,

Pablo's patch actually fixed the problem I was trying to fix. I rejected this patch.

Regards,
Fan

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Monday, November 2, 2020 7:57 PM
> To: Zhang, Roy Fan <roy.fan.zhang@intel.com>; dev@dpdk.org
> Subject: RE: [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
> 
> Hi Fan,
> > Subject: [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth
> >
> > This patch fixes the AESNI-MB PMD CPU crypto process function. Orignally
> > the function tried to access crypto vector's aad buffer even it is not
> > needed.
> >
> > Fixes: 8d928d47a29a ("cryptodev: change crypto symmetric vector
> structure")
> > Cc: roy.fan.zhang@intel.com
> >
> > Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> 
> This patch need a rebase as it is conflicting with the recently added patch
> From pablo.
> 
> Regards,
> Akhil


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

end of thread, other threads:[~2020-11-03 12:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 16:26 [dpdk-dev] [PATCH] crypto/aesni_mb: fix cpu crypto cipher auth Fan Zhang
2020-10-29 16:30 ` [dpdk-dev] [dpdk-dev v2] " Fan Zhang
2020-11-02 19:56 ` [dpdk-dev] [PATCH] " Akhil Goyal
2020-11-03 11:31   ` Zhang, Roy Fan
2020-11-03 12:24   ` Zhang, Roy Fan

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git