| 129 | } |
| 130 | |
| 131 | static void |
| 132 | destroy_device(int vid) |
| 133 | { |
| 134 | struct rte_device *dev; |
| 135 | char ifname[MAX_PATH_LEN]; |
| 136 | int i; |
| 137 | |
| 138 | rte_vhost_get_ifname(vid, ifname, sizeof(ifname)); |
| 139 | for (i = 0; i < MAX_VDPA_SAMPLE_PORTS; i++) { |
| 140 | if (strncmp(ifname, vports[i].ifname, MAX_PATH_LEN)) |
| 141 | continue; |
| 142 | |
| 143 | dev = rte_vdpa_get_rte_device(vports[i].dev); |
| 144 | if (!dev) { |
| 145 | RTE_LOG(ERR, VDPA, |
| 146 | "Failed to get generic device for port %d\n", i); |
| 147 | continue; |
| 148 | } |
| 149 | |
| 150 | printf("\ndestroy port %s, device: %s\n", ifname, rte_dev_name(dev)); |
| 151 | break; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | static const struct rte_vhost_device_ops vdpa_sample_devops = { |
| 156 | .new_device = new_device, |
nothing calls this directly
no test coverage detected