Skip to contentSkip to conversation

common/qat: option to disable asym driver

PATCH In review Brian Dooley 2 participants 2 messages Dec 21, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/qat: option to disable asym driver

Currently the QAT sym and asym drivers can only be disabled together when building. Add an option to disable the QAT asym driver.

---
 drivers/common/qat/meson.build               | 22 +++++++++++++++++---
 drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c |  2 ++
 drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c |  2 ++
 drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c |  2 ++
 drivers/crypto/qat/qat_crypto.c              |  4 ++++
 5 files changed, 29 insertions(+), 3 deletions(-)
drivers/common/qat/meson.build +19 -3
index 5c36fbb270..2f50302d45 100644
@@ -9,6 +9,8 @@ endif
 
 qat_crypto = true
 qat_crypto_path = 'crypto/qat'
+qat_crypto_asym = true
+qat_crypto_asym_path = 'crypto/qat_asym'
 qat_crypto_relpath = '../../' + qat_crypto_path
 qat_compress = true
 qat_compress_path = 'compress/qat'
@@ -20,6 +22,12 @@ if disable_drivers.contains(qat_crypto_path)
     set_variable(qat_crypto_path.underscorify() + '_disable_reason',
             'Explicitly disabled via build config')
 endif
+if get_option('disable_drivers').contains(qat_crypto_asym_path)
+    qat_crypto_asym = false
+    dpdk_drvs_disabled += qat_crypto_asym_path
+    set_variable(qat_crypto_asym_path.underscorify() + '_disable_reason',
+            'Explicitly disabled via build config')
+endif
 if disable_drivers.contains(qat_compress_path)
     qat_compress = false
     dpdk_drvs_disabled += qat_compress_path
@@ -102,9 +110,8 @@ endif
 
 if qat_crypto
     foreach f: ['qat_sym.c', 'qat_sym_session.c',
-            'qat_asym.c', 'qat_crypto.c',
+            'qat_crypto.c',
             'dev/qat_sym_pmd_gen1.c',
-            'dev/qat_asym_pmd_gen1.c',
             'dev/qat_crypto_pmd_gen2.c',
             'dev/qat_crypto_pmd_gen3.c',
             'dev/qat_crypto_pmd_gen4.c',
@@ -112,5 +119,14 @@ if qat_crypto
         sources += files(join_paths(qat_crypto_relpath, f))
     endforeach
     deps += ['security']
-    cflags += ['-DBUILD_QAT_SYM', '-DBUILD_QAT_ASYM']
+    cflags += ['-DBUILD_QAT_SYM']
+endif
+
+if qat_crypto_asym
+    foreach f: [ 'qat_asym.c', 'dev/qat_asym_pmd_gen1.c', ]
+        sources += files(join_paths(qat_crypto_relpath, f))
+    endforeach
+    deps += ['security']
+    ext_deps += libcrypto
+    cflags += ['-DBUILD_QAT_ASYM']
 endif
drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c +2 -0
index df47767749..523e74f398 100644
@@ -337,6 +337,7 @@ RTE_INIT(qat_sym_crypto_gen2_init)
 			qat_sym_create_security_gen1;
 }
 
+#ifdef BUILD_QAT_ASYM
 RTE_INIT(qat_asym_crypto_gen2_init)
 {
 	qat_asym_gen_dev_ops[QAT_GEN2].cryptodev_ops =
@@ -348,3 +349,4 @@ RTE_INIT(qat_asym_crypto_gen2_init)
 	qat_asym_gen_dev_ops[QAT_GEN2].set_session =
 			qat_asym_crypto_set_session_gen1;
 }
+#endif
drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c +2 -0
index 02bcdb06b1..3fa90bebc9 100644
@@ -773,6 +773,7 @@ RTE_INIT(qat_sym_crypto_gen3_init)
 			qat_sym_create_security_gen1;
 }
 
+#ifdef BUILD_QAT_ASYM
 RTE_INIT(qat_asym_crypto_gen3_init)
 {
 	qat_asym_gen_dev_ops[QAT_GEN3].cryptodev_ops =
@@ -784,3 +785,4 @@ RTE_INIT(qat_asym_crypto_gen3_init)
 	qat_asym_gen_dev_ops[QAT_GEN3].set_session =
 			qat_asym_crypto_set_session_gen1;
 }
+#endif
drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c +2 -0
index de72383d4b..d19db0c2aa 100644
@@ -419,6 +419,7 @@ RTE_INIT(qat_sym_crypto_gen4_init)
 			qat_sym_create_security_gen1;
 }
 
+#ifdef BUILD_QAT_ASYM
 RTE_INIT(qat_asym_crypto_gen4_init)
 {
 	qat_asym_gen_dev_ops[QAT_GEN4].cryptodev_ops =
@@ -430,3 +431,4 @@ RTE_INIT(qat_asym_crypto_gen4_init)
 	qat_asym_gen_dev_ops[QAT_GEN4].set_session =
 			qat_asym_crypto_set_session_gen1;
 }
+#endif
drivers/crypto/qat/qat_crypto.c +4 -0
index 861679373b..57590b0086 100644
@@ -53,8 +53,10 @@ qat_cryptodev_info_get(struct rte_cryptodev *dev,
 			qat_qps_per_service(qat_dev, service_type);
 		info->feature_flags = dev->feature_flags;
 		info->capabilities = qat_private->qat_dev_capabilities;
+#ifdef BUILD_QAT_ASYM
 		if (service_type == QAT_SERVICE_ASYMMETRIC)
 			info->driver_id = qat_asym_driver_id;
+#endif
 
 		if (service_type == QAT_SERVICE_SYMMETRIC)
 			info->driver_id = qat_sym_driver_id;
@@ -168,8 +170,10 @@ qat_cryptodev_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
 	for (i = 0; i < qp->nb_descriptors; i++) {
 		if (service_type == QAT_SERVICE_SYMMETRIC)
 			qat_sym_init_op_cookie(qp->op_cookies[i]);
+#ifdef BUILD_QAT_ASYM
 		else
 			qat_asym_init_op_cookie(qp->op_cookies[i]);
+#endif
 	}
 
 	if (qat_private->cipher_crc_offload_enable) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Brian Dooley

Currently the QAT sym and asym drivers can only be disabled together when building. Add an option to disable the QAT asym driver.

Hi Brian,

Couple of questions that aren't clear to me from this patch:
* why might someone want to do that?
* are there plans to also allow disabling the "sym" part of the driver

This is a non-standard way of disabling part of a driver, so it would need to be documented somewhere, as it's not going to be discovered otherwise by users. The disable_driver option is designed to take filesystem paths, and there isn't a separate path for the asym and sym driver parts.

/Bruce