[v2,2/3] baseband/acc: refactor queue status update

Message ID 20240812234201.2196633-3-nicolas.chautru@intel.com (mailing list archive)
State Awaiting Upstream
Delegated to: Maxime Coquelin
Headers
Series bbdev: sdditional queue stats |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas Aug. 12, 2024, 11:42 p.m. UTC
Introducing common function for queue stats update
within the acc PMDs.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc/acc_common.h     | 18 ++++++++
 drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++--------------
 drivers/baseband/acc/rte_vrb_pmd.c    | 61 +++++++++------------------
 3 files changed, 50 insertions(+), 74 deletions(-)
  

Comments

Mattia Milani Aug. 13, 2024, 7:24 a.m. UTC | #1
Dear all,

I'm a DPDK newbie, but I hope anyway you are gonna consider my
comments or help me to understand the code a little bit better.

1) Aren't you updating the variable two times? for example, in 
'acc100_enqueue_enc_cb',
     you update both 'enqueued_count' and 'enqueue_err_count' and then 
you call
     'acc_update_qstat_enqueue' which does exactly the same thing but 
also updates 'enqueue_depth_avail'.

2) You reset the queue stats when '*_queue_stop' is called, wouldn't be 
better to reset the statistics when a queue is started? so that, if I 
want, I can still access the statistics of a stopped queue to see the 
counters.

All the best, Mattia

On 13/08/2024 01:42, Nicolas Chautru wrote:
> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
>
>
>
> Introducing common function for queue stats update
> within the acc PMDs.
>
> Signed-off-by: Nicolas Chautru<nicolas.chautru@intel.com>
> ---
>   drivers/baseband/acc/acc_common.h     | 18 ++++++++
>   drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++--------------
>   drivers/baseband/acc/rte_vrb_pmd.c    | 61 +++++++++------------------
>   3 files changed, 50 insertions(+), 74 deletions(-)
>
> diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
> index e249f37e38..06a88360de 100644
> --- a/drivers/baseband/acc/acc_common.h
> +++ b/drivers/baseband/acc/acc_common.h
> @@ -1555,6 +1555,24 @@ acc_aq_avail(struct rte_bbdev_queue_data *q_data, uint16_t num_ops)
>          return aq_avail;
>   }
>
> +/* Update queue stats during enqueue. */
> +static inline void
> +acc_update_qstat_enqueue(struct rte_bbdev_queue_data *q_data,
> +               uint16_t enq_count, uint16_t enq_err_count)
> +{
> +       q_data->queue_stats.enqueued_count += enq_count;
> +       q_data->queue_stats.enqueue_err_count += enq_err_count;
> +       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
> +}
> +
> +/* Update queue stats during dequeue. */
> +static inline void
> +acc_update_qstat_dequeue(struct rte_bbdev_queue_data *q_data, uint16_t deq_count)
> +{
> +       q_data->queue_stats.dequeued_count += deq_count;
> +       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
> +}
> +
>   /* Calculates number of CBs in processed encoder TB based on 'r' and input
>    * length.
>    */
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index ab69350080..d2a0a36e12 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -892,6 +892,7 @@ acc100_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
>          dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
>          dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
>          dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
> +       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
>
>          return 0;
>   }
> @@ -3196,9 +3197,7 @@ acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3245,9 +3244,7 @@ acc100_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3284,9 +3281,7 @@ acc100_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3322,9 +3317,7 @@ acc100_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3388,9 +3381,7 @@ acc100_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3426,9 +3417,7 @@ acc100_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3468,9 +3457,7 @@ acc100_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3505,9 +3492,7 @@ acc100_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3897,8 +3882,7 @@ acc100_dequeue_enc(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_descs;
>
> -       /* Update enqueue stats */
> -       q_data->queue_stats.dequeued_count += dequeued_ops;
> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>
>          return dequeued_ops;
>   }
> @@ -3940,8 +3924,7 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_descs;
>
> -       /* Update enqueue stats */
> -       q_data->queue_stats.dequeued_count += dequeued_ops;
> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>
>          return dequeued_ops;
>   }
> @@ -3986,8 +3969,7 @@ acc100_dequeue_dec(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
>
> -       /* Update enqueue stats */
> -       q_data->queue_stats.dequeued_count += i;
> +       acc_update_qstat_dequeue(q_data, i);
>
>          return i;
>   }
> @@ -4033,8 +4015,7 @@ acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
>
> -       /* Update enqueue stats */
> -       q_data->queue_stats.dequeued_count += i;
> +       acc_update_qstat_dequeue(q_data, i);
>
>          return i;
>   }
> diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
> index 585dc49bd6..630b514f03 100644
> --- a/drivers/baseband/acc/rte_vrb_pmd.c
> +++ b/drivers/baseband/acc/rte_vrb_pmd.c
> @@ -1109,6 +1109,7 @@ vrb_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
>          dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
>          dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
>          dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
> +       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
>          return 0;
>   }
>
> @@ -2738,9 +2739,7 @@ vrb_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -2778,9 +2777,7 @@ vrb_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -2817,9 +2814,7 @@ vrb_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -2864,9 +2859,7 @@ vrb_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -2926,9 +2919,7 @@ vrb_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -2961,9 +2952,7 @@ vrb_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3004,9 +2993,7 @@ vrb_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3041,9 +3028,7 @@ vrb_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>
>          return i;
>   }
> @@ -3453,8 +3438,7 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_descs;
>
> -       /* Update enqueue stats. */
> -       q_data->queue_stats.dequeued_count += dequeued_ops;
> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>
>          return dequeued_ops;
>   }
> @@ -3496,8 +3480,7 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_descs;
>
> -       /* Update enqueue stats. */
> -       q_data->queue_stats.dequeued_count += dequeued_ops;
> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>
>          return dequeued_ops;
>   }
> @@ -3535,8 +3518,7 @@ vrb_dequeue_dec(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
>
> -       /* Update enqueue stats */
> -       q_data->queue_stats.dequeued_count += i;
> +       acc_update_qstat_dequeue(q_data, i);
>
>          return i;
>   }
> @@ -3575,8 +3557,7 @@ vrb_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
>
> -       /* Update enqueue stats. */
> -       q_data->queue_stats.dequeued_count += i;
> +       acc_update_qstat_dequeue(q_data, i);
>
>          return i;
>   }
> @@ -3782,9 +3763,7 @@ vrb_enqueue_fft(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>
> -       /* Update stats */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -3851,8 +3830,7 @@ vrb_dequeue_fft(struct rte_bbdev_queue_data *q_data,
>
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
> -       /* Update enqueue stats. */
> -       q_data->queue_stats.dequeued_count += i;
> +       acc_update_qstat_dequeue(q_data, i);
>          return i;
>   }
>
> @@ -4106,9 +4084,7 @@ vrb2_enqueue_mldts(struct rte_bbdev_queue_data *q_data,
>
>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>
> -       /* Update stats. */
> -       q_data->queue_stats.enqueued_count += i;
> -       q_data->queue_stats.enqueue_err_count += num - i;
> +       acc_update_qstat_enqueue(q_data, i, num - i);
>          return i;
>   }
>
> @@ -4207,8 +4183,9 @@ vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data,
>
>          q->aq_dequeued += aq_dequeued;
>          q->sw_ring_tail += dequeued_cbs;
> -       /* Update enqueue stats. */
> -       q_data->queue_stats.dequeued_count += i;
> +
> +       acc_update_qstat_dequeue(q_data, i);
> +
>          return i;
>   }
>
> --
> 2.34.1
>
  
