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

Function insert_vdev

dpdk/drivers/bus/vdev/vdev.c:266–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266static int
267insert_vdev(const char *name, const char *args,
268 struct rte_vdev_device **p_dev,
269 bool init)
270{
271 struct rte_vdev_device *dev;
272 struct rte_devargs *devargs;
273 int ret;
274
275 if (name == NULL)
276 return -EINVAL;
277
278 devargs = alloc_devargs(name, args);
279
280 if (!devargs)
281 return -ENOMEM;
282
283 dev = calloc(1, sizeof(*dev));
284 if (!dev) {
285 ret = -ENOMEM;
286 goto fail;
287 }
288
289 dev->device.bus = &rte_vdev_bus;
290 dev->device.numa_node = SOCKET_ID_ANY;
291
292 if (find_vdev(name)) {
293 /*
294 * A vdev is expected to have only one port.
295 * So there is no reason to try probing again,
296 * even with new arguments.
297 */
298 ret = -EEXIST;
299 goto fail;
300 }
301
302 if (init)
303 rte_devargs_insert(&devargs);
304 dev->device.devargs = devargs;
305 dev->device.name = devargs->name;
306 TAILQ_INSERT_TAIL(&vdev_device_list, dev, next);
307
308 if (p_dev)
309 *p_dev = dev;
310
311 return 0;
312fail:
313 rte_devargs_reset(devargs);
314 free(devargs);
315 free(dev);
316 return ret;
317}
318
319int
320rte_vdev_init(const char *name, const char *args)

Callers 2

rte_vdev_initFunction · 0.85
vdev_actionFunction · 0.85

Calls 6

alloc_devargsFunction · 0.85
callocFunction · 0.85
rte_devargs_insertFunction · 0.85
rte_devargs_resetFunction · 0.85
find_vdevFunction · 0.70
freeFunction · 0.50

Tested by

no test coverage detected