drivers/net: build Intel NIC PMDs with meson
[dpdk.git] / drivers / net / failsafe / failsafe_ether.c
index f4db423..0f1630e 100644 (file)
@@ -35,6 +35,7 @@
 
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
+#include <rte_cycles.h>
 
 #include "failsafe_private.h"
 
@@ -282,6 +283,7 @@ fs_dev_remove(struct sub_device *sdev)
                return;
        switch (sdev->state) {
        case DEV_STARTED:
+               failsafe_rx_intr_uninstall_subdevice(sdev);
                rte_eth_dev_stop(PORT_ID(sdev));
                sdev->state = DEV_ACTIVE;
                /* fallthrough */
@@ -312,9 +314,23 @@ fs_dev_remove(struct sub_device *sdev)
 static void
 fs_dev_stats_save(struct sub_device *sdev)
 {
+       struct rte_eth_stats stats;
+       int err;
+
+       /* Attempt to read current stats. */
+       err = rte_eth_stats_get(PORT_ID(sdev), &stats);
+       if (err) {
+               uint64_t timestamp = sdev->stats_snapshot.timestamp;
+
+               WARN("Could not access latest statistics from sub-device %d.\n",
+                        SUB_ID(sdev));
+               if (timestamp != 0)
+                       WARN("Using latest snapshot taken before %"PRIu64" seconds.\n",
+                                (rte_rdtsc() - timestamp) / rte_get_tsc_hz());
+       }
        failsafe_stats_increment(&PRIV(sdev->fs_dev)->stats_accumulator,
-                       &sdev->stats_snapshot);
-       memset(&sdev->stats_snapshot, 0, sizeof(struct rte_eth_stats));
+                       err ? &sdev->stats_snapshot.stats : &stats);
+       memset(&sdev->stats_snapshot, 0, sizeof(sdev->stats_snapshot));
 }
 
 static inline int
@@ -465,7 +481,7 @@ failsafe_eth_lsc_event_callback(uint16_t port_id __rte_unused,
        if (ret)
                return _rte_eth_dev_callback_process(dev,
                                                     RTE_ETH_EVENT_INTR_LSC,
-                                                    NULL, NULL);
+                                                    NULL);
        else
                return 0;
 }