net/sfc: fix generic byte statistics to exclude FCS bytes
[dpdk.git] / drivers / net / sfc / sfc_ethdev.c
index a47d812..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
@@ -1017,7 +1026,7 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
         * The driver does not use it, but other PMDs update jumbo frame
         * flag and max_rx_pkt_len when MTU is set.
         */
-       if (mtu > RTE_ETHER_MAX_LEN) {
+       if (mtu > RTE_ETHER_MTU) {
                struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
                rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
        }
@@ -1752,9 +1761,6 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
        sfc_log_init(sa, "entry");
 
        switch (filter_type) {
-       case RTE_ETH_FILTER_FDIR:
-               sfc_err(sa, "Flow Director filters not supported");
-               break;
        case RTE_ETH_FILTER_GENERIC:
                if (filter_op != RTE_ETH_FILTER_GET) {
                        rc = EINVAL;
@@ -2201,6 +2207,7 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
        /* Copy PCI device info to the dev->data */
        rte_eth_copy_pci_info(dev, pci_dev);
        dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
+       dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE;
 
        rc = sfc_kvargs_parse(sa);
        if (rc != 0)