DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: dev@dpdk.org, kai.ji@intel.com, g.singh@nxp.com,
	hemant.agrawal@nxp.com, pablo.de.lara.guarch@intel.com,
	fanzhang.oss@gmail.com
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 2/6] crypto/qat: remove security lib presence checks
Date: Fri,  9 Jun 2023 15:54:46 +0200	[thread overview]
Message-ID: <20230609135450.476983-3-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20230609135450.476983-1-maxime.coquelin@redhat.com>

Since security library is a required dependency for
building QAT crypto PMD, remove useless #ifdefs around
rte_security APIs calls.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/common/qat/qat_qp.c                  |  2 --
 drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c |  3 ---
 drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c |  2 --
 drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c |  2 --
 drivers/crypto/qat/dev/qat_crypto_pmd_gens.h |  2 --
 drivers/crypto/qat/dev/qat_sym_pmd_gen1.c    |  7 -------
 drivers/crypto/qat/qat_crypto.h              |  2 --
 drivers/crypto/qat/qat_sym.c                 | 15 ++-------------
 drivers/crypto/qat/qat_sym.h                 | 13 +------------
 drivers/crypto/qat/qat_sym_session.c         |  4 ----
 drivers/crypto/qat/qat_sym_session.h         |  4 ----
 11 files changed, 3 insertions(+), 53 deletions(-)

diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c
index 9cbd19a481..82f75124a1 100644
--- a/drivers/common/qat/qat_qp.c
+++ b/drivers/common/qat/qat_qp.c
@@ -599,10 +599,8 @@ qat_enqueue_op_burst(void *qp, qat_op_build_request_t op_build_request,
 		}
 	}
 
-#ifdef RTE_LIB_SECURITY
 	if (tmp_qp->service_type == QAT_SERVICE_SYMMETRIC)
 		qat_sym_preprocess_requests(ops, nb_ops_possible);
-#endif
 
 	memset(tmp_qp->opaque, 0xff, sizeof(tmp_qp->opaque));
 
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c
index 60ca0fc0d2..0fcbbc8b56 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen2.c
@@ -327,11 +327,8 @@ RTE_INIT(qat_sym_crypto_gen2_init)
 			qat_sym_configure_raw_dp_ctx_gen1;
 	qat_sym_gen_dev_ops[QAT_GEN2].get_feature_flags =
 			qat_sym_crypto_feature_flags_get_gen1;
-
-#ifdef RTE_LIB_SECURITY
 	qat_sym_gen_dev_ops[QAT_GEN2].create_security_ctx =
 			qat_sym_create_security_gen1;
-#endif
 }
 
 RTE_INIT(qat_asym_crypto_gen2_init)
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
index 6013fed721..93b1327e22 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c
@@ -732,10 +732,8 @@ RTE_INIT(qat_sym_crypto_gen3_init)
 			qat_sym_crypto_set_session_gen3;
 	qat_sym_gen_dev_ops[QAT_GEN3].set_raw_dp_ctx =
 			qat_sym_configure_raw_dp_ctx_gen3;
-#ifdef RTE_LIB_SECURITY
 	qat_sym_gen_dev_ops[QAT_GEN3].create_security_ctx =
 			qat_sym_create_security_gen1;
-#endif
 }
 
 RTE_INIT(qat_asym_crypto_gen3_init)
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
index b219a418ba..ab87ac2461 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen4.c
@@ -408,10 +408,8 @@ RTE_INIT(qat_sym_crypto_gen4_init)
 			qat_sym_configure_raw_dp_ctx_gen4;
 	qat_sym_gen_dev_ops[QAT_GEN4].get_feature_flags =
 			qat_sym_crypto_feature_flags_get_gen1;
-#ifdef RTE_LIB_SECURITY
 	qat_sym_gen_dev_ops[QAT_GEN4].create_security_ctx =
 			qat_sym_create_security_gen1;
