#include <rte_ethdev.h>
#include <rte_malloc.h>
#include <rte_flow.h>
+#include <rte_cycles.h>
#include "failsafe_private.h"
return -1;
}
-static void
+static int
fs_stats_get(struct rte_eth_dev *dev,
struct rte_eth_stats *stats)
{
struct sub_device *sdev;
uint8_t i;
+ int ret;
rte_memcpy(stats, &PRIV(dev)->stats_accumulator, sizeof(*stats));
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
- rte_eth_stats_get(PORT_ID(sdev), &sdev->stats_snapshot);
- failsafe_stats_increment(stats, &sdev->stats_snapshot);
+ struct rte_eth_stats *snapshot = &sdev->stats_snapshot.stats;
+ uint64_t *timestamp = &sdev->stats_snapshot.timestamp;
+
+ ret = rte_eth_stats_get(PORT_ID(sdev), snapshot);
+ if (ret) {
+ ERROR("Operation rte_eth_stats_get failed for sub_device %d with error %d",
+ i, ret);
+ *timestamp = 0;
+ return ret;
+ }
+ *timestamp = rte_rdtsc();
+ failsafe_stats_increment(stats, snapshot);
}
+ return 0;
}
static void