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 4/6] crypto/dpaa_sec: remove security lib presence checks
Date: Fri,  9 Jun 2023 15:54:48 +0200	[thread overview]
Message-ID: <20230609135450.476983-5-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20230609135450.476983-1-maxime.coquelin@redhat.com>

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

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/crypto/dpaa_sec/dpaa_sec.c        | 26 ++---------------------
 drivers/crypto/dpaa_sec/dpaa_sec.h        |  9 +-------
 drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c |  6 ------
 3 files changed, 3 insertions(+), 38 deletions(-)

diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index db52683847..7d47c32693 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -15,9 +15,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 #include <rte_cycles.h>
 #include <dev_driver.h>
 #include <rte_io.h>
@@ -237,7 +235,6 @@ static inline int is_decode(dpaa_sec_session *ses)
 	return ses->dir == DIR_DEC;
 }
 
-#ifdef RTE_LIB_SECURITY
 static int
 dpaa_sec_prep_pdcp_cdb(dpaa_sec_session *ses)
 {
@@ -441,7 +438,7 @@ dpaa_sec_prep_ipsec_cdb(dpaa_sec_session *ses)
 	}
 	return shared_desc_len;
 }
-#endif
+
 /* prepare command block of the session */
 static int
 dpaa_sec_prep_cdb(dpaa_sec_session *ses)
@@ -459,14 +456,12 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses)
 	memset(cdb, 0, sizeof(struct sec_cdb));
 
 	switch (ses->ctxt) {
-#ifdef RTE_LIB_SECURITY
 	case DPAA_SEC_IPSEC:
 		shared_desc_len = dpaa_sec_prep_ipsec_cdb(ses);
 		break;
 	case DPAA_SEC_PDCP:
 		shared_desc_len = dpaa_sec_prep_pdcp_cdb(ses);
 		break;
-#endif
 	case DPAA_SEC_CIPHER:
 		alginfo_c.key = (size_t)ses->cipher_key.data;
 		alginfo_c.keylen = ses->cipher_key.length;
@@ -1745,7 +1740,6 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)
 	return cf;
 }
 
-#ifdef RTE_LIB_SECURITY
 static inline struct dpaa_sec_job *
 build_proto(struct rte_crypto_op *op, dpaa_sec_session *ses)
 {
@@ -1877,7 +1871,6 @@ build_proto_sg(struct rte_crypto_op *op, dpaa_sec_session *ses)
 
 	return cf;
 }
-#endif
 
 static uint16_t
 dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
@@ -1924,11 +1917,9 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 			case RTE_CRYPTO_OP_WITH_SESSION:
 				ses = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
 				break;
-#ifdef RTE_LIB_SECURITY
 			case RTE_CRYPTO_OP_SECURITY_SESSION:
 				ses = SECURITY_GET_SESS_PRIV(op->sym->session);
 				break;
-#endif
 			default:
 				DPAA_SEC_DP_ERR(
 					"sessionless crypto op not supported");
@@ -1969,12 +1960,10 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 				  ((op->sym->m_dst == NULL) ||
 				   rte_pktmbuf_is_contiguous(op->sym->m_dst))) {
 				switch (ses->ctxt) {
-#ifdef RTE_LIB_SECURITY
 				case DPAA_SEC_PDCP:
 				case DPAA_SEC_IPSEC:
 					cf = build_proto(op, ses);
 					break;
-#endif
 				case DPAA_SEC_AUTH:
 					cf = build_auth_only(op, ses);
 					break;
@@ -2003,12 +1992,10 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 				}
 			} else {
 				switch (ses->ctxt) {
-#ifdef RTE_LIB_SECURITY
 				case DPAA_SEC_PDCP:
 				case DPAA_SEC_IPSEC:
 					cf = build_proto_sg(op, ses);
 					break;
-#endif
 				case DPAA_SEC_AUTH:
 					cf = build_auth_only_sg(op, ses);
 					break;
@@ -2060,7 +2047,6 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 					((auth_tail_len << 16) | auth_hdr_len);
 			}
 
-#ifdef RTE_LIB_SECURITY
 			/* In case of PDCP, per packet HFN is stored in
 			 * mbuf priv after sym_op.
 			 */
@@ -2073,7 +2059,6 @@ dpaa_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 					ses->pdcp.hfn_ovd_offset)),
 					ses->pdcp.hfn_ovd);
 			}
