Hi Tom, 

> -----Original Message-----
> From: Tom Rix <t...@redhat.com>
> 
> 
> On 7/5/22 5:23 PM, Nicolas Chautru wrote:
> > This allows to expose more information with regards to any queue
> > related failure and warning which cannot be supported in existing API.
> >
> > Signed-off-by: Nicolas Chautru <nicolas.chau...@intel.com>
> > ---
> >   app/test-bbdev/test_bbdev_perf.c |  2 ++
> >   lib/bbdev/rte_bbdev.c            | 21 +++++++++++++++++++++
> >   lib/bbdev/rte_bbdev.h            | 34 ++++++++++++++++++++++++++++++++++
> >   lib/bbdev/version.map            |  1 +
> >   4 files changed, 58 insertions(+)
> >
> > diff --git a/app/test-bbdev/test_bbdev_perf.c
> > b/app/test-bbdev/test_bbdev_perf.c
> > index 1abda2d..653b21f 100644
> > --- a/app/test-bbdev/test_bbdev_perf.c
> > +++ b/app/test-bbdev/test_bbdev_perf.c
> > @@ -4360,6 +4360,8 @@ typedef int (test_case_function)(struct
> active_device *ad,
> >     stats->dequeued_count = q_stats->dequeued_count;
> >     stats->enqueue_err_count = q_stats->enqueue_err_count;
> >     stats->dequeue_err_count = q_stats->dequeue_err_count;
> > +   stats->enqueue_warning_count = q_stats->enqueue_warning_count;
> > +   stats->dequeue_warning_count = q_stats->dequeue_warning_count;
> >     stats->acc_offload_cycles = q_stats->acc_offload_cycles;
> >
> >     return 0;
> > diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index
> > 28b105d..ddad464 100644
> > --- a/lib/bbdev/rte_bbdev.c
> > +++ b/lib/bbdev/rte_bbdev.c
> > @@ -27,6 +27,8 @@
> >   #define BBDEV_OP_TYPE_COUNT 6
> >   /* Number of supported device status */
> >   #define BBDEV_DEV_STATUS_COUNT 9
> > +/* Number of supported enqueue status */ #define
> > +BBDEV_ENQ_STATUS_COUNT 4
> >
> >   /* BBDev library logging ID */
> >   RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE); @@ -723,6 +725,8
> @@
> > struct rte_bbdev *
> >             stats->dequeued_count += q_stats->dequeued_count;
> >             stats->enqueue_err_count += q_stats->enqueue_err_count;
> >             stats->dequeue_err_count += q_stats->dequeue_err_count;
> > +           stats->enqueue_warn_count += q_stats-
> >enqueue_warn_count;
> > +           stats->dequeue_warn_count += q_stats-
> >dequeue_warn_count;
> >     }
> >     rte_bbdev_log_debug("Got stats on %u", dev->data->dev_id);
> >   }
> > @@ -1165,3 +1169,20 @@ struct rte_mempool *
> >     rte_bbdev_log(ERR, "Invalid device status");
> >     return NULL;
> >   }
> > +
> > +const char *
> > +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status) {
> > +   static const char * const enq_sta_string[] = {
> > +           "RTE_BBDEV_ENQ_STATUS_NONE",
> > +           "RTE_BBDEV_ENQ_STATUS_QUEUE_FULL",
> > +           "RTE_BBDEV_ENQ_STATUS_RING_FULL",
> > +           "RTE_BBDEV_ENQ_STATUS_INVALID_OP",
> > +   };
> > +
> > +   if (status < BBDEV_ENQ_STATUS_COUNT)
> Single use of #define, could just be an array size check and remove the 
> #define

Thanks, good point. 

> > +           return enq_sta_string[status];
> > +
> > +   rte_bbdev_log(ERR, "Invalid enqueue status");
> > +   return NULL;
> > +}
> > diff --git a/lib/bbdev/rte_bbdev.h b/lib/bbdev/rte_bbdev.h index
> > ed528b8..b7ecf94 100644
> > --- a/lib/bbdev/rte_bbdev.h
> > +++ b/lib/bbdev/rte_bbdev.h
> > @@ -224,6 +224,19 @@ struct rte_bbdev_queue_conf {
> >   rte_bbdev_queue_stop(uint16_t dev_id, uint16_t queue_id);
> >
> >   /**
> > + * Flags indicate the reason why a previous enqueue may not have
> > + * consumed all requested operations
> > + * In case of multiple reasons the latter superdes a previous one  */
> > +enum rte_bbdev_enqueue_status {
> > +   RTE_BBDEV_ENQ_STATUS_NONE,             /**< Nothing to report */
> > +   RTE_BBDEV_ENQ_STATUS_QUEUE_FULL,       /**< Not enough room in
> queue */
> > +   RTE_BBDEV_ENQ_STATUS_RING_FULL,        /**< Not enough room in
> ring */
> > +   RTE_BBDEV_ENQ_STATUS_INVALID_OP,       /**< Operation was
> rejected as invalid */
> > +   RTE_BBDEV_ENQ_STATUS_PADDED_MAX = 6,   /**< Maximum enq
> status number including padding */
> Pad to 8 like the other patch ?

It doesn't have to be the same number, just a bit of room for growth. 

> > +};
> > +
> > +/**
> >    * Flags indicate the status of the device
> >    */
> >   enum rte_bbdev_device_status {
> > @@ -246,6 +259,12 @@ struct rte_bbdev_stats {
> >     uint64_t enqueue_err_count;
> >     /** Total error count on operations dequeued */
> >     uint64_t dequeue_err_count;
> > +   /** Total warning count on operations enqueued */
> > +   uint64_t enqueue_warn_count;
> > +   /** Total warning count on operations dequeued */
> > +   uint64_t dequeue_warn_count;
> > +   /** Total enqueue status count based on rte_bbdev_enqueue_status
> enum */
> > +   uint64_t
> enqueue_status_count[RTE_BBDEV_ENQ_STATUS_PADDED_MAX];
> This element is not used in this patch, is it needed ?
> >     /** CPU cycles consumed by the (HW/SW) accelerator device to
> offload
> >      *  the enqueue request to its internal queues.
> >      *  - For a HW device this is the cycles consumed in MMIO write @@
> > -386,6 +405,7 @@ struct rte_bbdev_queue_data {
> >     void *queue_private;  /**< Driver-specific per-queue data */
> >     struct rte_bbdev_queue_conf conf;  /**< Current configuration */
> >     struct rte_bbdev_stats queue_stats;  /**< Queue statistics */
> > +   enum rte_bbdev_enqueue_status enqueue_status; /**< Enqueue
> status
> > +when op is rejected */
> 
> This element is not used in this patch, is it needed ?


This is exposed to both PMD and application through this commit at queue 
granularity. Said otherwise the PMD would then set this based on events 
detected in the PMD implementation. 


> 
> Tom
> 
> >     bool started;  /**< Queue state */
> >   };
> >
> > @@ -938,6 +958,20 @@ typedef void (*rte_bbdev_cb_fn)(uint16_t dev_id,
> >   const char*
> >   rte_bbdev_device_status_str(enum rte_bbdev_device_status status);
> >
> > +/**
> > + * Converts queue status from enum to string
> > + *
> > + * @param status
> > + *   Queue status as enum
> > + *
> > + * @returns
> > + *  Queue status as string or NULL if op_type is invalid
> > + *
> > + */
> > +__rte_experimental
> > +const char*
> > +rte_bbdev_enqueue_status_str(enum rte_bbdev_enqueue_status status);
> > +
> >   #ifdef __cplusplus
> >   }
> >   #endif
> > diff --git a/lib/bbdev/version.map b/lib/bbdev/version.map index
> > efae50b..1c06738 100644
> > --- a/lib/bbdev/version.map
> > +++ b/lib/bbdev/version.map
> > @@ -44,6 +44,7 @@ EXPERIMENTAL {
> >     global:
> >
> >     rte_bbdev_device_status_str;
> > +   rte_bbdev_enqueue_status_str;
> >     rte_bbdev_enqueue_fft_ops;
> >     rte_bbdev_dequeue_fft_ops;
> >     rte_bbdev_fft_op_alloc_bulk;

Reply via email to