[v1,6/6] baseband/acc: fix redundant function definition

Message ID 20221101230459.50891-7-nicolas.chautru@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series baseband/acc: fixes on top of RC2 |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Chautru, Nicolas Nov. 1, 2022, 11:04 p.m. UTC
  From: Hernan Vargas <hernan.vargas@intel.com>

Remove acc100_dma_fill_blk_type_in which already exists in acc_common.h

Fixes: 32e8b7ea35d ("baseband/acc100: refactor to segregate common code")

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 drivers/baseband/acc/rte_acc100_pmd.c | 93 +--------------------------
 1 file changed, 3 insertions(+), 90 deletions(-)
  

Comments

Maxime Coquelin Nov. 2, 2022, 7:19 a.m. UTC | #1
On 11/2/22 00:04, Nicolas Chautru wrote:
> From: Hernan Vargas <hernan.vargas@intel.com>
> 
> Remove acc100_dma_fill_blk_type_in which already exists in acc_common.h
> 
> Fixes: 32e8b7ea35d ("baseband/acc100: refactor to segregate common code")
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   drivers/baseband/acc/rte_acc100_pmd.c | 93 +--------------------------
>   1 file changed, 3 insertions(+), 90 deletions(-)
> 
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index 727a718e9d..31076d382f 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -1435,93 +1435,6 @@ acc101_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc_fcw_ld *fcw,
>   	}
>   }
>   
> -/**
> - * Fills descriptor with data pointers of one block type.
> - *
> - * @param desc
> - *   Pointer to DMA descriptor.
> - * @param input
> - *   Pointer to pointer to input data which will be encoded. It can be changed
> - *   and points to next segment in scatter-gather case.
> - * @param offset
> - *   Input offset in rte_mbuf structure. It is used for calculating the point
> - *   where data is starting.
> - * @param cb_len
> - *   Length of currently processed Code Block
> - * @param seg_total_left
> - *   It indicates how many bytes still left in segment (mbuf) for further
> - *   processing.
> - * @param op_flags
> - *   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
> - *   pkt and processed cb do not match.
> - *
> - */
> -static inline int
> -acc100_dma_fill_blk_type_in(struct acc_dma_req_desc *desc,
> -		struct rte_mbuf **input, uint32_t *offset, uint32_t cb_len,
> -		uint32_t *seg_total_left, int next_triplet,
> -		bool scattergather)
> -{
> -	uint32_t part_len;
> -	struct rte_mbuf *m = *input;
> -
> -	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;
> -
> -	desc->data_ptrs[next_triplet].address =
> -			rte_pktmbuf_iova_offset(m, *offset);
> -	desc->data_ptrs[next_triplet].blen = part_len;
> -	desc->data_ptrs[next_triplet].blkid = ACC_DMA_BLKID_IN;
> -	desc->data_ptrs[next_triplet].last = 0;
> -	desc->data_ptrs[next_triplet].dma_ext = 0;
> -	*offset += part_len;
> -	next_triplet++;
> -
> -	while (cb_len > 0) {
> -		if (next_triplet < ACC_DMA_MAX_NUM_POINTERS_IN && m->next != NULL) {
> -
> -			m = m->next;
> -			*seg_total_left = rte_pktmbuf_data_len(m);
> -			part_len = (*seg_total_left < cb_len) ?
> -					*seg_total_left :
> -					cb_len;
> -			desc->data_ptrs[next_triplet].address =
> -					rte_pktmbuf_iova_offset(m, 0);
> -			desc->data_ptrs[next_triplet].blen = part_len;
> -			desc->data_ptrs[next_triplet].blkid =
> -					ACC_DMA_BLKID_IN;
> -			desc->data_ptrs[next_triplet].last = 0;
> -			desc->data_ptrs[next_triplet].dma_ext = 0;
> -			cb_len -= part_len;
> -			*seg_total_left -= part_len;
> -			/* Initializing offset for next segment (mbuf) */
> -			*offset = part_len;
> -			next_triplet++;
> -		} else {
> -			rte_bbdev_log(ERR,
> -				"Some data still left for processing: "
> -				"data_left: %u, next_triplet: %u, next_mbuf: %p",
> -				cb_len, next_triplet, m->next);
> -			return -EINVAL;
> -		}
> -	}
> -	/* Storing new mbuf as it could be changed in scatter-gather case*/
> -	*input = m;
> -
> -	return next_triplet;
> -}
> -
>   /* May need to pad LDPC Encoder input to avoid small beat for ACC100. */
>   static inline uint16_t
>   pad_le_in(uint16_t blen, struct acc_queue *q)
> @@ -1565,7 +1478,7 @@ acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op,
>   		return -1;
>   	}
>   
> -	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,
> +	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset,
>   			pad_le_in(in_length_in_bytes, q), seg_total_left, next_triplet, false);
>   	if (unlikely(next_triplet < 0)) {
>   		rte_bbdev_log(ERR,
> @@ -1653,7 +1566,7 @@ acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
>   		return -1;
>   	}
>   
> -	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, kw,
> +	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset, kw,
>   			seg_total_left, next_triplet,
>   			check_bit(op->turbo_dec.op_flags,
>   			RTE_BBDEV_TURBO_DEC_SCATTER_GATHER));
> @@ -1756,7 +1669,7 @@ acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
>   		return -1;
>   	}
>   
> -	next_triplet = acc100_dma_fill_blk_type_in(desc, input,
> +	next_triplet = acc_dma_fill_blk_type_in(desc, input,
>   			in_offset, input_length,
>   			seg_total_left, next_triplet,
>   			check_bit(op->ldpc_dec.op_flags,

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Chautru, Nicolas Nov. 2, 2022, 5:16 p.m. UTC | #2
Thanks Maxime for the quick reviews. 

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, November 2, 2022 12:19 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> gakhil@marvell.com; Vargas, Hernan <hernan.vargas@intel.com>
> Subject: Re: [PATCH v1 6/6] baseband/acc: fix redundant function definition
> 
> 
> 
> On 11/2/22 00:04, Nicolas Chautru wrote:
> > From: Hernan Vargas <hernan.vargas@intel.com>
> >
> > Remove acc100_dma_fill_blk_type_in which already exists in
> > acc_common.h
> >
> > Fixes: 32e8b7ea35d ("baseband/acc100: refactor to segregate common
> > code")
> >
> > Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> > ---
> >   drivers/baseband/acc/rte_acc100_pmd.c | 93 +--------------------------
> >   1 file changed, 3 insertions(+), 90 deletions(-)
> >
> > diff --git a/drivers/baseband/acc/rte_acc100_pmd.c
> > b/drivers/baseband/acc/rte_acc100_pmd.c
> > index 727a718e9d..31076d382f 100644
> > --- a/drivers/baseband/acc/rte_acc100_pmd.c
> > +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> > @@ -1435,93 +1435,6 @@ acc101_fcw_ld_fill(struct rte_bbdev_dec_op *op,
> struct acc_fcw_ld *fcw,
> >   	}
> >   }
> >
> > -/**
> > - * Fills descriptor with data pointers of one block type.
> > - *
> > - * @param desc
> > - *   Pointer to DMA descriptor.
> > - * @param input
> > - *   Pointer to pointer to input data which will be encoded. It can be changed
> > - *   and points to next segment in scatter-gather case.
> > - * @param offset
> > - *   Input offset in rte_mbuf structure. It is used for calculating the point
> > - *   where data is starting.
> > - * @param cb_len
> > - *   Length of currently processed Code Block
> > - * @param seg_total_left
> > - *   It indicates how many bytes still left in segment (mbuf) for further
> > - *   processing.
> > - * @param op_flags
> > - *   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
> > - *   pkt and processed cb do not match.
> > - *
> > - */
> > -static inline int
> > -acc100_dma_fill_blk_type_in(struct acc_dma_req_desc *desc,
> > -		struct rte_mbuf **input, uint32_t *offset, uint32_t cb_len,
> > -		uint32_t *seg_total_left, int next_triplet,
> > -		bool scattergather)
> > -{
> > -	uint32_t part_len;
> > -	struct rte_mbuf *m = *input;
> > -
> > -	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;
> > -
> > -	desc->data_ptrs[next_triplet].address =
> > -			rte_pktmbuf_iova_offset(m, *offset);
> > -	desc->data_ptrs[next_triplet].blen = part_len;
> > -	desc->data_ptrs[next_triplet].blkid = ACC_DMA_BLKID_IN;
> > -	desc->data_ptrs[next_triplet].last = 0;
> > -	desc->data_ptrs[next_triplet].dma_ext = 0;
> > -	*offset += part_len;
> > -	next_triplet++;
> > -
> > -	while (cb_len > 0) {
> > -		if (next_triplet < ACC_DMA_MAX_NUM_POINTERS_IN && m-
> >next != NULL) {
> > -
> > -			m = m->next;
> > -			*seg_total_left = rte_pktmbuf_data_len(m);
> > -			part_len = (*seg_total_left < cb_len) ?
> > -					*seg_total_left :
> > -					cb_len;
> > -			desc->data_ptrs[next_triplet].address =
> > -					rte_pktmbuf_iova_offset(m, 0);
> > -			desc->data_ptrs[next_triplet].blen = part_len;
> > -			desc->data_ptrs[next_triplet].blkid =
> > -					ACC_DMA_BLKID_IN;
> > -			desc->data_ptrs[next_triplet].last = 0;
> > -			desc->data_ptrs[next_triplet].dma_ext = 0;
> > -			cb_len -= part_len;
> > -			*seg_total_left -= part_len;
> > -			/* Initializing offset for next segment (mbuf) */
> > -			*offset = part_len;
> > -			next_triplet++;
> > -		} else {
> > -			rte_bbdev_log(ERR,
> > -				"Some data still left for processing: "
> > -				"data_left: %u, next_triplet: %u, next_mbuf:
> %p",
> > -				cb_len, next_triplet, m->next);
> > -			return -EINVAL;
> > -		}
> > -	}
> > -	/* Storing new mbuf as it could be changed in scatter-gather case*/
> > -	*input = m;
> > -
> > -	return next_triplet;
> > -}
> > -
> >   /* May need to pad LDPC Encoder input to avoid small beat for ACC100. */
> >   static inline uint16_t
> >   pad_le_in(uint16_t blen, struct acc_queue *q) @@ -1565,7 +1478,7 @@
> > acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op,
> >   		return -1;
> >   	}
> >
> > -	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,
> > +	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset,
> >   			pad_le_in(in_length_in_bytes, q), seg_total_left,
> next_triplet, false);
> >   	if (unlikely(next_triplet < 0)) {
> >   		rte_bbdev_log(ERR,
> > @@ -1653,7 +1566,7 @@ acc100_dma_desc_td_fill(struct rte_bbdev_dec_op
> *op,
> >   		return -1;
> >   	}
> >
> > -	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, kw,
> > +	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset, kw,
> >   			seg_total_left, next_triplet,
> >   			check_bit(op->turbo_dec.op_flags,
> >   			RTE_BBDEV_TURBO_DEC_SCATTER_GATHER));
> > @@ -1756,7 +1669,7 @@ acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op
> *op,
> >   		return -1;
> >   	}
> >
> > -	next_triplet = acc100_dma_fill_blk_type_in(desc, input,
> > +	next_triplet = acc_dma_fill_blk_type_in(desc, input,
> >   			in_offset, input_length,
> >   			seg_total_left, next_triplet,
> >   			check_bit(op->ldpc_dec.op_flags,
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime
  

Patch

diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index 727a718e9d..31076d382f 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -1435,93 +1435,6 @@  acc101_fcw_ld_fill(struct rte_bbdev_dec_op *op, struct acc_fcw_ld *fcw,
 	}
 }
 
-/**
- * Fills descriptor with data pointers of one block type.
- *
- * @param desc
- *   Pointer to DMA descriptor.
- * @param input
- *   Pointer to pointer to input data which will be encoded. It can be changed
- *   and points to next segment in scatter-gather case.
- * @param offset
- *   Input offset in rte_mbuf structure. It is used for calculating the point
- *   where data is starting.
- * @param cb_len
- *   Length of currently processed Code Block
- * @param seg_total_left
- *   It indicates how many bytes still left in segment (mbuf) for further
- *   processing.
- * @param op_flags
- *   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
- *   pkt and processed cb do not match.
- *
- */
-static inline int
-acc100_dma_fill_blk_type_in(struct acc_dma_req_desc *desc,
-		struct rte_mbuf **input, uint32_t *offset, uint32_t cb_len,
-		uint32_t *seg_total_left, int next_triplet,
-		bool scattergather)
-{
-	uint32_t part_len;
-	struct rte_mbuf *m = *input;
-
-	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;
-
-	desc->data_ptrs[next_triplet].address =
-			rte_pktmbuf_iova_offset(m, *offset);
-	desc->data_ptrs[next_triplet].blen = part_len;
-	desc->data_ptrs[next_triplet].blkid = ACC_DMA_BLKID_IN;
-	desc->data_ptrs[next_triplet].last = 0;
-	desc->data_ptrs[next_triplet].dma_ext = 0;
-	*offset += part_len;
-	next_triplet++;
-
-	while (cb_len > 0) {
-		if (next_triplet < ACC_DMA_MAX_NUM_POINTERS_IN && m->next != NULL) {
-
-			m = m->next;
-			*seg_total_left = rte_pktmbuf_data_len(m);
-			part_len = (*seg_total_left < cb_len) ?
-					*seg_total_left :
-					cb_len;
-			desc->data_ptrs[next_triplet].address =
-					rte_pktmbuf_iova_offset(m, 0);
-			desc->data_ptrs[next_triplet].blen = part_len;
-			desc->data_ptrs[next_triplet].blkid =
-					ACC_DMA_BLKID_IN;
-			desc->data_ptrs[next_triplet].last = 0;
-			desc->data_ptrs[next_triplet].dma_ext = 0;
-			cb_len -= part_len;
-			*seg_total_left -= part_len;
-			/* Initializing offset for next segment (mbuf) */
-			*offset = part_len;
-			next_triplet++;
-		} else {
-			rte_bbdev_log(ERR,
-				"Some data still left for processing: "
-				"data_left: %u, next_triplet: %u, next_mbuf: %p",
-				cb_len, next_triplet, m->next);
-			return -EINVAL;
-		}
-	}
-	/* Storing new mbuf as it could be changed in scatter-gather case*/
-	*input = m;
-
-	return next_triplet;
-}
-
 /* May need to pad LDPC Encoder input to avoid small beat for ACC100. */
 static inline uint16_t
 pad_le_in(uint16_t blen, struct acc_queue *q)
@@ -1565,7 +1478,7 @@  acc100_dma_desc_le_fill(struct rte_bbdev_enc_op *op,
 		return -1;
 	}
 
-	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset,
+	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset,
 			pad_le_in(in_length_in_bytes, q), seg_total_left, next_triplet, false);
 	if (unlikely(next_triplet < 0)) {
 		rte_bbdev_log(ERR,
@@ -1653,7 +1566,7 @@  acc100_dma_desc_td_fill(struct rte_bbdev_dec_op *op,
 		return -1;
 	}
 
-	next_triplet = acc100_dma_fill_blk_type_in(desc, input, in_offset, kw,
+	next_triplet = acc_dma_fill_blk_type_in(desc, input, in_offset, kw,
 			seg_total_left, next_triplet,
 			check_bit(op->turbo_dec.op_flags,
 			RTE_BBDEV_TURBO_DEC_SCATTER_GATHER));
@@ -1756,7 +1669,7 @@  acc100_dma_desc_ld_fill(struct rte_bbdev_dec_op *op,
 		return -1;
 	}
 
-	next_triplet = acc100_dma_fill_blk_type_in(desc, input,
+	next_triplet = acc_dma_fill_blk_type_in(desc, input,
 			in_offset, input_length,
 			seg_total_left, next_triplet,
 			check_bit(op->ldpc_dec.op_flags,