-#endif
 }
 
 RTE_INIT(qat_asym_crypto_gen4_init)
diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
index 524c291340..942f61c63f 100644
--- a/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
+++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gens.h
@@ -938,11 +938,9 @@ qat_asym_crypto_feature_flags_get_gen1(struct qat_pci_device *qat_dev);
 int
 qat_asym_crypto_set_session_gen1(void *cryptodev, void *session);
 
-#ifdef RTE_LIB_SECURITY
 extern struct rte_security_ops security_qat_ops_gen1;
 
 void *
 qat_sym_create_security_gen1(void *cryptodev);
-#endif
 
 #endif
diff --git a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
index 91d5cfa71d..9d9d072991 100644
--- a/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
+++ b/drivers/crypto/qat/dev/qat_sym_pmd_gen1.c
@@ -3,9 +3,7 @@
  */
 
 #include <rte_cryptodev.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 
 #include "adf_transport_access_macros.h"
 #include "icp_qat_fw.h"
@@ -393,8 +391,6 @@ qat_sym_build_op_chain_gen1(void *in_op, struct qat_sym_session *ctx,
 	return 0;
 }
 
-#ifdef RTE_LIB_SECURITY
-
 #define QAT_SECURITY_SYM_CAPABILITIES					\
 	{	/* AES DOCSIS BPI */					\
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,			\
@@ -481,7 +477,6 @@ qat_sym_create_security_gen1(void *cryptodev)
 	return (void *)security_instance;
 }
 
-#endif
 int
 qat_sym_dp_enqueue_single_cipher_gen1(void *qp_data, uint8_t *drv_ctx,
 	struct rte_crypto_vec *data, uint16_t n_data_vecs,
@@ -1248,8 +1243,6 @@ RTE_INIT(qat_sym_crypto_gen1_init)
 			qat_sym_configure_raw_dp_ctx_gen1;
 	qat_sym_gen_dev_ops[QAT_GEN1].get_feature_flags =
 			qat_sym_crypto_feature_flags_get_gen1;
-#ifdef RTE_LIB_SECURITY
 	qat_sym_gen_dev_ops[QAT_GEN1].create_security_ctx =
 			qat_sym_create_security_gen1;
-#endif
 }
diff --git a/drivers/crypto/qat/qat_crypto.h b/drivers/crypto/qat/qat_crypto.h
index 6fe1326c51..14d9870815 100644
--- a/drivers/crypto/qat/qat_crypto.h
+++ b/drivers/crypto/qat/qat_crypto.h
@@ -61,9 +61,7 @@ struct qat_crypto_gen_dev_ops {
 	struct rte_cryptodev_ops *cryptodev_ops;
 	set_session_t set_session;
 	set_raw_dp_ctx_t set_raw_dp_ctx;
-#ifdef RTE_LIB_SECURITY
 	create_security_ctx_t create_security_ctx;
-#endif
 };
 
 extern struct qat_crypto_gen_dev_ops qat_sym_gen_dev_ops[];
diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c
index 2450f042c8..4aea5b217f 100644
--- a/drivers/crypto/qat/qat_sym.c
+++ b/drivers/crypto/qat/qat_sym.c
@@ -97,10 +97,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 			opaque[0] = (uintptr_t)ctx;
 			opaque[1] = (uintptr_t)build_request;
 		}
-	}
-
-#ifdef RTE_LIB_SECURITY
-	else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
+	} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
 		ctx = SECURITY_GET_SESS_PRIV(op->sym->session);
 		if (unlikely(!ctx)) {
 			QAT_DP_LOG(ERR, "No session for this device");
@@ -150,9 +147,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg,
 			opaque[0] = sess;
 			opaque[1] = (uintptr_t)build_request;
 		}
