bitrate: use common macro RTE_DIM
authorPavan Nikhilesh <pbhagavatula@marvell.com>
Thu, 17 Oct 2019 12:10:00 +0000 (17:40 +0530)
committerDavid Marchand <david.marchand@redhat.com>
Sun, 27 Oct 2019 13:40:59 +0000 (14:40 +0100)
Use RTE_DIM instead of re-defining ARRAY_SIZE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
lib/librte_bitratestats/rte_bitrate.c

index 639e475..d181523 100644 (file)
@@ -8,8 +8,6 @@
 #include <rte_metrics.h>
 #include <rte_bitrate.h>
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 /*
  * Persistent bit-rate data.
  * @internal
@@ -50,7 +48,7 @@ rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
        if (bitrate_data == NULL)
                return -EINVAL;
 
-       return_value = rte_metrics_reg_names(&names[0], ARRAY_SIZE(names));
+       return_value = rte_metrics_reg_names(&names[0], RTE_DIM(names));
        if (return_value >= 0)
                bitrate_data->id_stats_set = return_value;
        return return_value;
@@ -126,7 +124,7 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
        values[4] = port_data->peak_ibits;
        values[5] = port_data->peak_obits;
        ret = rte_metrics_update_values(port_id, bitrate_data->id_stats_set,
-               values, ARRAY_SIZE(values));
+               values, RTE_DIM(values));
        if (ret < 0)
                return ret;