From: Viacheslav Galaktionov Date: Wed, 20 Jan 2021 12:44:18 +0000 (+0300) Subject: net/sfc: fix generic byte statistics to exclude FCS bytes X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8a6930361bcfb0374cb84e95d75ab7c01231c96e;p=dpdk.git net/sfc: fix generic byte statistics to exclude FCS bytes Generic byte statistics should not include Ethernet FCS bytes. Fixes: 1caab2f1e684 ("net/sfc: add basic statistics") Cc: stable@dpdk.org Signed-off-by: Viacheslav Galaktionov Signed-off-by: Andrew Rybchenko --- diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index d6f6a84eab..479b4f4df6 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -640,10 +640,19 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) mac_stats[EFX_MAC_VADAPTER_TX_BROADCAST_BYTES]; stats->imissed = mac_stats[EFX_MAC_VADAPTER_RX_BAD_PACKETS]; stats->oerrors = mac_stats[EFX_MAC_VADAPTER_TX_BAD_PACKETS]; + + /* CRC is included in these stats, but shouldn't be */ + stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN; + stats->obytes -= stats->opackets * RTE_ETHER_CRC_LEN; } else { stats->opackets = mac_stats[EFX_MAC_TX_PKTS]; stats->ibytes = mac_stats[EFX_MAC_RX_OCTETS]; stats->obytes = mac_stats[EFX_MAC_TX_OCTETS]; + + /* CRC is included in these stats, but shouldn't be */ + stats->ibytes -= mac_stats[EFX_MAC_RX_PKTS] * RTE_ETHER_CRC_LEN; + stats->obytes -= mac_stats[EFX_MAC_TX_PKTS] * RTE_ETHER_CRC_LEN; + /* * Take into account stats which are whenever supported * on EF10. If some stat is not supported by current