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

Function eth_em_dev_init

dpdk/drivers/net/e1000/em_ethdev.c:245–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245static int
246eth_em_dev_init(struct rte_eth_dev *eth_dev)
247{
248 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
249 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
250 struct e1000_adapter *adapter =
251 E1000_DEV_PRIVATE(eth_dev->data->dev_private);
252 struct e1000_hw *hw =
253 E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
254 struct e1000_vfta * shadow_vfta =
255 E1000_DEV_PRIVATE_TO_VFTA(eth_dev->data->dev_private);
256
257 eth_dev->dev_ops = &eth_em_ops;
258 eth_dev->rx_queue_count = eth_em_rx_queue_count;
259 eth_dev->rx_descriptor_status = eth_em_rx_descriptor_status;
260 eth_dev->tx_descriptor_status = eth_em_tx_descriptor_status;
261 eth_dev->rx_pkt_burst = (eth_rx_burst_t)&eth_em_recv_pkts;
262 eth_dev->tx_pkt_burst = (eth_tx_burst_t)&eth_em_xmit_pkts;
263 eth_dev->tx_pkt_prepare = (eth_tx_prep_t)&eth_em_prep_pkts;
264
265 /* for secondary processes, we don't initialise any further as primary
266 * has already done this work. Only check we don't need a different
267 * RX function */
268 if (rte_eal_process_type() != RTE_PROC_PRIMARY){
269 if (eth_dev->data->scattered_rx)
270 eth_dev->rx_pkt_burst =
271 (eth_rx_burst_t)&eth_em_recv_scattered_pkts;
272 return 0;
273 }
274
275 rte_eth_copy_pci_info(eth_dev, pci_dev);
276
277 hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
278 hw->device_id = pci_dev->id.device_id;
279 adapter->stopped = 0;
280
281 /* For ICH8 support we'll need to map the flash memory BAR */
282 if (eth_em_dev_is_ich8(hw))
283 hw->flash_address = (void *)pci_dev->mem_resource[1].addr;
284
285 if (e1000_setup_init_funcs(hw, TRUE) != E1000_SUCCESS ||
286 em_hw_init(hw) != 0) {
287 PMD_INIT_LOG(ERR, "port_id %d vendorID=0x%x deviceID=0x%x: "
288 "failed to init HW",
289 eth_dev->data->port_id, pci_dev->id.vendor_id,
290 pci_dev->id.device_id);
291 return -ENODEV;
292 }
293
294 /* Allocate memory for storing MAC addresses */
295 eth_dev->data->mac_addrs = rte_zmalloc("e1000", RTE_ETHER_ADDR_LEN *
296 hw->mac.rar_entry_count, 0);
297 if (eth_dev->data->mac_addrs == NULL) {
298 PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to "
299 "store MAC addresses",
300 RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count);
301 return -ENOMEM;
302 }

Callers

nothing calls this directly

Calls 9

rte_eal_process_typeFunction · 0.85
rte_eth_copy_pci_infoFunction · 0.85
eth_em_dev_is_ich8Function · 0.85
e1000_setup_init_funcsFunction · 0.85
em_hw_initFunction · 0.85
rte_zmallocFunction · 0.85
rte_ether_addr_copyFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected