On 10/15/2019 9:22 AM, Alfredo Cardigliano wrote:
> Add basic, per queue and extended statistics for
> RX and TX, both from the adapter and the driver.
> 
> Signed-off-by: Alfredo Cardigliano <cardigli...@ntop.org>
> Reviewed-by: Shannon Nelson <snel...@pensando.io>

<...>

> +static void
> +ionic_lif_get_abs_stats(struct ionic_lif *lif, struct rte_eth_stats *stats)
> +{
> +     struct ionic_lif_stats *ls = &lif->info->stats;
> +     uint32_t i;
> +     uint32_t num_rx_q_counters = RTE_MIN(lif->nrxqcqs, (uint32_t)
> +                     RTE_ETHDEV_QUEUE_STAT_CNTRS);
> +     uint32_t num_tx_q_counters = RTE_MIN(lif->ntxqcqs, (uint32_t)
> +                     RTE_ETHDEV_QUEUE_STAT_CNTRS);
> +
> +     memset(stats, 0, sizeof(*stats));
> +
> +     if (ls == NULL) {
> +             ionic_drv_print(DEBUG, "Stats on port %u not yet initialized",
> +                     lif->port_id);
> +             return;
> +     }
> +
> +     /* RX */
> +
> +     stats->ipackets = ls->rx_ucast_packets +
> +                       ls->rx_mcast_packets +
> +                       ls->rx_bcast_packets;
> +
> +     stats->ibytes = ls->rx_ucast_bytes +
> +                     ls->rx_mcast_bytes +
> +                     ls->rx_bcast_bytes;
> +
> +     stats->ierrors = 0;
> +     stats->imissed = 0;

'stats' already memset above.

<...>

> +void
> +ionic_lif_get_stats(struct ionic_lif *lif, struct rte_eth_stats *stats)
> +{
> +     ionic_lif_get_abs_stats(lif, stats);
> +
> +     stats->ipackets  -= lif->stats_base.ipackets;
> +     stats->opackets  -= lif->stats_base.opackets;
> +     stats->ibytes    -= lif->stats_base.ibytes;
> +     stats->obytes    -= lif->stats_base.obytes;
> +     stats->imissed   -= lif->stats_base.imissed;
> +     stats->ierrors   -= lif->stats_base.ierrors;
> +     stats->oerrors   -= lif->stats_base.oerrors;
> +     stats->rx_nombuf -= lif->stats_base.rx_nombuf;

Can you confirm 'lif->stats_base' is zeroed out at the initialization.

Reply via email to