On 2022-10-13 11:23, pbhagavat...@marvell.com wrote:
> From: Pavan Nikhilesh <pbhagavat...@marvell.com>
> 
> Increase xstats ID width to 64bits from 32 bits, this also

"Increase xstats ID width from 32 to 64 bits. This /../"

Not that "unsigned int" is always 32, but anyways, I guess that's true 
for all platforms DPDK supports.

> fixes the xstats ID datatype discrepancy between reset and
> rest of the xstats family.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavat...@marvell.com>
> ---
>   doc/guides/rel_notes/release_22_11.rst   |   5 ++
>   drivers/event/cnxk/cnxk_eventdev.h       |   6 +-
>   drivers/event/cnxk/cnxk_eventdev_stats.c |   6 +-
>   drivers/event/dlb2/dlb2_priv.h           |   8 +-
>   drivers/event/dlb2/dlb2_xstats.c         |  18 ++--
>   drivers/event/dsw/dsw_evdev.h            |   6 +-
>   drivers/event/dsw/dsw_xstats.c           |  32 +++----
>   drivers/event/opdl/opdl_evdev.h          |   8 +-
>   drivers/event/opdl/opdl_evdev_xstats.c   |   8 +-
>   drivers/event/opdl/opdl_test.c           |   4 +-
>   drivers/event/sw/sw_evdev.h              |   8 +-
>   drivers/event/sw/sw_evdev_selftest.c     | 101 +++++++++++------------
>   drivers/event/sw/sw_evdev_xstats.c       |  18 ++--
>   lib/eventdev/eventdev_pmd.h              |   8 +-
>   lib/eventdev/rte_eventdev.c              |  12 +--
>   lib/eventdev/rte_eventdev.h              |   8 +-
>   16 files changed, 128 insertions(+), 128 deletions(-)
> 
> diff --git a/doc/guides/rel_notes/release_22_11.rst 
> b/doc/guides/rel_notes/release_22_11.rst
> index 2da8bc9661..6b76ad5566 100644
> --- a/doc/guides/rel_notes/release_22_11.rst
> +++ b/doc/guides/rel_notes/release_22_11.rst
> @@ -454,6 +454,11 @@ API Changes
>   
>   * raw/ifgpa: The function ``rte_pmd_ifpga_get_pci_bus`` has been removed.
>   
> +* eventdev: The datatype of the ID parameter in the functions
> +  ``rte_event_dev_xstats_names_get``, ``rte_event_dev_xstats_get``,
> +  ``rte_event_dev_xstats_by_name_get`` and ``rte_event_dev_xstats_reset``
> +  is changed to ``uint64_t`` from ``unsigned int`` and ``uint32_t``.
> +
>   
>   ABI Changes
>   -----------
> diff --git a/drivers/event/cnxk/cnxk_eventdev.h 
> b/drivers/event/cnxk/cnxk_eventdev.h
> index f68c2aee23..738e335ea4 100644
> --- a/drivers/event/cnxk/cnxk_eventdev.h
> +++ b/drivers/event/cnxk/cnxk_eventdev.h
> @@ -271,14 +271,14 @@ int cnxk_sso_xstats_get_names(const struct rte_eventdev 
> *event_dev,
>                             enum rte_event_dev_xstats_mode mode,
>                             uint8_t queue_port_id,
>                             struct rte_event_dev_xstats_name *xstats_names,
> -                           unsigned int *ids, unsigned int size);
> +                           uint64_t *ids, unsigned int size);
>   int cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
>                       enum rte_event_dev_xstats_mode mode,
> -                     uint8_t queue_port_id, const unsigned int ids[],
> +                     uint8_t queue_port_id, const uint64_t ids[],
>                       uint64_t values[], unsigned int n);
>   int cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
>                         enum rte_event_dev_xstats_mode mode,
> -                       int16_t queue_port_id, const uint32_t ids[],
> +                       int16_t queue_port_id, const uint64_t ids[],
>                         uint32_t n);
>   
>   /* CN9K */
> diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c 
> b/drivers/event/cnxk/cnxk_eventdev_stats.c
> index a3b548f462..715ca9cd8f 100644
> --- a/drivers/event/cnxk/cnxk_eventdev_stats.c
> +++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
> @@ -103,7 +103,7 @@ static struct cnxk_sso_xstats_name sso_hwgrp_xstats[] = {
>   int
>   cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
>                   enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -                 const unsigned int ids[], uint64_t values[], unsigned int n)
> +                 const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
>       struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -170,7 +170,7 @@ cnxk_sso_xstats_get(const struct rte_eventdev *event_dev,
>   int
>   cnxk_sso_xstats_reset(struct rte_eventdev *event_dev,
>                     enum rte_event_dev_xstats_mode mode,
> -                   int16_t queue_port_id, const uint32_t ids[], uint32_t n)
> +                   int16_t queue_port_id, const uint64_t ids[], uint32_t n)
>   {
>       struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
>       struct roc_sso_hwgrp_stats hwgrp_stats;
> @@ -235,7 +235,7 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev 
> *event_dev,
>                         enum rte_event_dev_xstats_mode mode,
>                         uint8_t queue_port_id,
>                         struct rte_event_dev_xstats_name *xstats_names,
> -                       unsigned int *ids, unsigned int size)
> +                       uint64_t *ids, unsigned int size)
>   {
>       struct rte_event_dev_xstats_name xstats_names_copy[CNXK_SSO_NUM_XSTATS];
>       struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
> diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h
> index 9ef5bcb901..52f0ab9935 100644
> --- a/drivers/event/dlb2/dlb2_priv.h
> +++ b/drivers/event/dlb2/dlb2_priv.h
> @@ -688,20 +688,20 @@ void dlb2_xstats_uninit(struct dlb2_eventdev *dlb2);
>   
>   int dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n);
> +             const uint64_t ids[], uint64_t values[], unsigned int n);
>   
>   int dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstat_names,
> -             unsigned int *ids, unsigned int size);
> +             uint64_t *ids, unsigned int size);
>   
>   uint64_t dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> -                                       const char *name, unsigned int *id);
> +                                       const char *name, uint64_t *id);
>   
>   int dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               int16_t queue_port_id,
> -             const uint32_t ids[],
> +             const uint64_t ids[],
>               uint32_t nb_ids);
>   
>   int test_dlb2_eventdev(void);
> diff --git a/drivers/event/dlb2/dlb2_xstats.c 
> b/drivers/event/dlb2/dlb2_xstats.c
> index d4c8d99034..ff15271dda 100644
> --- a/drivers/event/dlb2/dlb2_xstats.c
> +++ b/drivers/event/dlb2/dlb2_xstats.c
> @@ -666,7 +666,7 @@ int
>   dlb2_eventdev_xstats_get_names(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size)
> +             uint64_t *ids, unsigned int size)
>   {
>       const struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
>       unsigned int i;
> @@ -717,7 +717,7 @@ dlb2_eventdev_xstats_get_names(const struct rte_eventdev 
> *dev,
>   static int
>   dlb2_xstats_update(struct dlb2_eventdev *dlb2,
>               enum rte_event_dev_xstats_mode mode,
> -             uint8_t queue_port_id, const unsigned int ids[],
> +             uint8_t queue_port_id, const uint64_t ids[],
>               uint64_t values[], unsigned int n, const uint32_t reset)
>   {
>       unsigned int i;
> @@ -791,7 +791,7 @@ dlb2_xstats_update(struct dlb2_eventdev *dlb2,
>   int
>   dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n)
> +             const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
>       const uint32_t reset = 0;
> @@ -802,7 +802,7 @@ dlb2_eventdev_xstats_get(const struct rte_eventdev *dev,
>   
>   uint64_t
>   dlb2_eventdev_xstats_get_by_name(const struct rte_eventdev *dev,
> -                              const char *name, unsigned int *id)
> +                              const char *name, uint64_t *id)
>   {
>       struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
>       unsigned int i;
> @@ -876,7 +876,7 @@ dlb2_xstats_reset_range(struct dlb2_eventdev *dlb2, 
> uint32_t start,
>   
>   static int
>   dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, uint8_t queue_id,
> -                     const uint32_t ids[], uint32_t nb_ids)
> +                     const uint64_t ids[], uint32_t nb_ids)
>   {
>       const uint32_t reset = 1;
>   
> @@ -898,7 +898,7 @@ dlb2_xstats_reset_queue(struct dlb2_eventdev *dlb2, 
> uint8_t queue_id,
>   
>   static int
>   dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, uint8_t port_id,
> -                    const uint32_t ids[], uint32_t nb_ids)
> +                    const uint64_t ids[], uint32_t nb_ids)
>   {
>       const uint32_t reset = 1;
>       int offset = dlb2->xstats_offset_for_port[port_id];
> @@ -917,14 +917,14 @@ dlb2_xstats_reset_port(struct dlb2_eventdev *dlb2, 
> uint8_t port_id,
>   }
>   
>   static int
> -dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint32_t ids[],
> +dlb2_xstats_reset_dev(struct dlb2_eventdev *dlb2, const uint64_t ids[],
>                     uint32_t nb_ids)
>   {
>       uint32_t i;
>   
>       if (ids) {
>               for (i = 0; i < nb_ids; i++) {
> -                     uint32_t id = ids[i];
> +                     uint64_t id = ids[i];
>   
>                       if (id >= dlb2->xstats_count_mode_dev)
>                               return -EINVAL;
> @@ -942,7 +942,7 @@ int
>   dlb2_eventdev_xstats_reset(struct rte_eventdev *dev,
>                          enum rte_event_dev_xstats_mode mode,
>                          int16_t queue_port_id,
> -                        const uint32_t ids[],
> +                        const uint64_t ids[],
>                          uint32_t nb_ids)
>   {
>       struct dlb2_eventdev *dlb2 = dlb2_pmd_priv(dev);
> diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h
> index df7dcc5577..6416a8a898 100644
> --- a/drivers/event/dsw/dsw_evdev.h
> +++ b/drivers/event/dsw/dsw_evdev.h
> @@ -283,12 +283,12 @@ int dsw_xstats_get_names(const struct rte_eventdev *dev,
>                        enum rte_event_dev_xstats_mode mode,
>                        uint8_t queue_port_id,
>                        struct rte_event_dev_xstats_name *xstats_names,
> -                      unsigned int *ids, unsigned int size);
> +                      uint64_t *ids, unsigned int size);
>   int dsw_xstats_get(const struct rte_eventdev *dev,
>                  enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -                const unsigned int ids[], uint64_t values[], unsigned int n);
> +                const uint64_t ids[], uint64_t values[], unsigned int n);
>   uint64_t dsw_xstats_get_by_name(const struct rte_eventdev *dev,
> -                             const char *name, unsigned int *id);
> +                             const char *name, uint64_t *id);
>   
>   static inline struct dsw_evdev *
>   dsw_pmd_priv(const struct rte_eventdev *eventdev)
> diff --git a/drivers/event/dsw/dsw_xstats.c b/drivers/event/dsw/dsw_xstats.c
> index 4f7d4e3ff9..2409de6adc 100644
> --- a/drivers/event/dsw/dsw_xstats.c
> +++ b/drivers/event/dsw/dsw_xstats.c
> @@ -15,8 +15,8 @@
>    */
>   #define DSW_XSTATS_ID_PARAM_BITS (8)
>   #define DSW_XSTATS_ID_STAT_BITS                                     \
> -     (sizeof(unsigned int)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> -#define DSW_XSTATS_ID_STAT_MASK ((1 << DSW_XSTATS_ID_STAT_BITS) - 1)
> +     (sizeof(uint64_t)*CHAR_BIT - DSW_XSTATS_ID_PARAM_BITS)
> +#define DSW_XSTATS_ID_STAT_MASK ((1UL << DSW_XSTATS_ID_STAT_BITS) - 1)

Use UINT64_C(1) instead.

>   
>   #define DSW_XSTATS_ID_GET_PARAM(id)         \
>       ((id)>>DSW_XSTATS_ID_STAT_BITS)
> @@ -25,7 +25,7 @@
>       ((id) & DSW_XSTATS_ID_STAT_MASK)
>   
>   #define DSW_XSTATS_ID_CREATE(id, param_value)                       \
> -     (((param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
> +     ((((uint64_t)param_value) << DSW_XSTATS_ID_STAT_BITS) | id)
>   
>   typedef
>   uint64_t (*dsw_xstats_dev_get_value_fn)(struct dsw_evdev *dsw);
> @@ -169,7 +169,7 @@ static struct dsw_xstats_port dsw_port_xstats[] = {
>   typedef
>   void (*dsw_xstats_foreach_fn)(const char *xstats_name,
>                             enum rte_event_dev_xstats_mode mode,
> -                           uint8_t queue_port_id, unsigned int xstats_id,
> +                           uint8_t queue_port_id, uint64_t xstats_id,
>                             void *data);
>   
>   static void
> @@ -193,7 +193,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t 
> port_id,
>            stat_idx < RTE_DIM(dsw_port_xstats);) {
>               struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
>               char xstats_name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
> -             unsigned int xstats_id;
> +             uint64_t xstats_id;
>   
>               if (xstat->per_queue) {
>                       xstats_id = DSW_XSTATS_ID_CREATE(stat_idx, queue_id);
> @@ -219,7 +219,7 @@ dsw_xstats_port_foreach(struct dsw_evdev *dsw, uint8_t 
> port_id,
>   
>   struct store_ctx {
>       struct rte_event_dev_xstats_name *names;
> -     unsigned int *ids;
> +     uint64_t *ids;
>       unsigned int count;
>       unsigned int capacity;
>   };
> @@ -227,7 +227,7 @@ struct store_ctx {
>   static void
>   dsw_xstats_store_stat(const char *xstats_name,
>                     enum rte_event_dev_xstats_mode mode,
> -                   uint8_t queue_port_id, unsigned int xstats_id,
> +                   uint8_t queue_port_id, uint64_t xstats_id,
>                     void *data)
>   {
>       struct store_ctx *ctx = data;
> @@ -248,7 +248,7 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
>                    enum rte_event_dev_xstats_mode mode,
>                    uint8_t queue_port_id,
>                    struct rte_event_dev_xstats_name *xstats_names,
> -                  unsigned int *ids, unsigned int capacity)
> +                  uint64_t *ids, unsigned int capacity)
>   {
>       struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>   
> @@ -276,13 +276,13 @@ dsw_xstats_get_names(const struct rte_eventdev *dev,
>   
>   static int
>   dsw_xstats_dev_get(const struct rte_eventdev *dev,
> -                const unsigned int ids[], uint64_t values[], unsigned int n)
> +                const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>       unsigned int i;
>   
>       for (i = 0; i < n; i++) {
> -             unsigned int id = ids[i];
> +             uint64_t id = ids[i];
>               struct dsw_xstat_dev *xstat = &dsw_dev_xstats[id];
>               values[i] = xstat->get_value_fn(dsw);
>       }
> @@ -291,13 +291,13 @@ dsw_xstats_dev_get(const struct rte_eventdev *dev,
>   
>   static int
>   dsw_xstats_port_get(const struct rte_eventdev *dev, uint8_t port_id,
> -                 const unsigned int ids[], uint64_t values[], unsigned int n)
> +                 const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>       unsigned int i;
>   
>       for (i = 0; i < n; i++) {
> -             unsigned int id = ids[i];
> +             uint64_t id = ids[i];
>               unsigned int stat_idx = DSW_XSTATS_ID_GET_STAT(id);
>               struct dsw_xstats_port *xstat = &dsw_port_xstats[stat_idx];
>               uint8_t queue_id = 0;
> @@ -313,7 +313,7 @@ dsw_xstats_port_get(const struct rte_eventdev *dev, 
> uint8_t port_id,
>   int
>   dsw_xstats_get(const struct rte_eventdev *dev,
>              enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -            const unsigned int ids[], uint64_t values[], unsigned int n)
> +            const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       switch (mode) {
>       case RTE_EVENT_DEV_XSTATS_DEVICE:
> @@ -332,14 +332,14 @@ dsw_xstats_get(const struct rte_eventdev *dev,
>   struct find_ctx {
>       const struct rte_eventdev *dev;
>       const char *name;
> -     unsigned int *id;
> +     uint64_t *id;
>       uint64_t value;
>   };
>   
>   static void
>   dsw_xstats_find_stat(const char *xstats_name,
>                    enum rte_event_dev_xstats_mode mode,
> -                  uint8_t queue_port_id, unsigned int xstats_id,
> +                  uint8_t queue_port_id, uint64_t xstats_id,
>                    void *data)
>   {
>       struct find_ctx *ctx = data;
> @@ -354,7 +354,7 @@ dsw_xstats_find_stat(const char *xstats_name,
>   
>   uint64_t
>   dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
> -                    unsigned int *id)
> +                    uint64_t *id)
>   {
>       struct dsw_evdev *dsw = dsw_pmd_priv(dev);
>       uint16_t port_id;
> diff --git a/drivers/event/opdl/opdl_evdev.h b/drivers/event/opdl/opdl_evdev.h
> index 2dca0a8a98..1ca166b37c 100644
> --- a/drivers/event/opdl/opdl_evdev.h
> +++ b/drivers/event/opdl/opdl_evdev.h
> @@ -289,16 +289,16 @@ int opdl_xstats_uninit(struct rte_eventdev *dev);
>   int opdl_xstats_get_names(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size);
> +             uint64_t *ids, unsigned int size);
>   int opdl_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n);
> +             const uint64_t ids[], uint64_t values[], unsigned int n);
>   uint64_t opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> -             const char *name, unsigned int *id);
> +             const char *name, uint64_t *id);
>   int opdl_xstats_reset(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               int16_t queue_port_id,
> -             const uint32_t ids[],
> +             const uint64_t ids[],
>               uint32_t nb_ids);
>   
>   int opdl_add_event_handlers(struct rte_eventdev *dev);
> diff --git a/drivers/event/opdl/opdl_evdev_xstats.c 
> b/drivers/event/opdl/opdl_evdev_xstats.c
> index 27b3d88023..b382f6619d 100644
> --- a/drivers/event/opdl/opdl_evdev_xstats.c
> +++ b/drivers/event/opdl/opdl_evdev_xstats.c
> @@ -65,7 +65,7 @@ opdl_xstats_get_names(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size)
> +             uint64_t *ids, unsigned int size)
>   {
>       struct opdl_evdev *device = opdl_pmd_priv(dev);
>   
> @@ -99,7 +99,7 @@ int
>   opdl_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               uint8_t queue_port_id,
> -             const unsigned int ids[],
> +             const uint64_t ids[],
>               uint64_t values[], unsigned int n)
>   {
>       struct opdl_evdev *device = opdl_pmd_priv(dev);
> @@ -133,7 +133,7 @@ opdl_xstats_get(const struct rte_eventdev *dev,
>   
>   uint64_t
>   opdl_xstats_get_by_name(const struct rte_eventdev *dev,
> -             const char *name, unsigned int *id)
> +             const char *name, uint64_t *id)
>   {
>       struct opdl_evdev *device = opdl_pmd_priv(dev);
>   
> @@ -161,7 +161,7 @@ opdl_xstats_get_by_name(const struct rte_eventdev *dev,
>   int
>   opdl_xstats_reset(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
> -             int16_t queue_port_id, const uint32_t ids[],
> +             int16_t queue_port_id, const uint64_t ids[],
>               uint32_t nb_ids)
>   {
>       struct opdl_evdev *device = opdl_pmd_priv(dev);
> diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c
> index 3cbe2139ee..b69c4769dc 100644
> --- a/drivers/event/opdl/opdl_test.c
> +++ b/drivers/event/opdl/opdl_test.c
> @@ -471,7 +471,7 @@ atomic_basic(struct test *t)
>       return 0;
>   }
>   static __rte_always_inline int
> -check_qid_stats(uint32_t id[], int index)
> +check_qid_stats(uint64_t id[], int index)
>   {
>   
>       if (index == 0) {
> @@ -509,7 +509,7 @@ check_statistics(void)
>                               0);
>               if (num_stats > 0) {
>   
> -                     uint32_t id[num_stats];
> +                     uint64_t id[num_stats];
>                       struct rte_event_dev_xstats_name names[num_stats];
>                       uint64_t values[num_stats];
>   
> diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h
> index 8542b7d34d..c7b943a72b 100644
> --- a/drivers/event/sw/sw_evdev.h
> +++ b/drivers/event/sw/sw_evdev.h
> @@ -301,16 +301,16 @@ int sw_xstats_uninit(struct sw_evdev *dev);
>   int sw_xstats_get_names(const struct rte_eventdev *dev,
>       enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>       struct rte_event_dev_xstats_name *xstats_names,
> -     unsigned int *ids, unsigned int size);
> +     uint64_t *ids, unsigned int size);
>   int sw_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n);
> +             const uint64_t ids[], uint64_t values[], unsigned int n);
>   uint64_t sw_xstats_get_by_name(const struct rte_eventdev *dev,
> -             const char *name, unsigned int *id);
> +             const char *name, uint64_t *id);
>   int sw_xstats_reset(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               int16_t queue_port_id,
> -             const uint32_t ids[],
> +             const uint64_t ids[],
>               uint32_t nb_ids);
>   
>   int test_sw_eventdev(void);
> diff --git a/drivers/event/sw/sw_evdev_selftest.c 
> b/drivers/event/sw/sw_evdev_selftest.c
> index ed7ae6a685..62d66744f2 100644
> --- a/drivers/event/sw/sw_evdev_selftest.c
> +++ b/drivers/event/sw/sw_evdev_selftest.c
> @@ -92,7 +92,7 @@ xstats_print(void)
>   {
>       const uint32_t XSTATS_MAX = 1024;
>       uint32_t i;
> -     uint32_t ids[XSTATS_MAX];
> +     uint64_t ids[XSTATS_MAX];
>       uint64_t values[XSTATS_MAX];
>       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>   
> @@ -310,15 +310,14 @@ static inline int
>   test_event_dev_stats_get(int dev_id, struct test_event_dev_stats *stats)
>   {
>       static uint32_t i;
> -     static uint32_t total_ids[3]; /* rx, tx and drop */
> -     static uint32_t port_rx_pkts_ids[MAX_PORTS];
> -     static uint32_t port_rx_dropped_ids[MAX_PORTS];
> -     static uint32_t port_inflight_ids[MAX_PORTS];
> -     static uint32_t port_tx_pkts_ids[MAX_PORTS];
> -     static uint32_t qid_rx_pkts_ids[MAX_QIDS];
> -     static uint32_t qid_rx_dropped_ids[MAX_QIDS];
> -     static uint32_t qid_tx_pkts_ids[MAX_QIDS];
> -
> +     static uint64_t total_ids[3]; /* rx, tx and drop */
> +     static uint64_t port_rx_pkts_ids[MAX_PORTS];
> +     static uint64_t port_rx_dropped_ids[MAX_PORTS];
> +     static uint64_t port_inflight_ids[MAX_PORTS];
> +     static uint64_t port_tx_pkts_ids[MAX_PORTS];
> +     static uint64_t qid_rx_pkts_ids[MAX_QIDS];
> +     static uint64_t qid_rx_dropped_ids[MAX_QIDS];
> +     static uint64_t qid_tx_pkts_ids[MAX_QIDS];
>   
>       stats->rx_pkts = rte_event_dev_xstats_by_name_get(dev_id,
>                       "dev_rx", &total_ids[0]);
> @@ -863,7 +862,7 @@ xstats_tests(struct test *t)
>       const uint32_t XSTATS_MAX = 1024;
>   
>       uint32_t i;
> -     uint32_t ids[XSTATS_MAX];
> +     uint64_t ids[XSTATS_MAX];
>       uint64_t values[XSTATS_MAX];
>       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>   
> @@ -963,11 +962,10 @@ xstats_tests(struct test *t)
>       static const uint64_t expected[] = {3, 3, 0, 1, 0, 0, 4, 1};
>       for (i = 0; (signed int)i < ret; i++) {
>               if (expected[i] != values[i]) {
> -                     printf(
> -                             "%d Error xstat %d (id %d) %s : %"PRIu64
> -                             ", expect %"PRIu64"\n",
> -                             __LINE__, i, ids[i], xstats_names[i].name,
> -                             values[i], expected[i]);
> +                     printf("%d Error xstat %d (id %" PRIu64
> +                            ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> +                            __LINE__, i, ids[i], xstats_names[i].name,
> +                            values[i], expected[i]);
>                       goto fail;
>               }
>       }
> @@ -982,11 +980,10 @@ xstats_tests(struct test *t)
>                                       0, ids, values, num_stats);
>       for (i = 0; (signed int)i < ret; i++) {
>               if (expected_zero[i] != values[i]) {
> -                     printf(
> -                             "%d Error, xstat %d (id %d) %s : %"PRIu64
> -                             ", expect %"PRIu64"\n",
> -                             __LINE__, i, ids[i], xstats_names[i].name,
> -                             values[i], expected_zero[i]);
> +                     printf("%d Error, xstat %d (id %" PRIu64
> +                            ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> +                            __LINE__, i, ids[i], xstats_names[i].name,
> +                            values[i], expected_zero[i]);
>                       goto fail;
>               }
>       }
> @@ -1058,11 +1055,10 @@ xstats_tests(struct test *t)
>                                       0, ids, values, num_stats);
>       for (i = 0; (signed int)i < ret; i++) {
>               if (port_expected_zero[i] != values[i]) {
> -                     printf(
> -                             "%d, Error, xstat %d (id %d) %s : %"PRIu64
> -                             ", expect %"PRIu64"\n",
> -                             __LINE__, i, ids[i], xstats_names[i].name,
> -                             values[i], port_expected_zero[i]);
> +                     printf("%d, Error, xstat %d (id %" PRIu64
> +                            ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> +                            __LINE__, i, ids[i], xstats_names[i].name,
> +                            values[i], port_expected_zero[i]);
>                       goto fail;
>               }
>       }
> @@ -1095,11 +1091,10 @@ xstats_tests(struct test *t)
>       };
>       for (i = 0; (signed int)i < ret; i++) {
>               if (queue_expected[i] != values[i]) {
> -                     printf(
> -                             "%d, Error, xstat %d (id %d) %s : %"PRIu64
> -                             ", expect %"PRIu64"\n",
> -                             __LINE__, i, ids[i], xstats_names[i].name,
> -                             values[i], queue_expected[i]);
> +                     printf("%d, Error, xstat %d (id %" PRIu64
> +                            ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> +                            __LINE__, i, ids[i], xstats_names[i].name,
> +                            values[i], queue_expected[i]);
>                       goto fail;
>               }
>       }
> @@ -1129,11 +1124,10 @@ xstats_tests(struct test *t)
>       int fails = 0;
>       for (i = 0; (signed int)i < ret; i++) {
>               if (queue_expected_zero[i] != values[i]) {
> -                     printf(
> -                             "%d, Error, xstat %d (id %d) %s : %"PRIu64
> -                             ", expect %"PRIu64"\n",
> -                             __LINE__, i, ids[i], xstats_names[i].name,
> -                             values[i], queue_expected_zero[i]);
> +                     printf("%d, Error, xstat %d (id %" PRIu64
> +                            ") %s : %" PRIu64 ", expect %" PRIu64 "\n",
> +                            __LINE__, i, ids[i], xstats_names[i].name,
> +                            values[i], queue_expected_zero[i]);
>                       fails++;
>               }
>       }
> @@ -1160,7 +1154,7 @@ xstats_id_abuse_tests(struct test *t)
>       const uint32_t XSTATS_MAX = 1024;
>       const uint32_t link_port = 2;
>   
> -     uint32_t ids[XSTATS_MAX];
> +     uint64_t ids[XSTATS_MAX];
>       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>   
>       /* Create instance with 4 ports */
> @@ -1379,7 +1373,7 @@ xstats_brute_force(struct test *t)
>   {
>       uint32_t i;
>       const uint32_t XSTATS_MAX = 1024;
> -     uint32_t ids[XSTATS_MAX];
> +     uint64_t ids[XSTATS_MAX];
>       uint64_t values[XSTATS_MAX];
>       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>   
> @@ -1454,7 +1448,7 @@ xstats_id_reset_tests(struct test *t)
>   #define XSTATS_MAX 1024
>       int ret;
>       uint32_t i;
> -     uint32_t ids[XSTATS_MAX];
> +     uint64_t ids[XSTATS_MAX];
>       uint64_t values[XSTATS_MAX];
>       struct rte_event_dev_xstats_name xstats_names[XSTATS_MAX];
>   
> @@ -1510,13 +1504,14 @@ xstats_id_reset_tests(struct test *t)
>       };
>       uint64_t dev_expected[] = {NPKTS, NPKTS, 0, 1, 0, 0, 4, 1};
>       for (i = 0; (int)i < ret; i++) {
> -             unsigned int id;
> +             uint64_t id;
>               uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
>                                                               dev_names[i],
>                                                               &id);
>               if (id != i) {
> -                     printf("%d: %s id incorrect, expected %d got %d\n",
> -                                     __LINE__, dev_names[i], i, id);
> +                     printf("%d: %s id incorrect, expected %d got %" PRIu64
> +                            "\n",
> +                            __LINE__, dev_names[i], i, id);
>                       goto fail;
>               }
>               if (val != dev_expected[i]) {
> @@ -1631,20 +1626,20 @@ xstats_id_reset_tests(struct test *t)
>   
>       int failed = 0;
>       for (i = 0; (int)i < ret; i++) {
> -             unsigned int id;
> +             uint64_t id;
>               uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
>                                                               port_names[i],
>                                                               &id);
>               if (id != i + PORT_OFF) {
> -                     printf("%d: %s id incorrect, expected %d got %d\n",
> -                                     __LINE__, port_names[i], i+PORT_OFF,
> -                                     id);
> +                     printf("%d: %s id incorrect, expected %d got %" PRIu64
> +                            "\n",
> +                            __LINE__, port_names[i], i + PORT_OFF, id);
>                       failed = 1;
>               }
>               if (val != port_expected[i]) {
> -                     printf("%d: %s value incorrect, expected %"PRIu64
> -                             " got %d\n", __LINE__, port_names[i],
> -                             port_expected[i], id);
> +                     printf("%d: %s value incorrect, expected %" PRIu64
> +                            " got %" PRIu64 "\n",
> +                            __LINE__, port_names[i], port_expected[i], id);
>                       failed = 1;
>               }
>               /* reset to zero */
> @@ -1746,14 +1741,14 @@ xstats_id_reset_tests(struct test *t)
>   
>       failed = 0;
>       for (i = 0; (int)i < ret; i++) {
> -             unsigned int id;
> +             uint64_t id;
>               uint64_t val = rte_event_dev_xstats_by_name_get(evdev,
>                                                               queue_names[i],
>                                                               &id);
>               if (id != i + QUEUE_OFF) {
> -                     printf("%d: %s id incorrect, expected %d got %d\n",
> -                                     __LINE__, queue_names[i], i+QUEUE_OFF,
> -                                     id);
> +                     printf("%d: %s id incorrect, expected %d got %" PRIu64
> +                            "\n",
> +                            __LINE__, queue_names[i], i + QUEUE_OFF, id);
>                       failed = 1;
>               }
>               if (val != queue_expected[i]) {
> diff --git a/drivers/event/sw/sw_evdev_xstats.c 
> b/drivers/event/sw/sw_evdev_xstats.c
> index c2647d7da2..fbac8f3ab5 100644
> --- a/drivers/event/sw/sw_evdev_xstats.c
> +++ b/drivers/event/sw/sw_evdev_xstats.c
> @@ -393,7 +393,7 @@ int
>   sw_xstats_get_names(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size)
> +             uint64_t *ids, unsigned int size)
>   {
>       const struct sw_evdev *sw = sw_pmd_priv_const(dev);
>       unsigned int i;
> @@ -444,7 +444,7 @@ sw_xstats_get_names(const struct rte_eventdev *dev,
>   
>   static int
>   sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode,
> -             uint8_t queue_port_id, const unsigned int ids[],
> +             uint8_t queue_port_id, const uint64_t ids[],
>               uint64_t values[], unsigned int n, const uint32_t reset,
>               const uint32_t ret_if_n_lt_nstats)
>   {
> @@ -509,7 +509,7 @@ sw_xstats_update(struct sw_evdev *sw, enum 
> rte_event_dev_xstats_mode mode,
>   int
>   sw_xstats_get(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n)
> +             const uint64_t ids[], uint64_t values[], unsigned int n)
>   {
>       struct sw_evdev *sw = sw_pmd_priv(dev);
>       const uint32_t reset = 0;
> @@ -520,7 +520,7 @@ sw_xstats_get(const struct rte_eventdev *dev,
>   
>   uint64_t
>   sw_xstats_get_by_name(const struct rte_eventdev *dev,
> -             const char *name, unsigned int *id)
> +             const char *name, uint64_t *id)
>   {
>       const struct sw_evdev *sw = sw_pmd_priv_const(dev);
>       unsigned int i;
> @@ -556,7 +556,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t 
> start, uint32_t num)
>   
>   static int
>   sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t queue_id,
> -             const uint32_t ids[], uint32_t nb_ids)
> +             const uint64_t ids[], uint32_t nb_ids)
>   {
>       const uint32_t reset = 1;
>       const uint32_t ret_n_lt_stats = 0;
> @@ -577,7 +577,7 @@ sw_xstats_reset_queue(struct sw_evdev *sw, uint8_t 
> queue_id,
>   
>   static int
>   sw_xstats_reset_port(struct sw_evdev *sw, uint8_t port_id,
> -             const uint32_t ids[], uint32_t nb_ids)
> +             const uint64_t ids[], uint32_t nb_ids)
>   {
>       const uint32_t reset = 1;
>       const uint32_t ret_n_lt_stats = 0;
> @@ -597,12 +597,12 @@ sw_xstats_reset_port(struct sw_evdev *sw, uint8_t 
> port_id,
>   }
>   
>   static int
> -sw_xstats_reset_dev(struct sw_evdev *sw, const uint32_t ids[], uint32_t 
> nb_ids)
> +sw_xstats_reset_dev(struct sw_evdev *sw, const uint64_t ids[], uint32_t 
> nb_ids)
>   {
>       uint32_t i;
>       if (ids) {
>               for (i = 0; i < nb_ids; i++) {
> -                     uint32_t id = ids[i];
> +                     uint64_t id = ids[i];
>                       if (id >= sw->xstats_count_mode_dev)
>                               return -EINVAL;
>                       sw_xstats_reset_range(sw, id, 1);
> @@ -619,7 +619,7 @@ int
>   sw_xstats_reset(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               int16_t queue_port_id,
> -             const uint32_t ids[],
> +             const uint64_t ids[],
>               uint32_t nb_ids)
>   {
>       struct sw_evdev *sw = sw_pmd_priv(dev);
> diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
> index e49ff23db5..aebab26852 100644
> --- a/lib/eventdev/eventdev_pmd.h
> +++ b/lib/eventdev/eventdev_pmd.h
> @@ -529,7 +529,7 @@ typedef void (*eventdev_dump_t)(struct rte_eventdev *dev, 
> FILE *f);
>    */
>   typedef int (*eventdev_xstats_get_t)(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
> -             const unsigned int ids[], uint64_t values[], unsigned int n);
> +             const uint64_t ids[], uint64_t values[], unsigned int n);
>   
>   /**
>    * Resets the statistic values in xstats for the device, based on mode.
> @@ -537,7 +537,7 @@ typedef int (*eventdev_xstats_get_t)(const struct 
> rte_eventdev *dev,
>   typedef int (*eventdev_xstats_reset_t)(struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode,
>               int16_t queue_port_id,
> -             const uint32_t ids[],
> +             const uint64_t ids[],
>               uint32_t nb_ids);
>   
>   /**
> @@ -564,7 +564,7 @@ typedef int (*eventdev_xstats_reset_t)(struct 
> rte_eventdev *dev,
>   typedef int (*eventdev_xstats_get_names_t)(const struct rte_eventdev *dev,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size);
> +             uint64_t *ids, unsigned int size);
>   
>   /**
>    * Get value of one stats and optionally return its id
> @@ -582,7 +582,7 @@ typedef int (*eventdev_xstats_get_names_t)(const struct 
> rte_eventdev *dev,
>    *   if id pointer is non-NULL
>    */
>   typedef uint64_t (*eventdev_xstats_get_by_name)(const struct rte_eventdev 
> *dev,
> -             const char *name, unsigned int *id);
> +             const char *name, uint64_t *id);
>   
>   
>   /**
> diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
> index 845f8dbb6e..b0414206d9 100644
> --- a/lib/eventdev/rte_eventdev.c
> +++ b/lib/eventdev/rte_eventdev.c
> @@ -1161,7 +1161,7 @@ int
>   rte_event_dev_xstats_names_get(uint8_t dev_id,
>               enum rte_event_dev_xstats_mode mode, uint8_t queue_port_id,
>               struct rte_event_dev_xstats_name *xstats_names,
> -             unsigned int *ids, unsigned int size)
> +             uint64_t *ids, unsigned int size)
>   {
>       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
>       const int cnt_expected_entries = xstats_get_count(dev_id, mode,
> @@ -1183,7 +1183,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
>   /* retrieve eventdev extended statistics */
>   int
>   rte_event_dev_xstats_get(uint8_t dev_id, enum rte_event_dev_xstats_mode 
> mode,
> -             uint8_t queue_port_id, const unsigned int ids[],
> +             uint8_t queue_port_id, const uint64_t ids[],
>               uint64_t values[], unsigned int n)
>   {
>       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -ENODEV);
> @@ -1198,11 +1198,11 @@ rte_event_dev_xstats_get(uint8_t dev_id, enum 
> rte_event_dev_xstats_mode mode,
>   
>   uint64_t
>   rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> -             unsigned int *id)
> +             uint64_t *id)
>   {
>       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, 0);
>       const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> -     unsigned int temp = -1;
> +     uint64_t temp = -1;
>   
>       if (id != NULL)
>               *id = (unsigned int)-1;
> @@ -1217,7 +1217,7 @@ rte_event_dev_xstats_by_name_get(uint8_t dev_id, const 
> char *name,
>   
>   int rte_event_dev_xstats_reset(uint8_t dev_id,
>               enum rte_event_dev_xstats_mode mode, int16_t queue_port_id,
> -             const uint32_t ids[], uint32_t nb_ids)
> +             const uint64_t ids[], uint32_t nb_ids)
>   {
>       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
>       struct rte_eventdev *dev = &rte_eventdevs[dev_id];
> @@ -1658,7 +1658,7 @@ eventdev_build_telemetry_data(int dev_id,
>                             struct rte_tel_data *d)
>   {
>       struct rte_event_dev_xstats_name *xstat_names;
> -     unsigned int *ids;
> +     uint64_t *ids;
>       uint64_t *values;
>       int i, ret, num_xstats;
>   
> diff --git a/lib/eventdev/rte_eventdev.h b/lib/eventdev/rte_eventdev.h
> index 60e9043ac4..82e8976e57 100644
> --- a/lib/eventdev/rte_eventdev.h
> +++ b/lib/eventdev/rte_eventdev.h
> @@ -1784,7 +1784,7 @@ rte_event_dev_xstats_names_get(uint8_t dev_id,
>                              enum rte_event_dev_xstats_mode mode,
>                              uint8_t queue_port_id,
>                              struct rte_event_dev_xstats_name *xstats_names,
> -                            unsigned int *ids,
> +                            uint64_t *ids,
>                              unsigned int size);
>   
>   /**
> @@ -1817,7 +1817,7 @@ int
>   rte_event_dev_xstats_get(uint8_t dev_id,
>                        enum rte_event_dev_xstats_mode mode,
>                        uint8_t queue_port_id,
> -                      const unsigned int ids[],
> +                      const uint64_t ids[],
>                        uint64_t values[], unsigned int n);
>   
>   /**
> @@ -1838,7 +1838,7 @@ rte_event_dev_xstats_get(uint8_t dev_id,
>    */
>   uint64_t
>   rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
> -                              unsigned int *id);
> +                              uint64_t *id);
>   
>   /**
>    * Reset the values of the xstats of the selected component in the device.
> @@ -1864,7 +1864,7 @@ int
>   rte_event_dev_xstats_reset(uint8_t dev_id,
>                          enum rte_event_dev_xstats_mode mode,
>                          int16_t queue_port_id,
> -                        const uint32_t ids[],
> +                        const uint64_t ids[],
>                          uint32_t nb_ids);
>   
>   /**

With the minor fixes:
Reviewed-by: Mattias Rönnblom <mattias.ronnb...@ericsson.com>


Reply via email to