From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 63B9B42C6E; Fri, 9 Jun 2023 15:55:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35DDF42DC6; Fri, 9 Jun 2023 15:55:08 +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 86CC040A84 for ; Fri, 9 Jun 2023 15:55:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686318906; 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=XynGVWx2P9xl/RE8f1jugHUoQPxprrhled3u5VYjFRI=; b=IdhnsSHh3mf82PSuDPbBWiRe0mbGjy2lngQAxGnmd/aUNsvcSBs5nZtaJuZD26aVLaJIrC H99Ac2uyymHZTE5lFpq8+Bc2YleaR/L6Ms1Mv3BCi148CvB+Mi14TJLD0vhUrQ4XVMTSu1 LiCfb+0IA0d1Hs4N/O3jZuDi7g0v5Wc= 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-554-Gw9JE9adMp2wMu1fkcVHLA-1; Fri, 09 Jun 2023 09:55:02 -0400 X-MC-Unique: Gw9JE9adMp2wMu1fkcVHLA-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 4C6E9803791; Fri, 9 Jun 2023 13:55:02 +0000 (UTC) Received: from max-t490s.redhat.com (unknown [10.39.208.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id A482E140E956; Fri, 9 Jun 2023 13:55:00 +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 2/6] crypto/qat: remove security lib presence checks Date: Fri, 9 Jun 2023 15:54:46 +0200 Message-Id: <20230609135450.476983-3-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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 QAT crypto PMD, remove useless #ifdefs around rte_security APIs calls. Signed-off-by: Maxime Coquelin --- 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 -#ifdef RTE_LIB_SECURITY #include -#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 -#ifdef RTE_LIB_SECURITY #include -#endif #ifdef BUILD_QAT_SYM #include -#ifdef RTE_LIB_SECURITY #include -#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 #include #include -#ifdef RTE_LIB_SECURITY #include -#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 #include -#ifdef RTE_LIB_SECURITY #include -#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