[dpdk-dev] [PATCH v2 15/17] net/ionic: add stats
Ferruh Yigit
ferruh.yigit at intel.com
Mon Dec 2 17:14:27 CET 2019
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 <cardigliano at ntop.org>
> Reviewed-by: Shannon Nelson <snelson at 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.
More information about the dev
mailing list