[PATCH] net/gve: add support for basic stats

Stephen Hemminger stephen at networkplumber.org
Thu Nov 24 17:59:26 CET 2022


On Thu, 24 Nov 2022 15:33:35 +0800
Junfeng Guo <junfeng.guo at intel.com> wrote:

> +static int
> +gve_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> +{
> +	uint16_t i;
> +
> +	for (i = 0; i < dev->data->nb_tx_queues; i++) {
> +		struct gve_tx_queue *txq = dev->data->tx_queues[i];
> +		if (txq == NULL)
> +			continue;
> +
> +		stats->opackets += txq->packets;
> +		stats->obytes += txq->bytes;
> +		stats->oerrors += txq->errors;
> +	}
> +
> +	for (i = 0; i < dev->data->nb_rx_queues; i++) {
> +		struct gve_rx_queue *rxq = dev->data->rx_queues[i];
> +		if (rxq == NULL)
> +			continue;
> +
> +		stats->ipackets += rxq->packets;
> +		stats->ibytes += rxq->bytes;
> +		stats->ierrors += rxq->errors;
> +		stats->rx_nombuf += rxq->no_mbufs;
> +	}
> +
> +	return 0;
> +}
> +

The driver should be filling in the per-queue stats as well.
q_ipackets, q_opackets, q_ibytes, q_obytes, q_errors


More information about the dev mailing list