+ return dev->ops->reset_stats(dev, qid);
+}
+
+static int
+vdpa_dev_match(struct rte_vdpa_device *dev,
+ const struct rte_device *rte_dev)
+{
+ if (dev->device == rte_dev)
+ return 0;
+
+ return -1;
+}
+
+/* Generic rte_vdpa_dev comparison function. */
+typedef int (*rte_vdpa_cmp_t)(struct rte_vdpa_device *,
+ const struct rte_device *rte_dev);
+
+static struct rte_vdpa_device *
+vdpa_find_device(const struct rte_vdpa_device *start, rte_vdpa_cmp_t cmp,
+ struct rte_device *rte_dev)
+{
+ struct rte_vdpa_device *dev;
+
+ rte_spinlock_lock(&vdpa_device_list_lock);
+ if (start == NULL)
+ dev = TAILQ_FIRST(&vdpa_device_list);
+ else
+ dev = TAILQ_NEXT(start, next);
+
+ while (dev != NULL) {
+ if (cmp(dev, rte_dev) == 0)
+ break;
+
+ dev = TAILQ_NEXT(dev, next);