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 8B973A054F; Wed, 1 Jun 2022 00:42:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 581A342B7D; Wed, 1 Jun 2022 00:41:36 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 1C8D441143 for ; Wed, 1 Jun 2022 00:41:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654036892; x=1685572892; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=LFHOnStYXqzsPTZmxWgNjYV0UirNg3rrWH3wWJ49T9g=; b=ADwvyghdvb3woJIjD/Fk117gXL3GGZP2oJM3f5zr3wqLQ2OaiVlXOSPe Cr8fYdpzF8vyY5EnCWFq189Fc0nGTWwTHd0QKtrY1NoucOulXwTa8Mmy+ ODRq1E9a8o4TCfpDApGUlJ01VmsFsT1Fj8LziLd8nMb9m+oq1WIE5g8pR JvanK7lM5UCxB/hceEbqfuR7ZqYFNTewfw7Ou9rohHJhTDWb/GgBsxuMt vqoivLzzmiEMN5Jvv6L3ynC81C1qhx+ccvp1DSBaV8iPkrtYFzfcj6aP7 4jrcO9MAG3Hn8nT0f8GZIlEcd5SxwxFVqsIBNrz5ThOUx7GDfvDSoleHB g==; X-IronPort-AV: E=McAfee;i="6400,9594,10364"; a="336063074" X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="336063074" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2022 15:41:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,266,1647327600"; d="scan'208";a="581299847" Received: from skx-5gnr-sc12-4.sc.intel.com ([172.25.69.210]) by fmsmga007.fm.intel.com with ESMTP; 31 May 2022 15:41:28 -0700 From: Nicolas Chautru To: dev@dpdk.org, gakhil@marvell.com, trix@redhat.com, maxime.coquelin@redhat.com Cc: thomas@monjalon.net, ray.kinsella@intel.com, bruce.richardson@intel.com, hemant.agrawal@nxp.com, hernan.vargas@intel.com, david.marchand@redhat.com, Nicolas Chautru Subject: [PATCH v7 5/6] baseband/acc100: modify validation code for ACC101 Date: Tue, 31 May 2022 15:31:46 -0700 Message-Id: <1654036307-182860-6-git-send-email-nicolas.chautru@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1654036307-182860-1-git-send-email-nicolas.chautru@intel.com> References: <1653350912-53876-1-git-send-email-nicolas.chautru@intel.com> <1654036307-182860-1-git-send-email-nicolas.chautru@intel.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 The validation requirement is different for the two devices. Signed-off-by: Nicolas Chautru --- drivers/baseband/acc100/rte_acc100_pmd.c | 51 ++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c index 31046b5..956bd43 100644 --- a/drivers/baseband/acc100/rte_acc100_pmd.c +++ b/drivers/baseband/acc100/rte_acc100_pmd.c @@ -1295,6 +1295,21 @@ RTE_BBDEV_TURBO_HALF_ITERATION_EVEN); } +#ifdef RTE_LIBRTE_BBDEV_DEBUG + +static inline bool +is_acc100(struct acc100_queue *q) +{ + return (q->d->device_variant == ACC100_VARIANT); +} + +static inline bool +validate_op_required(struct acc100_queue *q) +{ + return is_acc100(q); +} +#endif + /* Fill in a frame control word for LDPC decoding. */ static inline void acc100_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_fcw_ld *fcw, @@ -2182,13 +2197,16 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validates turbo encoder parameters */ static inline int -validate_enc_op(struct rte_bbdev_enc_op *op) +validate_enc_op(struct rte_bbdev_enc_op *op, struct acc100_queue *q) { struct rte_bbdev_op_turbo_enc *turbo_enc = &op->turbo_enc; struct rte_bbdev_op_enc_turbo_cb_params *cb = NULL; struct rte_bbdev_op_enc_turbo_tb_params *tb = NULL; uint16_t kw, kw_neg, kw_pos; + if (!validate_op_required(q)) + return 0; + if (op->mempool == NULL) { rte_bbdev_log(ERR, "Invalid mempool pointer"); return -1; @@ -2320,10 +2338,13 @@ static inline uint32_t hq_index(uint32_t offset) } /* Validates LDPC encoder parameters */ static inline int -validate_ldpc_enc_op(struct rte_bbdev_enc_op *op) +validate_ldpc_enc_op(struct rte_bbdev_enc_op *op, struct acc100_queue *q) { struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc; + if (!validate_op_required(q)) + return 0; + if (op->mempool == NULL) { rte_bbdev_log(ERR, "Invalid mempool pointer"); return -1; @@ -2373,10 +2394,13 @@ static inline uint32_t hq_index(uint32_t offset) /* Validates LDPC decoder parameters */ static inline int -validate_ldpc_dec_op(struct rte_bbdev_dec_op *op) +validate_ldpc_dec_op(struct rte_bbdev_dec_op *op, struct acc100_queue *q) { struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec; + if (!validate_op_required(q)) + return 0; + if (op->mempool == NULL) { rte_bbdev_log(ERR, "Invalid mempool pointer"); return -1; @@ -2429,7 +2453,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_enc_op(op) == -1) { + if (validate_enc_op(op, q) == -1) { rte_bbdev_log(ERR, "Turbo encoder validation failed"); return -EINVAL; } @@ -2483,7 +2507,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_ldpc_enc_op(ops[0]) == -1) { + if (validate_ldpc_enc_op(ops[0], q) == -1) { rte_bbdev_log(ERR, "LDPC encoder validation failed"); return -EINVAL; } @@ -2545,7 +2569,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_ldpc_enc_op(op) == -1) { + if (validate_ldpc_enc_op(op, q) == -1) { rte_bbdev_log(ERR, "LDPC encoder validation failed"); return -EINVAL; } @@ -2602,7 +2626,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_enc_op(op) == -1) { + if (validate_enc_op(op, q) == -1) { rte_bbdev_log(ERR, "Turbo encoder validation failed"); return -EINVAL; } @@ -2675,12 +2699,15 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validates turbo decoder parameters */ static inline int -validate_dec_op(struct rte_bbdev_dec_op *op) +validate_dec_op(struct rte_bbdev_dec_op *op, struct acc100_queue *q) { struct rte_bbdev_op_turbo_dec *turbo_dec = &op->turbo_dec; struct rte_bbdev_op_dec_turbo_cb_params *cb = NULL; struct rte_bbdev_op_dec_turbo_tb_params *tb = NULL; + if (!validate_op_required(q)) + return 0; + if (op->mempool == NULL) { rte_bbdev_log(ERR, "Invalid mempool pointer"); return -1; @@ -2822,7 +2849,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_dec_op(op) == -1) { + if (validate_dec_op(op, q) == -1) { rte_bbdev_log(ERR, "Turbo decoder validation failed"); return -EINVAL; } @@ -3047,7 +3074,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_ldpc_dec_op(op) == -1) { + if (validate_ldpc_dec_op(op, q) == -1) { rte_bbdev_log(ERR, "LDPC decoder validation failed"); return -EINVAL; } @@ -3151,7 +3178,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_ldpc_dec_op(op) == -1) { + if (validate_ldpc_dec_op(op, q) == -1) { rte_bbdev_log(ERR, "LDPC decoder validation failed"); return -EINVAL; } @@ -3241,7 +3268,7 @@ static inline uint32_t hq_index(uint32_t offset) #ifdef RTE_LIBRTE_BBDEV_DEBUG /* Validate op structure */ - if (validate_dec_op(op) == -1) { + if (validate_dec_op(op, q) == -1) { rte_bbdev_log(ERR, "Turbo decoder validation failed"); return -EINVAL; } -- 1.8.3.1