From patchwork Fri Jun 9 13:54:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 128469 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 E8FB542C6E; Fri, 9 Jun 2023 15:55:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C50C242FAC; Fri, 9 Jun 2023 15:55:12 +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 77D3542FA6 for ; Fri, 9 Jun 2023 15:55:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686318911; 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=CF9U3V3rfGK2ilEVlVe3eLhtgTgpUSoRVYQhIq2iLsQ=; b=XyDxO9w6TZFVhAlnK7V3ptyZaMQ3krmtzdm0FX7YRhaovELxzF1Kjxyr+kl/c39m9HAnDY MF0VyE9/5gb23scWnYebt5oB6e/RqTDE3+3P0ICSA2Z/w/l1aBG00o51nswZaiLbKnZ53e JVM6fmU20izsjUTrrxmutZpIFuCNJ0A= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-280-Tuz__DEPMrKpy2bBJP__wA-1; Fri, 09 Jun 2023 09:55:06 -0400 X-MC-Unique: Tuz__DEPMrKpy2bBJP__wA-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 C6FED3802147; Fri, 9 Jun 2023 13:55:05 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55865140E956; Fri, 9 Jun 2023 13:55:04 +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 4/6] crypto/dpaa_sec: remove security lib presence checks Date: Fri, 9 Jun 2023 15:54:48 +0200 Message-Id: <20230609135450.476983-5-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 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 Acked-by: Hemant Agrawal --- 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 #include #include -#ifdef RTE_LIB_SECURITY #include -#endif #include #include #include @@ -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 #include #include -#ifdef RTE_LIB_SECURITY #include -#endif /* RTA header files */ #include @@ -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;