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

Function rte_eth_dev_create

dpdk/lib/ethdev/ethdev_driver.c:281–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281int
282rte_eth_dev_create(struct rte_device *device, const char *name,
283 size_t priv_data_size,
284 ethdev_bus_specific_init ethdev_bus_specific_init,
285 void *bus_init_params,
286 ethdev_init_t ethdev_init, void *init_params)
287{
288 struct rte_eth_dev *ethdev;
289 int retval;
290
291 if (*ethdev_init == NULL)
292 return -EINVAL;
293
294 if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
295 ethdev = rte_eth_dev_allocate(name);
296 if (!ethdev)
297 return -ENODEV;
298
299 if (priv_data_size) {
300 /* try alloc private data on device-local node. */
301 ethdev->data->dev_private = rte_zmalloc_socket(
302 name, priv_data_size, RTE_CACHE_LINE_SIZE,
303 device->numa_node);
304
305 /* fall back to alloc on any socket on failure */
306 if (ethdev->data->dev_private == NULL) {
307 ethdev->data->dev_private = rte_zmalloc(name,
308 priv_data_size, RTE_CACHE_LINE_SIZE);
309
310 if (ethdev->data->dev_private == NULL) {
311 RTE_ETHDEV_LOG(ERR, "failed to allocate private data\n");
312 retval = -ENOMEM;
313 goto probe_failed;
314 }
315 /* got memory, but not local, so issue warning */
316 RTE_ETHDEV_LOG(WARNING,
317 "Private data for ethdev '%s' not allocated on local NUMA node %d\n",
318 device->name, device->numa_node);
319 }
320 }
321 } else {
322 ethdev = rte_eth_dev_attach_secondary(name);
323 if (!ethdev) {
324 RTE_ETHDEV_LOG(ERR,
325 "secondary process attach failed, ethdev doesn't exist\n");
326 return -ENODEV;
327 }
328 }
329
330 ethdev->device = device;
331
332 if (ethdev_bus_specific_init) {
333 retval = ethdev_bus_specific_init(ethdev, bus_init_params);
334 if (retval) {
335 RTE_ETHDEV_LOG(ERR,
336 "ethdev bus specific initialisation failed\n");
337 goto probe_failed;
338 }

Callers 15

ipn3ke_vswitch_probeFunction · 0.85
eth_ionic_dev_probeFunction · 0.85
eth_ngbe_pci_probeFunction · 0.85
eth_enic_pci_probeFunction · 0.85
nfp_flower_repr_allocFunction · 0.85
cpfl_vport_createFunction · 0.85
cpfl_repr_createFunction · 0.85
eth_ixgbe_pci_probeFunction · 0.85
idpf_pci_probeFunction · 0.85
eth_ice_dcf_pci_probeFunction · 0.85
eth_txgbe_pci_probeFunction · 0.85
sfc_repr_createFunction · 0.85

Calls 7

rte_eal_process_typeFunction · 0.85
rte_eth_dev_allocateFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_zmallocFunction · 0.85
rte_eth_dev_release_portFunction · 0.85

Tested by

no test coverage detected