net/sfc: fix generic byte statistics to exclude FCS bytes
[dpdk.git] / drivers / net / sfc / sfc_ethdev.c
index f2f5336..479b4f4 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <rte_dev.h>
-#include <rte_ethdev_driver.h>
-#include <rte_ethdev_pci.h>
+#include <ethdev_driver.h>
+#include <ethdev_pci.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
 #include <rte_errno.h>
@@ -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