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

Function eth_ionic_dev_probe

dpdk/drivers/net/ionic/ionic_ethdev.c:1080–1223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1078}
1079
1080int
1081eth_ionic_dev_probe(void *bus_dev, struct rte_device *rte_dev,
1082 struct ionic_bars *bars, const struct ionic_dev_intf *intf,
1083 uint16_t device_id, uint16_t vendor_id)
1084{
1085 char name[RTE_ETH_NAME_MAX_LEN];
1086 struct ionic_adapter *adapter;
1087 struct ionic_hw *hw;
1088 unsigned long i;
1089 int err;
1090
1091 /* Check structs (trigger error at compilation time) */
1092 ionic_struct_size_checks();
1093
1094 /* Multi-process not supported */
1095 if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
1096 err = -EPERM;
1097 goto err;
1098 }
1099
1100 adapter = rte_zmalloc("ionic", sizeof(*adapter), RTE_CACHE_LINE_SIZE);
1101 if (!adapter) {
1102 IONIC_PRINT(ERR, "OOM");
1103 err = -ENOMEM;
1104 goto err;
1105 }
1106
1107 adapter->bus_dev = bus_dev;
1108 hw = &adapter->hw;
1109
1110 /* Vendor and Device ID need to be set before init of shared code */
1111 hw->device_id = device_id;
1112 hw->vendor_id = vendor_id;
1113
1114 err = ionic_init_mac(hw);
1115 if (err != 0) {
1116 IONIC_PRINT(ERR, "Mac init failed: %d", err);
1117 err = -EIO;
1118 goto err_free_adapter;
1119 }
1120
1121 adapter->bars.num_bars = bars->num_bars;
1122 for (i = 0; i < bars->num_bars; i++) {
1123 adapter->bars.bar[i].vaddr = bars->bar[i].vaddr;
1124 adapter->bars.bar[i].bus_addr = bars->bar[i].bus_addr;
1125 adapter->bars.bar[i].len = bars->bar[i].len;
1126 }
1127
1128 if (intf->setup == NULL) {
1129 IONIC_PRINT(ERR, "Device setup function is mandatory");
1130 goto err_free_adapter;
1131 }
1132
1133 adapter->intf = intf;
1134
1135 /* Parse device arguments */
1136 if (adapter->intf->devargs) {
1137 err = (*adapter->intf->devargs)(adapter, rte_dev->devargs);

Callers 1

eth_ionic_pci_probeFunction · 0.85

Calls 14

ionic_struct_size_checksFunction · 0.85
rte_eal_process_typeFunction · 0.85
rte_zmallocFunction · 0.85
ionic_init_macFunction · 0.85
ionic_setupFunction · 0.85
ionic_identifyFunction · 0.85
ionic_initFunction · 0.85
ionic_port_identifyFunction · 0.85
ionic_port_initFunction · 0.85
ionic_lif_identifyFunction · 0.85
ionic_lifs_sizeFunction · 0.85
snprintfFunction · 0.85

Tested by

no test coverage detected