| 1413 | #define I40E_ALARM_INTERVAL 50000 /* us */ |
| 1414 | |
| 1415 | static int |
| 1416 | eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused) |
| 1417 | { |
| 1418 | struct rte_pci_device *pci_dev; |
| 1419 | struct rte_intr_handle *intr_handle; |
| 1420 | struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private); |
| 1421 | struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); |
| 1422 | struct i40e_vsi *vsi; |
| 1423 | int ret; |
| 1424 | uint32_t len, val; |
| 1425 | uint8_t aq_fail = 0; |
| 1426 | |
| 1427 | PMD_INIT_FUNC_TRACE(); |
| 1428 | |
| 1429 | dev->dev_ops = &i40e_eth_dev_ops; |
| 1430 | dev->rx_queue_count = i40e_dev_rx_queue_count; |
| 1431 | dev->rx_descriptor_status = i40e_dev_rx_descriptor_status; |
| 1432 | dev->tx_descriptor_status = i40e_dev_tx_descriptor_status; |
| 1433 | dev->rx_pkt_burst = i40e_recv_pkts; |
| 1434 | dev->tx_pkt_burst = i40e_xmit_pkts; |
| 1435 | dev->tx_pkt_prepare = i40e_prep_pkts; |
| 1436 | |
| 1437 | /* for secondary processes, we don't initialise any further as primary |
| 1438 | * has already done this work. Only check we don't need a different |
| 1439 | * RX function */ |
| 1440 | if (rte_eal_process_type() != RTE_PROC_PRIMARY){ |
| 1441 | i40e_set_rx_function(dev); |
| 1442 | i40e_set_tx_function(dev); |
| 1443 | return 0; |
| 1444 | } |
| 1445 | i40e_set_default_ptype_table(dev); |
| 1446 | pci_dev = RTE_ETH_DEV_TO_PCI(dev); |
| 1447 | intr_handle = pci_dev->intr_handle; |
| 1448 | |
| 1449 | rte_eth_copy_pci_info(dev, pci_dev); |
| 1450 | |
| 1451 | pf->adapter = I40E_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private); |
| 1452 | pf->dev_data = dev->data; |
| 1453 | |
| 1454 | hw->back = I40E_PF_TO_ADAPTER(pf); |
| 1455 | hw->hw_addr = (uint8_t *)(pci_dev->mem_resource[0].addr); |
| 1456 | if (!hw->hw_addr) { |
| 1457 | PMD_INIT_LOG(ERR, |
| 1458 | "Hardware is not available, as address is NULL"); |
| 1459 | return -ENODEV; |
| 1460 | } |
| 1461 | |
| 1462 | hw->vendor_id = pci_dev->id.vendor_id; |
| 1463 | hw->device_id = pci_dev->id.device_id; |
| 1464 | hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id; |
| 1465 | hw->subsystem_device_id = pci_dev->id.subsystem_device_id; |
| 1466 | hw->bus.device = pci_dev->addr.devid; |
| 1467 | hw->bus.func = pci_dev->addr.function; |
| 1468 | hw->adapter_stopped = 0; |
| 1469 | hw->adapter_closed = 0; |
| 1470 | |
| 1471 | /* Init switch device pointer */ |
| 1472 | hw->switch_dev = NULL; |
no test coverage detected