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

Function ntb_create

dpdk/drivers/raw/ntb/ntb.c:1452–1496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1450}
1451
1452static int
1453ntb_create(struct rte_pci_device *pci_dev, int socket_id)
1454{
1455 char name[RTE_RAWDEV_NAME_MAX_LEN];
1456 struct rte_rawdev *rawdev = NULL;
1457 int ret;
1458
1459 if (pci_dev == NULL) {
1460 NTB_LOG(ERR, "Invalid pci_dev.");
1461 return -EINVAL;
1462 }
1463
1464 memset(name, 0, sizeof(name));
1465 snprintf(name, RTE_RAWDEV_NAME_MAX_LEN, "NTB:%x:%02x.%x",
1466 pci_dev->addr.bus, pci_dev->addr.devid,
1467 pci_dev->addr.function);
1468
1469 NTB_LOG(INFO, "Init %s on NUMA node %d", name, socket_id);
1470
1471 /* Allocate device structure. */
1472 rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct ntb_hw),
1473 socket_id);
1474 if (rawdev == NULL) {
1475 NTB_LOG(ERR, "Unable to allocate rawdev.");
1476 return -EINVAL;
1477 }
1478
1479 rawdev->dev_ops = &ntb_ops;
1480 rawdev->device = &pci_dev->device;
1481 rawdev->driver_name = pci_dev->driver->driver.name;
1482
1483 ret = ntb_init_hw(rawdev, pci_dev);
1484 if (ret < 0) {
1485 NTB_LOG(ERR, "Unable to init ntb hw.");
1486 goto fail;
1487 }
1488
1489 return ret;
1490
1491fail:
1492 if (rawdev != NULL)
1493 rte_rawdev_pmd_release(rawdev);
1494
1495 return ret;
1496}
1497
1498static int
1499ntb_destroy(struct rte_pci_device *pci_dev)

Callers 1

ntb_probeFunction · 0.85

Calls 5

memsetFunction · 0.85
snprintfFunction · 0.85
rte_rawdev_pmd_allocateFunction · 0.85
ntb_init_hwFunction · 0.85
rte_rawdev_pmd_releaseFunction · 0.85

Tested by

no test coverage detected