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 D58EAA0560; Tue, 18 Oct 2022 18:44:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C46DF42BB9; Tue, 18 Oct 2022 18:43:08 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 1B4CD4281E for ; Tue, 18 Oct 2022 18:42:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666111377; x=1697647377; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OVTyyLqgxNkb/jRlrUoqzvwni9fxozFng/bfnrWWetk=; b=PiY+c69ymtqEG7v7cUPSdLzEhSyI0e4yD0AD2aCn+xS1E+IEwvo+uuTG 6mDyXPlrCPv5th+ISc9/sQtUQzIO1gKxLkjv5e7C1jftUVcxWn2BwmNtr jLdv1s7NNPjfbcQE+/ZQxNOHC10p9sAmzuWs6MBLiaGuoUf8WnOcOYrox PVYzQc5hRm4OtQZ/Jvio6EfCNvrTtCFNiyTXJ1z8HOUaJGTdqpo+URvH8 ezu1Zy42vPGgB58NQg4HMaVPxQ3xIrL1uVnib6fLUIYW40z9F2FBQDbEG ONi0CvEpLz1QQo1g34DGskWU5lz4/ywscnSSMux//YADD2pFpeWl+eqUc g==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="368192100" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="368192100" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 09:42:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="803836098" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="803836098" Received: from unknown (HELO csl-npg-qt0.la.intel.com) ([10.233.181.103]) by orsmga005.jf.intel.com with ESMTP; 18 Oct 2022 09:42:56 -0700 From: Hernan Vargas To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com, maxime.coquelin@redhat.com Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com, Hernan Vargas Subject: [PATCH v4 18/30] baseband/acc100: enable input validation by default Date: Tue, 18 Oct 2022 17:39:06 -0700 Message-Id: <20221019003918.257506-19-hernan.vargas@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20221019003918.257506-1-hernan.vargas@intel.com> References: <20221019003918.257506-1-hernan.vargas@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Enable validation functions by default and provide a new flag RTE_LIBRTE_SKIP_VALIDATE if the user wants to run without validating input to save cycles. Signed-off-by: Hernan Vargas Reviewed-by: Maxime Coquelin --- drivers/baseband/acc/rte_acc100_pmd.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index d0c98ced32..c75a426d38 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -1800,7 +1800,7 @@ acc100_dma_desc_ld_update(struct rte_bbdev_dec_op *op, desc->op_addr = op; } -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validates turbo encoder parameters */ static inline int validate_enc_op(struct rte_bbdev_enc_op *op, struct acc_queue *q) @@ -2063,10 +2063,10 @@ enqueue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op *op, seg_total_left; struct rte_mbuf *input, *output_head, *output; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_enc_op(op, q) == -1) { - rte_bbdev_log(ERR, "Turbo encoder validation failed"); + rte_bbdev_log(ERR, "Turbo encoder validation rejected"); return -EINVAL; } #endif @@ -2115,10 +2115,10 @@ enqueue_ldpc_enc_n_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ops, uint16_t in_length_in_bytes; struct rte_bbdev_op_ldpc_enc *enc = &ops[0]->ldpc_enc; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_ldpc_enc_op(ops[0], q) == -1) { - rte_bbdev_log(ERR, "LDPC encoder validation failed"); + rte_bbdev_log(ERR, "LDPC encoder validation rejected"); return -EINVAL; } #endif @@ -2175,10 +2175,10 @@ enqueue_ldpc_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op *op, seg_total_left; struct rte_mbuf *input, *output_head, *output; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_ldpc_enc_op(op, q) == -1) { - rte_bbdev_log(ERR, "LDPC encoder validation failed"); + rte_bbdev_log(ERR, "LDPC encoder validation rejected"); return -EINVAL; } #endif @@ -2231,10 +2231,10 @@ enqueue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op *op, uint16_t desc_idx, current_enqueued_cbs = 0; uint64_t fcw_offset; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_enc_op(op, q) == -1) { - rte_bbdev_log(ERR, "Turbo encoder validation failed"); + rte_bbdev_log(ERR, "Turbo encoder validation rejected"); return -EINVAL; } #endif @@ -2305,7 +2305,7 @@ enqueue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op *op, return current_enqueued_cbs; } -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validates turbo decoder parameters */ static inline int validate_dec_op(struct rte_bbdev_dec_op *op, struct acc_queue *q) @@ -2463,10 +2463,10 @@ enqueue_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, struct rte_mbuf *input, *h_output_head, *h_output, *s_output_head, *s_output; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_dec_op(op, q) == -1) { - rte_bbdev_log(ERR, "Turbo decoder validation failed"); + rte_bbdev_log(ERR, "Turbo decoder validation rejected"); return -EINVAL; } #endif @@ -2686,10 +2686,10 @@ enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, return ret; } -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_ldpc_dec_op(op, q) == -1) { - rte_bbdev_log(ERR, "LDPC decoder validation failed"); + rte_bbdev_log(ERR, "LDPC decoder validation rejected"); return -EINVAL; } #endif @@ -2787,10 +2787,10 @@ enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint64_t fcw_offset; union acc_harq_layout_data *harq_layout; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_ldpc_dec_op(op, q) == -1) { - rte_bbdev_log(ERR, "LDPC decoder validation failed"); + rte_bbdev_log(ERR, "LDPC decoder validation rejected"); return -EINVAL; } #endif @@ -2879,10 +2879,10 @@ enqueue_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint16_t desc_idx, current_enqueued_cbs = 0; uint64_t fcw_offset; -#ifdef RTE_LIBRTE_BBDEV_DEBUG +#ifndef RTE_LIBRTE_BBDEV_SKIP_VALIDATE /* Validate op structure */ if (validate_dec_op(op, q) == -1) { - rte_bbdev_log(ERR, "Turbo decoder validation failed"); + rte_bbdev_log(ERR, "Turbo decoder validation rejected"); return -EINVAL; } #endif -- 2.37.1