[PATCH v7 18/21] net/cpfl: add HW statistics
Ferruh Yigit
ferruh.yigit at amd.com
Mon Feb 27 22:52:28 CET 2023
On 2/16/2023 12:30 AM, Mingxia Liu wrote:
> This patch add hardware packets/bytes statistics.
>
> Signed-off-by: Mingxia Liu <mingxia.liu at intel.com>
<...>
> +static int
> +cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
> +{
> + struct idpf_vport *vport =
> + (struct idpf_vport *)dev->data->dev_private;
> + struct virtchnl2_vport_stats *pstats = NULL;
> + int ret;
> +
> + ret = idpf_vc_stats_query(vport, &pstats);
> + if (ret == 0) {
> + uint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &
> + RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :
> + RTE_ETHER_CRC_LEN;
> +
> + idpf_vport_stats_update(&vport->eth_stats_offset, pstats);
> + stats->ipackets = pstats->rx_unicast + pstats->rx_multicast +
> + pstats->rx_broadcast - pstats->rx_discards;
> + stats->opackets = pstats->tx_broadcast + pstats->tx_multicast +
> + pstats->tx_unicast;
> + stats->imissed = pstats->rx_discards;
> + stats->oerrors = pstats->tx_errors + pstats->tx_discards;
> + stats->ibytes = pstats->rx_bytes;
> + stats->ibytes -= stats->ipackets * crc_stats_len;
> + stats->obytes = pstats->tx_bytes;
> +
> + dev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);
'dev->data->rx_mbuf_alloc_failed' is also used by telemetry, updating
here only in stats_get() will make it wrong for telemetry.
Is it possible to update 'dev->data->rx_mbuf_alloc_failed' whenever
alloc failed? (alongside 'rxq->rx_stats.mbuf_alloc_failed').
More information about the dev
mailing list