Skip to content

Commit

Permalink
net/sfc: fix generic byte statistics to exclude FCS bytes
Browse files Browse the repository at this point in the history
[ upstream commit 8a69303 ]

Generic byte statistics should not include Ethernet FCS bytes.

Fixes: 1caab2f ("net/sfc: add basic statistics")

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  • Loading branch information
ol-galaktionov authored and bluca committed Feb 4, 2021
1 parent 3c7c838 commit 10b11c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/sfc/sfc_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 10b11c2

Please sign in to comment.