From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 903ECA0545;
	Wed, 25 May 2022 16:33:36 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 7CB2C4282A;
	Wed, 25 May 2022 16:33:36 +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 9F97740150
 for <dev@dpdk.org>; Wed, 25 May 2022 16:33:35 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1653489215;
 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=eJrHJ3NqOZLO1Ghr9tu+u0SYVtzJd7+Mi8wV6aOaEcg=;
 b=gW3VUo+4g2JaPWBZIgnyVfsaC6B213NEHS9JD3T1thbv4VCn2fIu/NzdTZaD07p7PjU/XO
 wA2kX6crZ0kamNkEbWegpbRuQdNsr+c6PqMK5qSNUlmGrf6dikeX1p5F13rEXMRMTHVF9o
 pa1sBEqll54m00HJenpe2TOu9PMkV7g=
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-320-CGOumzWHN7qX77zMPOEojg-1; Wed, 25 May 2022 10:33:31 -0400
X-MC-Unique: CGOumzWHN7qX77zMPOEojg-1
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com
 [10.11.54.2])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3AF881D32367;
 Wed, 25 May 2022 14:33:28 +0000 (UTC)
Received: from [10.39.208.27] (unknown [10.39.208.27])
 by smtp.corp.redhat.com (Postfix) with ESMTPS id C2FEE400F3E6;
 Wed, 25 May 2022 14:33:26 +0000 (UTC)
Message-ID: <8b807ce3-af2e-4fba-15c3-bc84a5728b3f@redhat.com>
Date: Wed, 25 May 2022 16:33:24 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.9.0
Subject: Re: [PATCH v5 4/5] baseband/acc100: modify validation code for ACC101
To: Nicolas Chautru <nicolas.chautru@intel.com>, dev@dpdk.org,
 gakhil@marvell.com, trix@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
References: <1651083423-33202-1-git-send-email-nicolas.chautru@intel.com>
 <1653350912-53876-1-git-send-email-nicolas.chautru@intel.com>
 <1653350912-53876-5-git-send-email-nicolas.chautru@intel.com>
From: Maxime Coquelin <maxime.coquelin@redhat.com>
In-Reply-To: <1653350912-53876-5-git-send-email-nicolas.chautru@intel.com>
X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Language: en-US
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org



On 5/24/22 02:08, Nicolas Chautru wrote:
> The validation requirement is different for the two
> devices.
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> ---
>   drivers/baseband/acc100/rte_acc100_pmd.c | 47 ++++++++++++++++++++++++--------
>   1 file changed, 35 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
> index 41475b2..e3706e0 100644
> --- a/drivers/baseband/acc100/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc100/rte_acc100_pmd.c
> @@ -1289,6 +1289,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);

I keep insisting, but please rely on the PCI device ID, there is no need
to introduce a new field.

> +}
> +
> +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,
> @@ -2176,8 +2191,10 @@ 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)
>   {
> +	if (!validate_op_required(q))
> +		return 0;
>   	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;
> @@ -2314,8 +2331,10 @@ 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)
>   {
> +	if (!validate_op_required(q))
> +		return 0;
>   	struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc;
>   
>   	if (op->mempool == NULL) {
> @@ -2367,8 +2386,10 @@ 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)
>   {
> +	if (!validate_op_required(q))
> +		return 0;
>   	struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec;
>   
>   	if (op->mempool == NULL) {
> @@ -2423,7 +2444,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;
>   	}
> @@ -2477,7 +2498,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;
>   	}
> @@ -2539,7 +2560,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;
>   	}
> @@ -2596,7 +2617,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;
>   	}
> @@ -2669,8 +2690,10 @@ 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)
>   {
> +	if (!validate_op_required(q))
> +		return 0;
>   	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;
> @@ -2816,7 +2839,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;
>   	}
> @@ -3041,7 +3064,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;
>   	}
> @@ -3145,7 +3168,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;
>   	}
> @@ -3235,7 +3258,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;
>   	}