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

Function eth_avp_dev_init

dpdk/drivers/net/avp/avp_ethdev.c:948–1020  ·  view source on GitHub ↗

* This function is based on probe() function in avp_pci.c * It returns 0 on success. */

Source from the content-addressed store, hash-verified

946 * It returns 0 on success.
947 */
948static int
949eth_avp_dev_init(struct rte_eth_dev *eth_dev)
950{
951 struct avp_dev *avp =
952 AVP_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
953 struct rte_pci_device *pci_dev;
954 int ret;
955
956 pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
957 eth_dev->dev_ops = &avp_eth_dev_ops;
958 eth_dev->rx_pkt_burst = &avp_recv_pkts;
959 eth_dev->tx_pkt_burst = &avp_xmit_pkts;
960
961 if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
962 /*
963 * no setup required on secondary processes. All data is saved
964 * in dev_private by the primary process. All resource should
965 * be mapped to the same virtual address so all pointers should
966 * be valid.
967 */
968 if (eth_dev->data->scattered_rx) {
969 PMD_DRV_LOG(NOTICE, "AVP device configured for chained mbufs\n");
970 eth_dev->rx_pkt_burst = avp_recv_scattered_pkts;
971 eth_dev->tx_pkt_burst = avp_xmit_scattered_pkts;
972 }
973 return 0;
974 }
975
976 rte_eth_copy_pci_info(eth_dev, pci_dev);
977 eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
978
979 /* Check current migration status */
980 if (avp_dev_migration_pending(eth_dev)) {
981 PMD_DRV_LOG(ERR, "VM live migration operation in progress\n");
982 return -EBUSY;
983 }
984
985 /* Check BAR resources */
986 ret = avp_dev_check_regions(eth_dev);
987 if (ret < 0) {
988 PMD_DRV_LOG(ERR, "Failed to validate BAR resources, ret=%d\n",
989 ret);
990 return ret;
991 }
992
993 /* Enable interrupts */
994 ret = avp_dev_setup_interrupts(eth_dev);
995 if (ret < 0) {
996 PMD_DRV_LOG(ERR, "Failed to enable interrupts, ret=%d\n", ret);
997 return ret;
998 }
999
1000 /* Handle each subtype */
1001 ret = avp_dev_create(pci_dev, eth_dev);
1002 if (ret < 0) {
1003 PMD_DRV_LOG(ERR, "Failed to create device, ret=%d\n", ret);
1004 return ret;
1005 }

Callers

nothing calls this directly

Calls 8

rte_eal_process_typeFunction · 0.85
rte_eth_copy_pci_infoFunction · 0.85
avp_dev_check_regionsFunction · 0.85
avp_dev_setup_interruptsFunction · 0.85
avp_dev_createFunction · 0.85
rte_zmallocFunction · 0.85
rte_ether_addr_copyFunction · 0.85

Tested by

no test coverage detected