-#endif
 		}
 send_pkts:
 		loop = 0;
@@ -2715,7 +2700,6 @@ dpaa_sec_sym_session_clear(struct rte_cryptodev *dev,
 	free_session_memory(dev, s);
 }
 
-#ifdef RTE_LIB_SECURITY
 static int
 dpaa_sec_ipsec_aead_init(struct rte_crypto_aead_xform *aead_xform,
 			struct rte_security_ipsec_xform *ipsec_xform,
@@ -3296,7 +3280,6 @@ dpaa_sec_security_session_get_size(void *device __rte_unused)
 	return sizeof(dpaa_sec_session);
 }
 
-#endif
 static int
 dpaa_sec_dev_configure(struct rte_cryptodev *dev __rte_unused,
 		       struct rte_cryptodev_config *config __rte_unused)
@@ -3544,7 +3527,6 @@ static struct rte_cryptodev_ops crypto_ops = {
 	.sym_configure_raw_dp_ctx = dpaa_sec_configure_raw_dp_ctx,
 };
 
-#ifdef RTE_LIB_SECURITY
 static const struct rte_security_capability *
 dpaa_sec_capabilities_get(void *device __rte_unused)
 {
@@ -3560,7 +3542,7 @@ static const struct rte_security_ops dpaa_sec_security_ops = {
 	.set_pkt_metadata = NULL,
 	.capabilities_get = dpaa_sec_capabilities_get
 };
-#endif
+
 static int
 dpaa_sec_uninit(struct rte_cryptodev *dev)
 {
@@ -3620,9 +3602,7 @@ static int
 dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
 {
 	struct dpaa_sec_dev_private *internals;
-#ifdef RTE_LIB_SECURITY
 	struct rte_security_ctx *security_instance;
-#endif
 	struct dpaa_sec_qp *qp;
 	uint32_t i, flags;
 	int ret;
@@ -3683,7 +3663,6 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
 		DPAA_SEC_WARN("Device already init by primary process");
 		return 0;
 	}
-#ifdef RTE_LIB_SECURITY
 	/* Initialize security_ctx only for primary process*/
 	security_instance = rte_malloc("rte_security_instances_ops",
 				sizeof(struct rte_security_ctx), 0);
@@ -3693,7 +3672,6 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev)
 	security_instance->ops = &dpaa_sec_security_ops;
 	security_instance->sess_cnt = 0;
 	cryptodev->security_ctx = security_instance;
-#endif
 	rte_spinlock_init(&internals->lock);
 	for (i = 0; i < internals->max_nb_queue_pairs; i++) {
 		/* init qman fq for queue pair */
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.h b/drivers/crypto/dpaa_sec/dpaa_sec.h
index 8921e3ed89..412a9da942 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.h
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.h
@@ -106,7 +106,7 @@ struct sec_cdb {
 
 	uint32_t sh_desc[DPAA_SEC_MAX_DESC_SIZE];
 };
-#ifdef RTE_LIB_SECURITY
+
 /*!
  * The structure is to be filled by user as a part of
  * dpaa_sec_proto_ctxt for PDCP Protocol
@@ -124,7 +124,6 @@ struct sec_pdcp_ctxt {
 	uint32_t hfn;	/*!< Hyper Frame Number */
 	uint32_t hfn_threshold;	/*!< HFN Threashold for key renegotiation */
 };
-#endif
 
 typedef int (*dpaa_sec_build_fd_t)(
 	void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec,
@@ -153,9 +152,7 @@ typedef struct dpaa_sec_session_entry {
 	enum rte_crypto_cipher_algorithm cipher_alg; /*!< Cipher Algorithm*/
 	enum rte_crypto_auth_algorithm auth_alg; /*!< Authentication Algorithm*/
 	enum rte_crypto_aead_algorithm aead_alg; /*!< AEAD Algorithm*/
-#ifdef RTE_LIB_SECURITY
 	enum rte_security_session_protocol proto_alg; /*!< Security Algorithm*/
-#endif
 	dpaa_sec_build_fd_t build_fd;
 	dpaa_sec_build_raw_dp_fd_t build_raw_dp_fd;
 	union {
@@ -198,9 +195,7 @@ typedef struct dpaa_sec_session_entry {
 			uint8_t auth_cipher_text;
 				/**< Authenticate/cipher ordering */
 		};
-#ifdef RTE_LIB_SECURITY
 		struct sec_pdcp_ctxt pdcp;
-#endif
 	};
 } dpaa_sec_session;
 
@@ -790,7 +785,6 @@ static const struct rte_cryptodev_capabilities dpaa_sec_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-#ifdef RTE_LIB_SECURITY
 static const struct rte_cryptodev_capabilities dpaa_pdcp_capabilities[] = {
 	{	/* SNOW 3G (UIA2) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -1003,7 +997,6 @@ static const struct rte_security_capability dpaa_sec_security_cap[] = {
 		.action = RTE_SECURITY_ACTION_TYPE_NONE
 	}
 };
-#endif
 
 /**
  * Checksum
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
index b7dd8beab2..ce49c4996f 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c
@@ -7,9 +7,7 @@
 #include <cryptodev_pmd.h>
 #include <rte_crypto.h>
 #include <rte_cryptodev.h>
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 
 /* RTA header files */
 #include <desc/algo.h>
@@ -645,7 +643,6 @@ build_dpaa_raw_dp_cipher_fd(uint8_t *drv_ctx,
 	return cf;
 }
 
-#ifdef RTE_LIB_SECURITY
 static inline struct dpaa_sec_job *
 build_dpaa_raw_proto_sg(uint8_t *drv_ctx,
 			struct rte_crypto_sgl *sgl,
@@ -772,7 +769,6 @@ build_dpaa_raw_proto_sg(uint8_t *drv_ctx,
 
 	return cf;
 }
-#endif
 
 static uint32_t
 dpaa_sec_raw_enqueue_burst(void *qp_data, uint8_t *drv_ctx,
@@ -1035,11 +1031,9 @@ dpaa_sec_configure_raw_dp_ctx(struct rte_cryptodev *dev, uint16_t qp_id,
 		sess->build_raw_dp_fd = build_dpaa_raw_dp_chain_fd;
 	else if (sess->ctxt == DPAA_SEC_AEAD)
 		sess->build_raw_dp_fd = build_raw_cipher_auth_gcm_sg;
-#ifdef RTE_LIB_SECURITY
 	else if (sess->ctxt == DPAA_SEC_IPSEC ||
 			sess->ctxt == DPAA_SEC_PDCP)
 		sess->build_raw_dp_fd = build_dpaa_raw_proto_sg;
-#endif
 	else
 		return -ENOTSUP;
 	dp_ctx = (struct dpaa_sec_raw_dp_ctx *)raw_dp_ctx->drv_ctx_data;
-- 
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 ` [PATCH 2/6] crypto/qat: remove security lib presence checks Maxime Coquelin
2023-06-09 13:54 ` [PATCH 3/6] crypto/dpaa2_sec: " Maxime Coquelin
2023-06-09 15:04   ` Hemant Agrawal
2023-06-09 13:54 ` Maxime Coquelin [this message]
2023-06-09 15:05   ` [PATCH 4/6] crypto/dpaa_sec: " 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-5-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).