-	}
-#endif
-	else { /* RTE_CRYPTO_OP_SESSIONLESS */
+	} else { /* RTE_CRYPTO_OP_SESSIONLESS */
 		op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS;
 		QAT_LOG(DEBUG, "QAT does not support sessionless operation");
 		return -1;
@@ -250,7 +245,6 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-#ifdef RTE_LIB_SECURITY
 	if (gen_dev_ops->create_security_ctx) {
 		cryptodev->security_ctx =
 			gen_dev_ops->create_security_ctx((void *)cryptodev);
@@ -265,7 +259,6 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 	} else {
 		QAT_LOG(INFO, "Device %s rte_security support disabled", name);
 	}
-#endif
 	snprintf(capa_memz_name, RTE_CRYPTODEV_NAME_MAX_LEN,
 			"QAT_SYM_CAPA_GEN_%d",
 			qat_pci_dev->qat_dev_gen);
@@ -302,10 +295,8 @@ qat_sym_dev_create(struct qat_pci_device *qat_pci_dev,
 	return 0;
 
 error:
-#ifdef RTE_LIB_SECURITY
 	rte_free(cryptodev->security_ctx);
 	cryptodev->security_ctx = NULL;
-#endif
 	rte_cryptodev_pmd_destroy(cryptodev);
 	memset(&qat_dev_instance->sym_rte_dev, 0,
 		sizeof(qat_dev_instance->sym_rte_dev));
@@ -327,10 +318,8 @@ qat_sym_dev_destroy(struct qat_pci_device *qat_pci_dev)
 
 	/* free crypto device */
 	cryptodev = rte_cryptodev_pmd_get_dev(qat_pci_dev->sym_dev->dev_id);
-#ifdef RTE_LIB_SECURITY
 	rte_free(cryptodev->security_ctx);
 	cryptodev->security_ctx = NULL;
-#endif
 	rte_cryptodev_pmd_destroy(cryptodev);
 	qat_pci_devs[qat_pci_dev->qat_dev_id].sym_rte_dev.name = NULL;
 	qat_pci_dev->sym_dev = NULL;
diff --git a/drivers/crypto/qat/qat_sym.h b/drivers/crypto/qat/qat_sym.h
index 9a4251e08b..30faf34b38 100644
--- a/drivers/crypto/qat/qat_sym.h
+++ b/drivers/crypto/qat/qat_sym.h
@@ -6,15 +6,11 @@
 #define _QAT_SYM_H_
 
 #include <cryptodev_pmd.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_net_crc.h>
-#endif
 
 #ifdef BUILD_QAT_SYM
 #include <openssl/evp.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 
 #include "qat_common.h"
 #include "qat_sym_session.h"
@@ -221,7 +217,6 @@ qat_bpicipher_postprocess(struct qat_sym_session *ctx,
 	return sym_op->cipher.data.length - last_block_len;
 }
 
-#ifdef RTE_LIB_SECURITY
 static inline void
 qat_crc_verify(struct qat_sym_session *ctx, struct rte_crypto_op *op)
 {
@@ -286,7 +281,6 @@ qat_sym_preprocess_requests(void **ops, uint16_t nb_ops)
 		}
 	}
 }
-#endif
 
 static __rte_always_inline int
 qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
@@ -304,7 +298,6 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
 			sizeof(struct icp_qat_fw_comn_resp));
 #endif
 
-#ifdef RTE_LIB_SECURITY
 	if (rx_op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
 		/*
 		 * Assuming at this point that if it's a security
@@ -312,9 +305,7 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
 		 */
 		sess = SECURITY_GET_SESS_PRIV(rx_op->sym->session);
 		is_docsis_sec = 1;
-	} else
-#endif
-	{
+	} else {
 		sess = CRYPTODEV_GET_SYM_SESS_PRIV(rx_op->sym->session);
 		is_docsis_sec = 0;
 	}