Mattia Milani Aug. 13, 2024, 7:31 a.m. UTC | #2
My bad, please ignore the first comment, I've confused the - and + on 
the left side.
sorry for the misunderstanding.
For the second I still think would make more sense to reset the 
statistics at
when a queue is started rather than stopped.

On 13/08/2024 09:24, Mattia Milani wrote:
>
> Dear all,
>
> I'm a DPDK newbie, but I hope anyway you are gonna consider my
> comments or help me to understand the code a little bit better.
>
> 1) Aren't you updating the variable two times? for example, in 
> 'acc100_enqueue_enc_cb',
>     you update both 'enqueued_count' and 'enqueue_err_count' and then 
> you call
>     'acc_update_qstat_enqueue' which does exactly the same thing but 
> also updates 'enqueue_depth_avail'.
>
> 2) You reset the queue stats when '*_queue_stop' is called, wouldn't 
> be better to reset the statistics when a queue is started? so that, if 
> I want, I can still access the statistics of a stopped queue to see 
> the counters.
>
> All the best, Mattia
>
> On 13/08/2024 01:42, Nicolas Chautru wrote:
>> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
>>
>>
>>
>> Introducing common function for queue stats update
>> within the acc PMDs.
>>
>> Signed-off-by: Nicolas Chautru<nicolas.chautru@intel.com>
>> ---
>>   drivers/baseband/acc/acc_common.h     | 18 ++++++++
>>   drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++--------------
>>   drivers/baseband/acc/rte_vrb_pmd.c    | 61 +++++++++------------------
>>   3 files changed, 50 insertions(+), 74 deletions(-)
>>
>> diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
>> index e249f37e38..06a88360de 100644
>> --- a/drivers/baseband/acc/acc_common.h
>> +++ b/drivers/baseband/acc/acc_common.h
>> @@ -1555,6 +1555,24 @@ acc_aq_avail(struct rte_bbdev_queue_data *q_data, uint16_t num_ops)
>>          return aq_avail;
>>   }
>>
>> +/* Update queue stats during enqueue. */
>> +static inline void
>> +acc_update_qstat_enqueue(struct rte_bbdev_queue_data *q_data,
>> +               uint16_t enq_count, uint16_t enq_err_count)
>> +{
>> +       q_data->queue_stats.enqueued_count += enq_count;
>> +       q_data->queue_stats.enqueue_err_count += enq_err_count;
>> +       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
>> +}
>> +
>> +/* Update queue stats during dequeue. */
>> +static inline void
>> +acc_update_qstat_dequeue(struct rte_bbdev_queue_data *q_data, uint16_t deq_count)
>> +{
>> +       q_data->queue_stats.dequeued_count += deq_count;
>> +       q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
>> +}
>> +
>>   /* Calculates number of CBs in processed encoder TB based on 'r' and input
>>    * length.
>>    */
>> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
>> index ab69350080..d2a0a36e12 100644
>> --- a/drivers/baseband/acc/rte_acc100_pmd.c
>> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
>> @@ -892,6 +892,7 @@ acc100_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
>>          dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
>>          dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
>>          dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
>> +       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
>>
>>          return 0;
>>   }
>> @@ -3196,9 +3197,7 @@ acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3245,9 +3244,7 @@ acc100_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3284,9 +3281,7 @@ acc100_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3322,9 +3317,7 @@ acc100_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3388,9 +3381,7 @@ acc100_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3426,9 +3417,7 @@ acc100_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3468,9 +3457,7 @@ acc100_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3505,9 +3492,7 @@ acc100_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3897,8 +3882,7 @@ acc100_dequeue_enc(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_descs;
>>
>> -       /* Update enqueue stats */
>> -       q_data->queue_stats.dequeued_count += dequeued_ops;
>> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>>
>>          return dequeued_ops;
>>   }
>> @@ -3940,8 +3924,7 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_descs;
>>
>> -       /* Update enqueue stats */
>> -       q_data->queue_stats.dequeued_count += dequeued_ops;
>> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>>
>>          return dequeued_ops;
>>   }
>> @@ -3986,8 +3969,7 @@ acc100_dequeue_dec(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>>
>> -       /* Update enqueue stats */
>> -       q_data->queue_stats.dequeued_count += i;
>> +       acc_update_qstat_dequeue(q_data, i);
>>
>>          return i;
>>   }
>> @@ -4033,8 +4015,7 @@ acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>>
>> -       /* Update enqueue stats */
>> -       q_data->queue_stats.dequeued_count += i;
>> +       acc_update_qstat_dequeue(q_data, i);
>>
>>          return i;
>>   }
>> diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
>> index 585dc49bd6..630b514f03 100644
>> --- a/drivers/baseband/acc/rte_vrb_pmd.c
>> +++ b/drivers/baseband/acc/rte_vrb_pmd.c
>> @@ -1109,6 +1109,7 @@ vrb_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
>>          dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
>>          dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
>>          dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
>> +       dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
>>          return 0;
>>   }
>>
>> @@ -2738,9 +2739,7 @@ vrb_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -2778,9 +2777,7 @@ vrb_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -2817,9 +2814,7 @@ vrb_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -2864,9 +2859,7 @@ vrb_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -2926,9 +2919,7 @@ vrb_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -2961,9 +2952,7 @@ vrb_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3004,9 +2993,7 @@ vrb_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3041,9 +3028,7 @@ vrb_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>
>>          return i;
>>   }
>> @@ -3453,8 +3438,7 @@ vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_descs;
>>
>> -       /* Update enqueue stats. */
>> -       q_data->queue_stats.dequeued_count += dequeued_ops;
>> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>>
>>          return dequeued_ops;
>>   }
>> @@ -3496,8 +3480,7 @@ vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_descs;
>>
>> -       /* Update enqueue stats. */
>> -       q_data->queue_stats.dequeued_count += dequeued_ops;
>> +       acc_update_qstat_dequeue(q_data, dequeued_ops);
>>
>>          return dequeued_ops;
>>   }
>> @@ -3535,8 +3518,7 @@ vrb_dequeue_dec(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>>
>> -       /* Update enqueue stats */
>> -       q_data->queue_stats.dequeued_count += i;
>> +       acc_update_qstat_dequeue(q_data, i);
>>
>>          return i;
>>   }
>> @@ -3575,8 +3557,7 @@ vrb_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>>
>> -       /* Update enqueue stats. */
>> -       q_data->queue_stats.dequeued_count += i;
>> +       acc_update_qstat_dequeue(q_data, i);
>>
>>          return i;
>>   }
>> @@ -3782,9 +3763,7 @@ vrb_enqueue_fft(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, i, &q_data->queue_stats);
>>
>> -       /* Update stats */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -3851,8 +3830,7 @@ vrb_dequeue_fft(struct rte_bbdev_queue_data *q_data,
>>
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>> -       /* Update enqueue stats. */
>> -       q_data->queue_stats.dequeued_count += i;
>> +       acc_update_qstat_dequeue(q_data, i);
>>          return i;
>>   }
>>
>> @@ -4106,9 +4084,7 @@ vrb2_enqueue_mldts(struct rte_bbdev_queue_data *q_data,
>>
>>          acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
>>
>> -       /* Update stats. */
>> -       q_data->queue_stats.enqueued_count += i;
>> -       q_data->queue_stats.enqueue_err_count += num - i;
>> +       acc_update_qstat_enqueue(q_data, i, num - i);
>>          return i;
>>   }
>>
>> @@ -4207,8 +4183,9 @@ vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data,
>>
>>          q->aq_dequeued += aq_dequeued;
>>          q->sw_ring_tail += dequeued_cbs;
>> -       /* Update enqueue stats. */
>> -       q_data->queue_stats.dequeued_count += i;
>> +
>> +       acc_update_qstat_dequeue(q_data, i);
>> +
>>          return i;
>>   }
>>
>> --
>> 2.34.1
>>
  
