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

Function ngbe_dev_start

dpdk/drivers/net/ngbe/ngbe_ethdev.c:953–1146  ·  view source on GitHub ↗

* Configure device link speed and setup link. * It returns 0 on success. */

Source from the content-addressed store, hash-verified

951 * It returns 0 on success.
952 */
953static int
954ngbe_dev_start(struct rte_eth_dev *dev)
955{
956 struct ngbe_hw *hw = ngbe_dev_hw(dev);
957 struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev);
958 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
959 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
960 uint32_t intr_vector = 0;
961 int err;
962 bool link_up = false, negotiate = false;
963 uint32_t speed = 0;
964 uint32_t allowed_speeds = 0;
965 int mask = 0;
966 int status;
967 uint32_t *link_speeds;
968
969 PMD_INIT_FUNC_TRACE();
970
971 /* disable uio/vfio intr/eventfd mapping */
972 rte_intr_disable(intr_handle);
973
974 /* stop adapter */
975 hw->adapter_stopped = 0;
976
977 /* reinitialize adapter, this calls reset and start */
978 hw->nb_rx_queues = dev->data->nb_rx_queues;
979 hw->nb_tx_queues = dev->data->nb_tx_queues;
980 status = ngbe_pf_reset_hw(hw);
981 if (status != 0)
982 return -1;
983 hw->mac.start_hw(hw);
984 hw->mac.get_link_status = true;
985
986 ngbe_set_pcie_master(hw, true);
987
988 /* configure PF module if SRIOV enabled */
989 ngbe_pf_host_configure(dev);
990
991 ngbe_dev_phy_intr_setup(dev);
992
993 /* check and configure queue intr-vector mapping */
994 if ((rte_intr_cap_multiple(intr_handle) ||
995 !RTE_ETH_DEV_SRIOV(dev).active) &&
996 dev->data->dev_conf.intr_conf.rxq != 0) {
997 intr_vector = dev->data->nb_rx_queues;
998 if (rte_intr_efd_enable(intr_handle, intr_vector))
999 return -1;
1000 }
1001
1002 if (rte_intr_dp_is_en(intr_handle)) {
1003 if (rte_intr_vec_list_alloc(intr_handle, "intr_vec",
1004 dev->data->nb_rx_queues)) {
1005 PMD_INIT_LOG(ERR,
1006 "Failed to allocate %d rx_queues intr_vec",
1007 dev->data->nb_rx_queues);
1008 return -ENOMEM;
1009 }
1010 }

Callers

nothing calls this directly

Calls 15

ngbe_dev_hwFunction · 0.85
ngbe_pf_reset_hwFunction · 0.85
ngbe_set_pcie_masterFunction · 0.85
ngbe_pf_host_configureFunction · 0.85
ngbe_dev_phy_intr_setupFunction · 0.85
rte_intr_vec_list_allocFunction · 0.85
ngbe_configure_msixFunction · 0.85
ngbe_dev_tx_initFunction · 0.85
ngbe_dev_rx_initFunction · 0.85
ngbe_vlan_offload_configFunction · 0.85
ngbe_pbthresh_setFunction · 0.85
ngbe_configure_portFunction · 0.85

Tested by

no test coverage detected