@@ -329,10 +320,8 @@ qat_sym_process_response(void **op, uint8_t *resp, void *op_cookie,
 
 		if (sess->bpi_ctx) {
 			qat_bpicipher_postprocess(sess, rx_op);
-#ifdef RTE_LIB_SECURITY
 			if (is_docsis_sec)
 				qat_crc_verify(sess, rx_op);
-#endif
 		}
 	}
 
diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c
index 6ad6c7ee3a..29971686ad 100644
--- a/drivers/crypto/qat/qat_sym_session.c
+++ b/drivers/crypto/qat/qat_sym_session.c
@@ -25,9 +25,7 @@
 #include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_crypto_sym.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 
 #include "qat_logs.h"
 #include "qat_sym_session.h"
@@ -2597,7 +2595,6 @@ int qat_sym_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg)
 	return 0;
 }
 
-#ifdef RTE_LIB_SECURITY
 static int
 qat_sec_session_check_docsis(struct rte_security_session_conf *conf)
 {
@@ -2746,4 +2743,3 @@ qat_security_session_get_size(void *device __rte_unused)
 {
 	return sizeof(struct qat_sym_session);
 }
-#endif
diff --git a/drivers/crypto/qat/qat_sym_session.h b/drivers/crypto/qat/qat_sym_session.h
index 6322d7e3bc..baf29e5c64 100644
--- a/drivers/crypto/qat/qat_sym_session.h
+++ b/drivers/crypto/qat/qat_sym_session.h
@@ -6,9 +6,7 @@
 
 #include <rte_crypto.h>
 #include <cryptodev_pmd.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security.h>
-#endif
 
 #include "qat_common.h"
 #include "icp_qat_hw.h"
@@ -174,7 +172,6 @@ qat_cipher_get_block_size(enum icp_qat_hw_cipher_algo qat_cipher_alg);
 int
 qat_sym_validate_zuc_key(int key_len, enum icp_qat_hw_cipher_algo *alg);
 
-#ifdef RTE_LIB_SECURITY
 int
 qat_security_session_create(void *dev, struct rte_security_session_conf *conf,
 		struct rte_security_session *sess);
@@ -182,6 +179,5 @@ int
 qat_security_session_destroy(void *dev, struct rte_security_session *sess);
 unsigned int
 qat_security_session_get_size(void *dev __rte_unused);
-#endif
 
 #endif /* _QAT_SYM_SESSION_H_ */
-- 
2.40.1


  parent reply	other threads:[~2023-06-09 13:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 13:54 [PATCH 0/6] Trivial crypto PMDs cleanup Maxime Coquelin
2023-06-09 13:54 ` [PATCH 1/6] crypto/qat: fix sym device prototype Maxime Coquelin
2023-06-09 14:03   ` Zhang, Fan
2023-06-09 15:40     ` Tyler Retzlaff
2023-06-09 13:54 ` Maxime Coquelin [this message]
2023-06-09 13:54 ` [PATCH 3/6] crypto/dpaa2_sec: remove security lib presence checks Maxime Coquelin
2023-06-09 15:04   ` Hemant Agrawal
2023-06-09 13:54 ` [PATCH 4/6] crypto/dpaa_sec: " Maxime Coquelin
2023-06-09 15:05   ` Hemant Agrawal
2023-06-09 13:54 ` [PATCH 5/6] crypto/ipsec_mb: " Maxime Coquelin
2023-06-09 13:54 ` [PATCH 6/6] crypto/qat: remove useless log level checks Maxime Coquelin
2023-06-09 14:02   ` Zhang, Fan
2023-06-14 18:17 ` [EXT] [PATCH 0/6] Trivial crypto PMDs cleanup Akhil Goyal
2023-06-20  6:49   ` Akhil Goyal
2023-06-20  7:54     ` Maxime Coquelin

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=20230609135450.476983-3-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=fanzhang.oss@gmail.com \
    --cc=g.singh@nxp.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=kai.ji@intel.com \
    --cc=pablo.de.lara.guarch@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).