Maxime Coquelin Sept. 10, 2024, 3:26 p.m. UTC | #3
On 8/13/24 01:42, Nicolas Chautru wrote:
> Introducing common function for queue stats update
> within the acc PMDs.
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> ---
>   drivers/baseband/acc/acc_common.h     | 18 ++++++++
>   drivers/baseband/acc/rte_acc100_pmd.c | 45 ++++++--------------
>   drivers/baseband/acc/rte_vrb_pmd.c    | 61 +++++++++------------------
>   3 files changed, 50 insertions(+), 74 deletions(-)
> 

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

Thanks,
Maxime
  

Patch

diff --git a/drivers/baseband/acc/acc_common.h b/drivers/baseband/acc/acc_common.h
index e249f37e38..06a88360de 100644
--- a/drivers/baseband/acc/acc_common.h
+++ b/drivers/baseband/acc/acc_common.h
@@ -1555,6 +1555,24 @@  acc_aq_avail(struct rte_bbdev_queue_data *q_data, uint16_t num_ops)
 	return aq_avail;
 }
 
+/* Update queue stats during enqueue. */
+static inline void
+acc_update_qstat_enqueue(struct rte_bbdev_queue_data *q_data,
+		uint16_t enq_count, uint16_t enq_err_count)
+{
+	q_data->queue_stats.enqueued_count += enq_count;
+	q_data->queue_stats.enqueue_err_count += enq_err_count;
+	q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
+}
+
+/* Update queue stats during dequeue. */
+static inline void
+acc_update_qstat_dequeue(struct rte_bbdev_queue_data *q_data, uint16_t deq_count)
+{
+	q_data->queue_stats.dequeued_count += deq_count;
+	q_data->queue_stats.enqueue_depth_avail = acc_aq_avail(q_data, 0);
+}
+
 /* Calculates number of CBs in processed encoder TB based on 'r' and input
  * length.
  */
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index ab69350080..d2a0a36e12 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -892,6 +892,7 @@  acc100_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
 	dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
 	dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
 	dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
