DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kai Ji <kai.ji@intel.com>
To: dev@dpdk.org
Cc: roy.fan.zhang@intel.com, Kai Ji <kai.ji@intel.com>,
	pablo.de.lara.guarch@intel.com
Subject: [dpdk-dev] [dpdk-dev v1] crypto/aesni_gcm: fix performance issue
Date: Tue, 29 Jun 2021 13:36:02 +0100	[thread overview]
Message-ID: <20210629123602.27702-1-kai.ji@intel.com> (raw)

This patch fixes the aesni_gcm performance issue on systems with AVX512
CPU flag presented but with VAES CPU flag missing, such as Skylake.

Fixes: 81fe96a0cece ("crypto/aesni_gcm: use architecture independent API")
Cc: pablo.de.lara.guarch@intel.com

Signed-off-by: Kai Ji <kai.ji@intel.com>
---
 drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index bc87e44a9d..f8dea484b4 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -842,8 +842,14 @@ aesni_gcm_create(const char *name,
 		init_mb_mgr_avx2(mb_mgr);
 		break;
 	case RTE_AESNI_GCM_AVX512:
-		dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX512;
-		init_mb_mgr_avx512(mb_mgr);
+        if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_VAES)) {
+	        dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX512;
+            init_mb_mgr_avx512(mb_mgr);
+        } else {
+            dev->feature_flags |= RTE_CRYPTODEV_FF_CPU_AVX2;
+            init_mb_mgr_avx2(mb_mgr);
+            vector_mode = RTE_AESNI_GCM_AVX2;
+        }
 		break;
 	default:
 		AESNI_GCM_LOG(ERR, "Unsupported vector mode %u\n", vector_mode);
-- 
2.17.1


             reply	other threads:[~2021-06-29 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29 12:36 Kai Ji [this message]
2021-06-29 15:19 ` [dpdk-dev] [dpdk-dev v2] " Kai Ji
2021-06-29 15:25   ` Zhang, Roy Fan
2021-07-07 13:36     ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210629123602.27702-1-kai.ji@intel.com \
    --to=kai.ji@intel.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=roy.fan.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).