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 26406A00C5; Wed, 14 Sep 2022 22:09:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9FA04021D; Wed, 14 Sep 2022 22:09:42 +0200 (CEST) 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 7695C40156 for ; Wed, 14 Sep 2022 22:09:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663186180; 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=9H1UQvznitGg9h99nG1OepyvSNm2NsZjr9JIoVrK6b0=; b=QecwkWzcUOgmTflhgYmcUhCCXu8pJ3ZtiYuz87Z7iKjLOoEyuEwdgyblHZUX19hO05GXOL /8D2xBj5xO0Bi806AlWgdp2i1irmocJcuMx5xle4ZsmUWrHduMWPS3ZyaFVuVdvjEugT5P N6imMEw5jr2HsuE+p/51HoW0dag0fOY= 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-327-Onp9pjN1OqSUbI6AFUY-1Q-1; Wed, 14 Sep 2022 16:09:38 -0400 X-MC-Unique: Onp9pjN1OqSUbI6AFUY-1Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76074855424; Wed, 14 Sep 2022 20:09:37 +0000 (UTC) Received: from [10.39.208.12] (unknown [10.39.208.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 204FB492B04; Wed, 14 Sep 2022 20:09:35 +0000 (UTC) Message-ID: Date: Wed, 14 Sep 2022 22:09:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Hernan Vargas , dev@dpdk.org, gakhil@marvell.com, trix@redhat.com Cc: nicolas.chautru@intel.com, qi.z.zhang@intel.com References: <20220820023157.189047-1-hernan.vargas@intel.com> <20220820023157.189047-9-hernan.vargas@intel.com> From: Maxime Coquelin Subject: Re: [PATCH v2 08/37] baseband/acc100: add scatter-gather support In-Reply-To: <20220820023157.189047-9-hernan.vargas@intel.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 8/20/22 04:31, Hernan Vargas wrote: > Add flag to support scatter-gather for the mbuf > > Signed-off-by: Hernan Vargas > --- > drivers/baseband/acc100/rte_acc100_pmd.c | 45 ++++++++++++++++-------- > 1 file changed, 31 insertions(+), 14 deletions(-) > > diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c > index 4849d822d1..a7e0df96e8 100644 > --- a/drivers/baseband/acc100/rte_acc100_pmd.c > +++ b/drivers/baseband/acc100/rte_acc100_pmd.c > @@ -1585,6 +1585,8 @@ acc101_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_fcw_ld *fcw, > * Store information about device capabilities > * @param next_triplet > * Index for ACC100 DMA Descriptor triplet > + * @param scattergather > + * Flag to support scatter-gather for the mbuf > * > * @return > * Returns index of next triplet on success, other value if lengths of > @@ -1594,12 +1596,17 @@ acc101_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc100_fcw_ld *fcw, > static inline int > acc100_dma_fill_blk_type_in(struct acc100_dma_req_desc *desc, > struct rte_mbuf **input, uint32_t *offset, uint32_t cb_len, > - uint32_t *seg_total_left, int next_triplet) > + uint32_t *seg_total_left, int next_triplet, > + bool scattergather) > { > uint32_t part_len; > struct rte_mbuf *m = *input; > > - part_len = (*seg_total_left < cb_len) ? *seg_total_left : cb_len; > + if (scattergather) > + part_len = (*seg_total_left < cb_len) ? > + *seg_total_left : cb_len; > + else > + part_len = cb_len; > cb_len -= part_len; > *seg_total_left -= part_len; > > @@ -1735,7 +1742,9 @@ acc100_dma_desc_te_fill(struct rte_bbdev_enc_op *op, > } > > next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, > - length, seg_total_left, next_triplet); > + length, seg_total_left, next_triplet, > + check_bit(op->turbo_enc.op_flags, > + RTE_BBDEV_TURBO_ENC_SCATTER_GATHER)); > if (unlikely(next_triplet < 0)) { > rte_bbdev_log(ERR, > "Mismatch between data to process and mbuf data length in bbdev_op: %p", > @@ -1812,7 +1821,7 @@ acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op, > } > > next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, > - pad_le_in(in_length_in_bytes, q), seg_total_left, next_triplet); > + pad_le_in(in_length_in_bytes, q), seg_total_left, next_triplet, false); > if (unlikely(next_triplet < 0)) { > rte_bbdev_log(ERR, > "Mismatch between data to process and mbuf data length in bbdev_op: %p", > @@ -1900,7 +1909,9 @@ acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op, > } > > next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, kw, > - seg_total_left, next_triplet); > + seg_total_left, next_triplet, > + check_bit(op->turbo_dec.op_flags, > + RTE_BBDEV_TURBO_DEC_SCATTER_GATHER)); > if (unlikely(next_triplet < 0)) { > rte_bbdev_log(ERR, > "Mismatch between data to process and mbuf data length in bbdev_op: %p", > @@ -2002,7 +2013,9 @@ acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op, > > next_triplet = acc100_dma_fill_blk_type_in(desc, input, > in_offset, input_length, > - seg_total_left, next_triplet); > + seg_total_left, next_triplet, > + check_bit(op->ldpc_dec.op_flags, > + RTE_BBDEV_LDPC_DEC_SCATTER_GATHER)); > > if (unlikely(next_triplet < 0)) { > rte_bbdev_log(ERR, > @@ -3142,8 +3155,9 @@ enqueue_ldpc_dec_one_op_cb(struct acc100_queue *q, struct rte_bbdev_dec_op *op, > fcw = &desc->req.fcw_ld; > q->d->fcw_ld_fill(op, fcw, harq_layout); > > - /* Special handling when overusing mbuf */ > - if (fcw->rm_e < ACC100_MAX_E_MBUF) > + /* Special handling when using mbuf or not */ > + if (check_bit(op->ldpc_dec.op_flags, > + RTE_BBDEV_LDPC_DEC_SCATTER_GATHER)) > seg_total_left = rte_pktmbuf_data_len(input) > - in_offset; > else > @@ -3219,9 +3233,12 @@ enqueue_ldpc_dec_one_op_tb(struct acc100_queue *q, struct rte_bbdev_dec_op *op, > r = op->ldpc_dec.tb_params.r; > > while (mbuf_total_left > 0 && r < c) { > - > - seg_total_left = rte_pktmbuf_data_len(input) - in_offset; > - > + if (check_bit(op->ldpc_dec.op_flags, > + RTE_BBDEV_LDPC_DEC_SCATTER_GATHER)) > + seg_total_left = rte_pktmbuf_data_len(input) > + - in_offset; > + else > + seg_total_left = op->ldpc_dec.input.length; > /* Set up DMA descriptor */ > desc = q->ring_addr + ((q->sw_ring_head + total_enqueued_cbs) > & q->sw_ring_wrap_mask); > @@ -3246,8 +3263,9 @@ enqueue_ldpc_dec_one_op_tb(struct acc100_queue *q, struct rte_bbdev_dec_op *op, > sizeof(desc->req.fcw_td) - 8); > rte_memdump(stderr, "Req Desc.", desc, sizeof(*desc)); > #endif > - > - if (seg_total_left == 0) { > + if (check_bit(op->ldpc_dec.op_flags, > + RTE_BBDEV_LDPC_DEC_SCATTER_GATHER) > + && (seg_total_left == 0)) { > /* Go to the next mbuf */ > input = input->next; > in_offset = 0; > @@ -3258,7 +3276,6 @@ enqueue_ldpc_dec_one_op_tb(struct acc100_queue *q, struct rte_bbdev_dec_op *op, > current_enqueued_cbs++; > r++; > } > - Keep this new line. > #ifdef RTE_LIBRTE_BBDEV_DEBUG > if (check_mbuf_total_left(mbuf_total_left) != 0) > return -EINVAL; Reviewed-by: Maxime Coquelin Thanks, Maxime