+	dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
 
 	return 0;
 }
@@ -3196,9 +3197,7 @@  acc100_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3245,9 +3244,7 @@  acc100_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3284,9 +3281,7 @@  acc100_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3322,9 +3317,7 @@  acc100_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3388,9 +3381,7 @@  acc100_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3426,9 +3417,7 @@  acc100_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3468,9 +3457,7 @@  acc100_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3505,9 +3492,7 @@  acc100_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3897,8 +3882,7 @@  acc100_dequeue_enc(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_descs;
 
-	/* Update enqueue stats */
-	q_data->queue_stats.dequeued_count += dequeued_ops;
+	acc_update_qstat_dequeue(q_data, dequeued_ops);
 
 	return dequeued_ops;
 }
@@ -3940,8 +3924,7 @@  acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_descs;
 
-	/* Update enqueue stats */
-	q_data->queue_stats.dequeued_count += dequeued_ops;
+	acc_update_qstat_dequeue(q_data, dequeued_ops);
 
 	return dequeued_ops;
 }
@@ -3986,8 +3969,7 @@  acc100_dequeue_dec(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
 
-	/* Update enqueue stats */
-	q_data->queue_stats.dequeued_count += i;
+	acc_update_qstat_dequeue(q_data, i);
 
 	return i;
 }
