- for (i = 0; i < RTE_MIN(MAX_VDPA_SAMPLE_PORTS, dev_total);
- i++) {
- vports[i].did = i;
- snprintf(vports[i].ifname, MAX_PATH_LEN, "%s%d",
- iface, i);
+ RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
+ vdev = rte_vdpa_find_device_by_name(dev->name);
+ if (vdev == NULL) {
+ rte_panic("Failed to find vDPA dev for %s\n",
+ dev->name);
+ }
+ vports[devcnt].dev = vdev;
+ snprintf(vports[devcnt].ifname, MAX_PATH_LEN, "%s%d",
+ iface, devcnt);