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

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

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 36 ++++++---------------
 drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h   |  9 ------
 2 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 392bf74856..5ccfcbd7a6 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -70,10 +70,9 @@ free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	struct qbman_fle *fle;
 	struct rte_crypto_op *op;
 
-#ifdef RTE_LIB_SECURITY
 	if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
 		return;
-#endif
+
 	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
 	op = (struct rte_crypto_op *)DPAA2_GET_FLE_ADDR((fle - 1));
 	/* free the fle memory */
@@ -83,7 +82,6 @@ free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		rte_free((void *)(fle-1));
 }
 
-#ifdef RTE_LIB_SECURITY
 static inline int
 build_proto_compound_sg_fd(dpaa2_sec_session *sess,
 			   struct rte_crypto_op *op,
@@ -309,7 +307,6 @@ build_proto_fd(dpaa2_sec_session *sess,
 
 	return 0;
 }
-#endif
 
 static inline int
 build_authenc_gcm_sg_fd(dpaa2_sec_session *sess,
@@ -1378,13 +1375,11 @@ build_sec_fd(struct rte_crypto_op *op,
 	int ret = -1;
 	dpaa2_sec_session *sess;
 
-	if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION)
+	if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) {
 		sess = CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session);
-#ifdef RTE_LIB_SECURITY
-	else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION)
+	} else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
 		sess = SECURITY_GET_SESS_PRIV(op->sym->session);
-#endif
-	else {
+	} else {
 		DPAA2_SEC_DP_ERR("Session type invalid\n");
 		return -ENOTSUP;
 	}
@@ -1411,12 +1406,10 @@ build_sec_fd(struct rte_crypto_op *op,
 		case DPAA2_SEC_CIPHER_HASH:
 			ret = build_authenc_sg_fd(sess, op, fd, bpid);
 			break;
-#ifdef RTE_LIB_SECURITY
 		case DPAA2_SEC_IPSEC:
 		case DPAA2_SEC_PDCP:
 			ret = build_proto_compound_sg_fd(sess, op, fd, bpid);
 			break;
-#endif
 		case DPAA2_SEC_HASH_CIPHER:
 		default:
 			DPAA2_SEC_ERR("error: Unsupported session");
@@ -1435,14 +1428,12 @@ build_sec_fd(struct rte_crypto_op *op,
 		case DPAA2_SEC_CIPHER_HASH:
 			ret = build_authenc_fd(sess, op, fd, bpid, qp);
 			break;
-#ifdef RTE_LIB_SECURITY
 		case DPAA2_SEC_IPSEC:
 			ret = build_proto_fd(sess, op, fd, bpid, qp);
 			break;
 		case DPAA2_SEC_PDCP:
 			ret = build_proto_compound_fd(sess, op, fd, bpid, qp);
 			break;
-#endif
 		case DPAA2_SEC_HASH_CIPHER:
 		default:
 			DPAA2_SEC_ERR("error: Unsupported session");
@@ -1558,7 +1549,6 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
 	return num_tx;
 }
 
-#ifdef RTE_LIB_SECURITY
 static inline struct rte_crypto_op *
 sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
 {
@@ -1598,7 +1588,6 @@ sec_simple_fd_to_mbuf(const struct qbman_fd *fd)
 
 	return op;
 }
-#endif
 
 static inline struct rte_crypto_op *
 sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
@@ -1607,10 +1596,9 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	struct rte_crypto_op *op;
 	struct rte_mbuf *dst, *src;
 
-#ifdef RTE_LIB_SECURITY
 	if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single)
 		return sec_simple_fd_to_mbuf(fd);
-#endif
+
 	fle = (struct qbman_fle *)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd));
 
 	DPAA2_SEC_DP_DEBUG("FLE addr = %x - %x, offset = %x\n",
@@ -1635,7 +1623,6 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 	} else
 		dst = src;
 
-#ifdef RTE_LIB_SECURITY
 	if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) {
 		uint16_t len = DPAA2_GET_FD_LEN(fd);
 		dst->pkt_len = len;
@@ -1645,7 +1632,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp)
 		}
 		dst->data_len = len;
 	}
-#endif
+
 	DPAA2_SEC_DP_DEBUG("mbuf %p BMAN buf addr %p,"
 		" fdaddr =%" PRIx64 " bpid =%d meta =%d off =%d, len =%d\n",
 		(void *)dst,
@@ -2916,7 +2903,6 @@ dpaa2_sec_set_session_parameters(struct rte_crypto_sym_xform *xform, void *sess)
 	return ret;
 }
 