@@ -4033,8 +4015,7 @@  acc100_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
 
-	/* Update enqueue stats */
-	q_data->queue_stats.dequeued_count += i;
+	acc_update_qstat_dequeue(q_data, i);
 
 	return i;
 }
diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c
index 585dc49bd6..630b514f03 100644
--- a/drivers/baseband/acc/rte_vrb_pmd.c
+++ b/drivers/baseband/acc/rte_vrb_pmd.c
@@ -1109,6 +1109,7 @@  vrb_queue_stop(struct rte_bbdev *dev, uint16_t queue_id)
 	dev->data->queues[queue_id].queue_stats.dequeue_err_count = 0;
 	dev->data->queues[queue_id].queue_stats.enqueue_warn_count = 0;
 	dev->data->queues[queue_id].queue_stats.dequeue_warn_count = 0;
+	dev->data->queues[queue_id].queue_stats.enqueue_depth_avail = 0;
 	return 0;
 }
 
@@ -2738,9 +2739,7 @@  vrb_enqueue_enc_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -2778,9 +2777,7 @@  vrb_enqueue_ldpc_enc_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, desc_idx, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -2817,9 +2814,7 @@  vrb_enqueue_enc_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -2864,9 +2859,7 @@  vrb_enqueue_ldpc_enc_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -2926,9 +2919,7 @@  vrb_enqueue_dec_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -2961,9 +2952,7 @@  vrb_enqueue_ldpc_dec_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3004,9 +2993,7 @@  vrb_enqueue_ldpc_dec_cb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3041,9 +3028,7 @@  vrb_enqueue_dec_tb(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_cbs, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 
 	return i;
 }
@@ -3453,8 +3438,7 @@  vrb_dequeue_enc(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_descs;
 
-	/* Update enqueue stats. */
-	q_data->queue_stats.dequeued_count += dequeued_ops;
+	acc_update_qstat_dequeue(q_data, dequeued_ops);
 
 	return dequeued_ops;
 }
@@ -3496,8 +3480,7 @@  vrb_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_descs;
 
-	/* Update enqueue stats. */
-	q_data->queue_stats.dequeued_count += dequeued_ops;
+	acc_update_qstat_dequeue(q_data, dequeued_ops);
 
 	return dequeued_ops;
 }
@@ -3535,8 +3518,7 @@  vrb_dequeue_dec(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
 
-	/* Update enqueue stats */
-	q_data->queue_stats.dequeued_count += i;
+	acc_update_qstat_dequeue(q_data, i);
 
 	return i;
 }
@@ -3575,8 +3557,7 @@  vrb_dequeue_ldpc_dec(struct rte_bbdev_queue_data *q_data,
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
 
-	/* Update enqueue stats. */
-	q_data->queue_stats.dequeued_count += i;
+	acc_update_qstat_dequeue(q_data, i);
 
 	return i;
 }
@@ -3782,9 +3763,7 @@  vrb_enqueue_fft(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, i, &q_data->queue_stats);
 
-	/* Update stats */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -3851,8 +3830,7 @@  vrb_dequeue_fft(struct rte_bbdev_queue_data *q_data,
 
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
-	/* Update enqueue stats. */
-	q_data->queue_stats.dequeued_count += i;
+	acc_update_qstat_dequeue(q_data, i);
 	return i;
 }
 
@@ -4106,9 +4084,7 @@  vrb2_enqueue_mldts(struct rte_bbdev_queue_data *q_data,
 
 	acc_dma_enqueue(q, enqueued_descs, &q_data->queue_stats);
 
-	/* Update stats. */
-	q_data->queue_stats.enqueued_count += i;
-	q_data->queue_stats.enqueue_err_count += num - i;
+	acc_update_qstat_enqueue(q_data, i, num - i);
 	return i;
 }
 
@@ -4207,8 +4183,9 @@  vrb2_dequeue_mldts(struct rte_bbdev_queue_data *q_data,
 
 	q->aq_dequeued += aq_dequeued;
 	q->sw_ring_tail += dequeued_cbs;
-	/* Update enqueue stats. */
-	q_data->queue_stats.dequeued_count += i;
+
+	acc_update_qstat_dequeue(q_data, i);
+
 	return i;
 }