| 100 | } |
| 101 | |
| 102 | static int |
| 103 | new_device(int vid) |
| 104 | { |
| 105 | char ifname[MAX_PATH_LEN]; |
| 106 | struct rte_device *dev; |
| 107 | int i; |
| 108 | |
| 109 | rte_vhost_get_ifname(vid, ifname, sizeof(ifname)); |
| 110 | for (i = 0; i < MAX_VDPA_SAMPLE_PORTS; i++) { |
| 111 | if (strncmp(ifname, vports[i].ifname, MAX_PATH_LEN)) |
| 112 | continue; |
| 113 | |
| 114 | dev = rte_vdpa_get_rte_device(vports[i].dev); |
| 115 | if (!dev) { |
| 116 | RTE_LOG(ERR, VDPA, |
| 117 | "Failed to get generic device for port %d\n", i); |
| 118 | continue; |
| 119 | } |
| 120 | printf("\nnew port %s, device : %s\n", ifname, rte_dev_name(dev)); |
| 121 | vports[i].vid = vid; |
| 122 | break; |
| 123 | } |
| 124 | |
| 125 | if (i >= MAX_VDPA_SAMPLE_PORTS) |
| 126 | return -1; |
| 127 | |
| 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | static void |
| 132 | destroy_device(int vid) |
nothing calls this directly
no test coverage detected