-----Original Message-----
From: Chautru, Nicolas <nicolas.chau...@intel.com>
Sent: Tuesday, May 31, 2022 5:32 PM
To: dev@dpdk.org; gak...@marvell.com; t...@redhat.com;
maxime.coque...@redhat.com
Cc: tho...@monjalon.net; Kinsella, Ray <ray.kinse...@intel.com>; Richardson,
Bruce <bruce.richard...@intel.com>; hemant.agra...@nxp.com; Vargas, Hernan
<hernan.var...@intel.com>; david.march...@redhat.com; Chautru, Nicolas
<nicolas.chau...@intel.com>
Subject: [PATCH v7 5/6] baseband/acc100: modify validation code for ACC101
The validation requirement is different for the two devices.
Signed-off-by: Nicolas Chautru <nicolas.chau...@intel.com>
---
drivers/baseband/acc100/rte_acc100_pmd.c | 51 ++++++++++++++++++++++++--------
1 file changed, 39 insertions(+), 12 deletions(-)
Reviewed-by: Hernan Vargas <hernan.var...@intel.com>
Thanks,
Hernan
diff --git a/drivers/baseband/acc100/rte_acc100_pmd.c
b/drivers/baseband/acc100/rte_acc100_pmd.c
index 31046b5..956bd43 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,13 +2197,16 @@ 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)
{
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;
uint16_t kw, kw_neg, kw_pos;
+ if (!validate_op_required(q))
+ return 0;
+
if (op->mempool == NULL) {
rte_bbdev_log(ERR, "Invalid mempool pointer");
return -1;
@@ -2320,10 +2338,13 @@ 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)
{
struct rte_bbdev_op_ldpc_enc *ldpc_enc = &op->ldpc_enc;
+ if (!validate_op_required(q))
+ return 0;
+
if (op->mempool == NULL) {
rte_bbdev_log(ERR, "Invalid mempool pointer");
return -1;
@@ -2373,10 +2394,13 @@ 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)
{
struct rte_bbdev_op_ldpc_dec *ldpc_dec = &op->ldpc_dec;
+ if (!validate_op_required(q))
+ return 0;
+
if (op->mempool == NULL) {
rte_bbdev_log(ERR, "Invalid mempool pointer");
return -1;
@@ -2429,7 +2453,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 +2507,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 +2569,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 +2626,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,12 +2699,15 @@ 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)
{
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;
+ if (!validate_op_required(q))
+ return 0;
+
if (op->mempool == NULL) {
rte_bbdev_log(ERR, "Invalid mempool pointer");
return -1;
@@ -2822,7 +2849,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 +3074,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 +3178,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 +3268,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;
}
--
1.8.3.1