[v6,4/5] baseband/acc100: modify validation code for ACC101

Message ID 1653526523-68839-5-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series [v6,1/5] baseband/acc100: update companion PF configure function |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas May 26, 2022, 12:55 a.m. UTC
  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(-)
  

Comments

Maxime Coquelin May 31, 2022, 8:02 a.m. UTC | #1
On 5/26/22 02:55, 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 6a2123b..a057edf 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,8 +2197,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;


This check should be done after the variables declarations as per the 
project coding style:

"
Local Variables
~~~~~~~~~~~~~~~

* Variables should be declared at the start of a block of code rather 
than in the middle.
"

>   	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;
> @@ -2320,8 +2337,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) {
> @@ -2373,8 +2392,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) {
> @@ -2429,7 +2450,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 +2504,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 +2566,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 +2623,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,8 +2696,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;
> @@ -2822,7 +2845,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 +3070,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 +3174,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 +3264,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;
>   	}
  
Chautru, Nicolas May 31, 2022, 6:16 p.m. UTC | #2
Hi Maxime, 

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, May 31, 2022 1:03 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> gakhil@marvell.com; trix@redhat.com
> Cc: thomas@monjalon.net; Kinsella, Ray <ray.kinsella@intel.com>;
> Richardson, Bruce <bruce.richardson@intel.com>;
> hemant.agrawal@nxp.com; Vargas, Hernan <hernan.vargas@intel.com>;
> david.marchand@redhat.com
> Subject: Re: [PATCH v6 4/5] baseband/acc100: modify validation code for
> ACC101
> 
> 
> 
> On 5/26/22 02:55, 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 6a2123b..a057edf 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,8 +2197,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;
> 
> 
> This check should be done after the variables declarations as per the project
> coding style:'

Thanks, I will update now. 

> 
> "
> Local Variables
> ~~~~~~~~~~~~~~~
> 
> * Variables should be declared at the start of a block of code rather than in
> the middle.
> "
> 
> >   	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; @@ -2320,8
> > +2337,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) {
> > @@ -2373,8 +2392,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) {
> > @@ -2429,7 +2450,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 +2504,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 +2566,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 +2623,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,8 +2696,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; @@ -2822,7
> > +2845,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 +3070,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 +3174,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 +3264,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;
> >   	}
  

Patch

diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c b/drivers/baseband/acc100/rte_acc100_pmd.c
index 6a2123b..a057edf 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,8 +2197,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;
@@ -2320,8 +2337,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) {
@@ -2373,8 +2392,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) {
@@ -2429,7 +2450,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 +2504,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 +2566,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 +2623,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,8 +2696,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;
@@ -2822,7 +2845,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 +3070,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 +3174,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 +3264,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;
 	}