[v2,2/2] baseband/acc: add check for empty queue
Checks
Commit Message
Add optimization to return early if there are no available descriptors
in ring to dequeue.
Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
drivers/baseband/acc/rte_acc100_pmd.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
Hi Hernan,
On 2/8/23 03:00, Hernan Vargas wrote:
> Add optimization to return early if there are no available descriptors
> in ring to dequeue.
>
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
> drivers/baseband/acc/rte_acc100_pmd.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index baab459436..9941754aa0 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -4106,10 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
> int ret, cbm;
> struct rte_bbdev_enc_op *op;
>
> -#ifdef RTE_LIBRTE_BBDEV_DEBUG
> - if (unlikely(ops == 0))
> + if (avail == 0)
> return 0;
> -#endif
> +
Again, this is doing more than advertised.
The patch intent is about returning early if no available descriptors,
but here you also remove some debug checks.
At least please mention in in the commit message & title.
> op = acc_op_tail(q, 0);
> if (unlikely(ops == NULL || op == NULL))
> return 0;
Thanks,
Maxime
@@ -4106,10 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
int ret, cbm;
struct rte_bbdev_enc_op *op;
-#ifdef RTE_LIBRTE_BBDEV_DEBUG
- if (unlikely(ops == 0))
+ if (avail == 0)
return 0;
-#endif
+
op = acc_op_tail(q, 0);
if (unlikely(ops == NULL || op == NULL))
return 0;