MCPcopy Create free account
hub / github.com/F-Stack/f-stack / new_device

Function new_device

dpdk/examples/vdpa/main.c:102–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static int
103new_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
131static void
132destroy_device(int vid)

Callers

nothing calls this directly

Calls 5

rte_vhost_get_ifnameFunction · 0.85
strncmpFunction · 0.85
rte_vdpa_get_rte_deviceFunction · 0.85
rte_dev_nameFunction · 0.85
printfFunction · 0.50

Tested by

no test coverage detected