src/dpdk/drivers/net/hinic/base/hinic_pmd_nicio.c
int hinic_init_nicio(struct hinic_hwdev *hwdev)
{
	int rc;

	hwdev->nic_io = rte_zmalloc("hinic_nicio", sizeof(*hwdev->nic_io),
				      RTE_CACHE_LINE_SIZE);
	if (!hwdev->nic_io) {
		PMD_DRV_LOG(ERR, "Allocate nic_io failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		return -ENOMEM;
	}
	hwdev->nic_io->hwdev = hwdev;

	/* alloc root working queue set */
	rc = hinic_alloc_nicio(hwdev);
	if (rc) {
		PMD_DRV_LOG(ERR, "Allocate nic_io failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		goto allc_nicio_fail;
	}

	rc = hinic_init_nic_hwdev(hwdev);
	if (rc) {
		PMD_DRV_LOG(ERR, "Initialize hwdev failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		goto init_nic_hwdev_fail;
	}

	return 0;

init_nic_hwdev_fail:
	hinic_free_nicio(hwdev);

allc_nicio_fail:
	rte_free(hwdev->nic_io);
	return rc;
}
/* alloc nic hwdev and init function table */
alloc nic hwdev and init function table
alloc nic hwdev and init function table
int hinic_init_nicio(struct hinic_hwdev *hwdev)
{
	int rc;
	hwdev->nic_io = rte_zmalloc("hinic_nicio", sizeof(*hwdev->nic_io),
				      RTE_CACHE_LINE_SIZE);
	if (!hwdev->nic_io) {
		PMD_DRV_LOG(ERR, "Allocate nic_io failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		return -ENOMEM;
	}
	hwdev->nic_io->hwdev = hwdev;
	rc = hinic_alloc_nicio(hwdev);
	if (rc) {
		PMD_DRV_LOG(ERR, "Allocate nic_io failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		goto allc_nicio_fail;
	}
	rc = hinic_init_nic_hwdev(hwdev);
	if (rc) {
		PMD_DRV_LOG(ERR, "Initialize hwdev failed, dev_name: %s",
			    hwdev->pcidev_hdl->name);
		goto init_nic_hwdev_fail;
	}
	return 0;
init_nic_hwdev_fail:
	hinic_free_nicio(hwdev);
allc_nicio_fail:
	rte_free(hwdev->nic_io);
	return rc;
}
int hinic_init_nicio ( struct hinic_hwdev * hwdev ) { int rc ; hwdev -> nic_io = rte_zmalloc ( " " , sizeof ( * hwdev -> nic_io ) , RTE_CACHE_LINE_SIZE ) ; if ( ! hwdev -> nic_io ) { PMD_DRV_LOG ( ERR , " " , hwdev -> pcidev_hdl -> name ) ; return - ENOMEM ; } hwdev -> nic_io -> hwdev = hwdev ; rc = hinic_alloc_nicio ( hwdev ) ; if ( rc ) { PMD_DRV_LOG ( ERR , " " , hwdev -> pcidev_hdl -> name ) ; goto allc_nicio_fail ; } rc = hinic_init_nic_hwdev ( hwdev ) ; if ( rc ) { PMD_DRV_LOG ( ERR , " " , hwdev -> pcidev_hdl -> name ) ; goto init_nic_hwdev_fail ; } return 0 ; init_nic_hwdev_fail : hinic_free_nicio ( hwdev ) ; allc_nicio_fail : rte_free ( hwdev -> nic_io ) ; return rc ; }
alloc nic hwdev and init function table
alloc nic hwdev and init function table
/* alloc root working queue set */