-#ifdef RTE_LIB_SECURITY
 static int
 dpaa2_sec_ipsec_aead_init(struct rte_crypto_aead_xform *aead_xform,
 			dpaa2_sec_session *session,
@@ -3739,7 +3725,7 @@ dpaa2_sec_security_session_get_size(void *device __rte_unused)
 {
 	return sizeof(dpaa2_sec_session);
 }
-#endif
+
 static int
 dpaa2_sec_sym_session_configure(struct rte_cryptodev *dev __rte_unused,
 		struct rte_crypto_sym_xform *xform,
@@ -4180,7 +4166,6 @@ static struct rte_cryptodev_ops crypto_ops = {
 	.sym_configure_raw_dp_ctx = dpaa2_sec_configure_raw_dp_ctx,
 };
 
-#ifdef RTE_LIB_SECURITY
 static const struct rte_security_capability *
 dpaa2_sec_capabilities_get(void *device __rte_unused)
 {
@@ -4196,7 +4181,6 @@ static const struct rte_security_ops dpaa2_sec_security_ops = {
 	.set_pkt_metadata = NULL,
 	.capabilities_get = dpaa2_sec_capabilities_get
 };
-#endif
 
 static int
 dpaa2_sec_uninit(const struct rte_cryptodev *dev)
@@ -4285,9 +4269,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 	struct dpaa2_sec_dev_private *internals;
 	struct rte_device *dev = cryptodev->device;
 	struct rte_dpaa2_device *dpaa2_dev;
-#ifdef RTE_LIB_SECURITY
 	struct rte_security_ctx *security_instance;
-#endif
 	struct fsl_mc_io *dpseci;
 	uint16_t token;
 	struct dpseci_attr attr;
@@ -4324,7 +4306,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 		DPAA2_SEC_DEBUG("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);
@@ -4334,7 +4316,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev)
 	security_instance->ops = &dpaa2_sec_security_ops;
 	security_instance->sess_cnt = 0;
 	cryptodev->security_ctx = security_instance;
-#endif
+
 	/*Open the rte device via MC and save the handle for further use*/
 	dpseci = (struct fsl_mc_io *)rte_calloc(NULL, 1,
 				sizeof(struct fsl_mc_io), 0);
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
index 63f4c64aab..f84d2caf43 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_priv.h
@@ -8,9 +8,7 @@
 #ifndef _DPAA2_SEC_PMD_PRIVATE_H_
 #define _DPAA2_SEC_PMD_PRIVATE_H_
 
-#ifdef RTE_LIB_SECURITY
 #include <rte_security_driver.h>
-#endif
 
 #define CRYPTODEV_NAME_DPAA2_SEC_PMD	crypto_dpaa2_sec
 /**< NXP DPAA2 - SEC PMD device name */
@@ -152,7 +150,6 @@ struct dpaa2_sec_aead_ctxt {
 	uint8_t auth_cipher_text;       /**< Authenticate/cipher ordering */
 };
 
-#ifdef RTE_LIB_SECURITY
 /*
  * The structure is to be filled by user for PDCP Protocol
  */
@@ -168,7 +165,6 @@ struct dpaa2_pdcp_ctxt {
 	uint32_t hfn;	/*!< Hyper Frame Number */
 	uint32_t hfn_threshold;	/*!< HFN Threashold for key renegotiation */
 };
-#endif
 
 typedef int (*dpaa2_sec_build_fd_t)(
 	void *qp, uint8_t *drv_ctx, struct rte_crypto_vec *data_vec,
@@ -225,9 +221,7 @@ typedef struct dpaa2_sec_session_entry {
 				struct dpaa2_sec_aead_ctxt aead_ctxt;
 			} ext_params;
 		};
-#ifdef RTE_LIB_SECURITY
 		struct dpaa2_pdcp_ctxt pdcp;
-#endif
 	};
 } dpaa2_sec_session;
 
@@ -732,8 +726,6 @@ static const struct rte_cryptodev_capabilities dpaa2_sec_capabilities[] = {
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };
 
-#ifdef RTE_LIB_SECURITY
-
 static const struct rte_cryptodev_capabilities dpaa2_pdcp_capabilities[] = {
 	{	/* SNOW 3G (UIA2) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
@@ -946,7 +938,6 @@ static const struct rte_security_capability dpaa2_sec_security_cap[] = {
 		.action = RTE_SECURITY_ACTION_TYPE_NONE
 	}
 };
-#endif
 /**
  * Checksum
  *
-- 
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 ` Maxime Coquelin [this message]
2023-06-09 15:04   ` [PATCH 3/6] crypto/dpaa2_sec: " 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-4-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).