From patchwork Fri Jun 9 13:54:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 128468 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71E7D42C6E; Fri, 9 Jun 2023 15:55:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C36E042FA0; Fri, 9 Jun 2023 15:55:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4F00442F86 for ; Fri, 9 Jun 2023 15:55:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686318907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MfAgxvOmLtHarZcX8481yEqlgs8MIebAbWTBj1k7OpY=; b=ddudBgavNUXeuZwdP6e4BOCTNcFbwu52uWrU/zzH8YvKR/Bp01QKsJF1BM64AqruqaHsBT hvEHlE/g3lxydz0pd48VzvGgT3itjh7AafiyqGLfuZ5qzafgV0z6zYDsAjTdAti2cwzziL 3K8mF7IPlt0cbsQbGur6TFqQJEGNmsk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-576-RAh24QqRPd2dioucr_GfoA-1; Fri, 09 Jun 2023 09:55:04 -0400 X-MC-Unique: RAh24QqRPd2dioucr_GfoA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 106E48007D9; Fri, 9 Jun 2023 13:55:04 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C58B140E956; Fri, 9 Jun 2023 13:55:02 +0000 (UTC) From: Maxime Coquelin 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 Subject: [PATCH 3/6] crypto/dpaa2_sec: remove security lib presence checks Date: Fri, 9 Jun 2023 15:54:47 +0200 Message-Id: <20230609135450.476983-4-maxime.coquelin@redhat.com> In-Reply-To: <20230609135450.476983-1-maxime.coquelin@redhat.com> References: <20230609135450.476983-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 Acked-by: Hemant Agrawal --- 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 -#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 *