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 061B941C5F; Fri, 10 Feb 2023 10:39:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 79CF742670; Fri, 10 Feb 2023 10:39:12 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id BBF9840EE6 for ; Fri, 10 Feb 2023 10:39:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676021950; 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=047y9xz9ixHU9eIfjQn5y+spl3qeecMOWjX+1PkTlI8=; b=VenjvhSMzvEr+nOKuc8RS3JmkPSF181VCoxkvNa78r923uEDeNwq7SOvAXCB1/NT0pY53G KNboTLn/G5HGL7urMFTEjK8hxFPoa31MhoRNKRlCukvMTlO2+tPBVQj4CcqoUjMtssHc+K 0s3u3V5okqipGJIafzIWMOkO9lU35pE= 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-213-NIm0-d2FMOS7uL9rcrZ6kg-1; Fri, 10 Feb 2023 04:39:07 -0500 X-MC-Unique: NIm0-d2FMOS7uL9rcrZ6kg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A4428382C971; Fri, 10 Feb 2023 09:39:06 +0000 (UTC) Received: from [10.39.208.26] (unknown [10.39.208.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9B03175A2; Fri, 10 Feb 2023 09:39:05 +0000 (UTC) Message-ID: Date: Fri, 10 Feb 2023 10:39:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH v1 5/9] baseband/acc: prevent to dequeue more than requested To: Nicolas Chautru , dev@dpdk.org Cc: hernan.vargas@intel.com, stable@dpdk.org References: <20230209221929.265059-1-nicolas.chautru@intel.com> <20230209221929.265059-6-nicolas.chautru@intel.com> From: Maxime Coquelin In-Reply-To: <20230209221929.265059-6-nicolas.chautru@intel.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 2/9/23 23:19, Nicolas Chautru wrote: > Add support for corner-case when more operations are > requested than expected, in the case of encoder muxing > operations. > > Fixes: e640f6cdfa84 ("baseband/acc200: add LDPC processing") > Cc: stable@dpdk.org > > Signed-off-by: Nicolas Chautru > --- > drivers/baseband/acc/rte_vrb_pmd.c | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c > index 8540e3d31c..b251ad25c6 100644 > --- a/drivers/baseband/acc/rte_vrb_pmd.c > +++ b/drivers/baseband/acc/rte_vrb_pmd.c > @@ -2641,7 +2641,8 @@ vrb_enqueue_ldpc_dec(struct rte_bbdev_queue_data *q_data, > /* Dequeue one encode operations from device in CB mode. */ > static inline int > vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, > - uint16_t *dequeued_ops, uint32_t *aq_dequeued, uint16_t *dequeued_descs) > + uint16_t *dequeued_ops, uint32_t *aq_dequeued, uint16_t *dequeued_descs, > + uint16_t max_requested_ops) > { > union acc_dma_desc *desc, atom_desc; > union acc_dma_rsp_desc rsp; > @@ -2654,6 +2655,9 @@ vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, > desc = q->ring_addr + desc_idx; > atom_desc.atom_hdr = __atomic_load_n((uint64_t *)desc, __ATOMIC_RELAXED); > > + if (*dequeued_ops + desc->req.numCBs > max_requested_ops) > + return -1; > + > /* Check fdone bit. */ > if (!(atom_desc.rsp.val & ACC_FDONE)) > return -1; > @@ -2695,7 +2699,7 @@ vrb_dequeue_enc_one_op_cb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, > static inline int > vrb_dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, > uint16_t *dequeued_ops, uint32_t *aq_dequeued, > - uint16_t *dequeued_descs) > + uint16_t *dequeued_descs, uint16_t max_requested_ops) > { > union acc_dma_desc *desc, *last_desc, atom_desc; > union acc_dma_rsp_desc rsp; > @@ -2706,6 +2710,9 @@ vrb_dequeue_enc_one_op_tb(struct acc_queue *q, struct rte_bbdev_enc_op **ref_op, > desc = acc_desc_tail(q, *dequeued_descs); > atom_desc.atom_hdr = __atomic_load_n((uint64_t *)desc, __ATOMIC_RELAXED); > > + if (*dequeued_ops + 1 > max_requested_ops) > + return -1; > + > /* Check fdone bit. */ > if (!(atom_desc.rsp.val & ACC_FDONE)) > return -1; > @@ -2966,25 +2973,23 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data, > > cbm = op->turbo_enc.code_block_mode; > > - for (i = 0; i < num; i++) { > + for (i = 0; i < avail; i++) { > if (cbm == RTE_BBDEV_TRANSPORT_BLOCK) > ret = vrb_dequeue_enc_one_op_tb(q, &ops[dequeued_ops], > &dequeued_ops, &aq_dequeued, > - &dequeued_descs); > + &dequeued_descs, num); > else > ret = vrb_dequeue_enc_one_op_cb(q, &ops[dequeued_ops], > &dequeued_ops, &aq_dequeued, > - &dequeued_descs); > + &dequeued_descs, num); > if (ret < 0) > break; > - if (dequeued_ops >= num) > - break; > } > > q->aq_dequeued += aq_dequeued; > q->sw_ring_tail += dequeued_descs; > > - /* Update enqueue stats */ > + /* Update enqueue stats. */ > q_data->queue_stats.dequeued_count += dequeued_ops; > > return dequeued_ops; > @@ -3010,15 +3015,13 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, > if (cbm == RTE_BBDEV_TRANSPORT_BLOCK) > ret = vrb_dequeue_enc_one_op_tb(q, &ops[dequeued_ops], > &dequeued_ops, &aq_dequeued, > - &dequeued_descs); > + &dequeued_descs, num); > else > ret = vrb_dequeue_enc_one_op_cb(q, &ops[dequeued_ops], > &dequeued_ops, &aq_dequeued, > - &dequeued_descs); > + &dequeued_descs, num); > if (ret < 0) > break; > - if (dequeued_ops >= num) > - break; > } > > q->aq_dequeued += aq_dequeued; Reviewed-by: Maxime Coquelin Thanks, Maxime