| 617 | } |
| 618 | |
| 619 | static int |
| 620 | nfp_net_init(struct rte_eth_dev *eth_dev) |
| 621 | { |
| 622 | int err; |
| 623 | uint16_t port; |
| 624 | uint64_t rx_base; |
| 625 | uint64_t tx_base; |
| 626 | struct nfp_hw *hw; |
| 627 | struct nfp_net_hw *net_hw; |
| 628 | struct nfp_pf_dev *pf_dev; |
| 629 | struct rte_pci_device *pci_dev; |
| 630 | struct nfp_app_fw_nic *app_fw_nic; |
| 631 | |
| 632 | pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); |
| 633 | net_hw = eth_dev->data->dev_private; |
| 634 | |
| 635 | /* Use backpointer here to the PF of this eth_dev */ |
| 636 | pf_dev = net_hw->pf_dev; |
| 637 | |
| 638 | /* Use backpointer to the CoreNIC app struct */ |
| 639 | app_fw_nic = NFP_PRIV_TO_APP_FW_NIC(pf_dev->app_fw_priv); |
| 640 | |
| 641 | port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx; |
| 642 | if (port > 7) { |
| 643 | PMD_DRV_LOG(ERR, "Port value is wrong"); |
| 644 | return -ENODEV; |
| 645 | } |
| 646 | |
| 647 | hw = &net_hw->super; |
| 648 | |
| 649 | PMD_INIT_LOG(DEBUG, "Working with physical port number: %hu, " |
| 650 | "NFP internal port number: %d", port, net_hw->nfp_idx); |
| 651 | |
| 652 | rte_eth_copy_pci_info(eth_dev, pci_dev); |
| 653 | |
| 654 | if (pf_dev->multi_pf.enabled) |
| 655 | hw->ctrl_bar = pf_dev->ctrl_bar; |
| 656 | else |
| 657 | hw->ctrl_bar = pf_dev->ctrl_bar + (port * NFP_NET_CFG_BAR_SZ); |
| 658 | |
| 659 | net_hw->mac_stats = pf_dev->mac_stats_bar + |
| 660 | (net_hw->nfp_idx * NFP_MAC_STATS_SIZE); |
| 661 | |
| 662 | PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar); |
| 663 | PMD_INIT_LOG(DEBUG, "MAC stats: %p", net_hw->mac_stats); |
| 664 | |
| 665 | err = nfp_net_common_init(pci_dev, net_hw); |
| 666 | if (err != 0) |
| 667 | return err; |
| 668 | |
| 669 | err = nfp_net_tlv_caps_parse(eth_dev); |
| 670 | if (err != 0) { |
| 671 | PMD_INIT_LOG(ERR, "Failed to parser TLV caps"); |
| 672 | return err; |
| 673 | } |
| 674 | |
| 675 | err = nfp_ipsec_init(eth_dev); |
| 676 | if (err != 0) { |
no test coverage detected