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

Function txgbe_dev_close

dpdk/drivers/net/txgbe/txgbe_ethdev.c:2049–2131  ·  view source on GitHub ↗

* Reset and stop device. */

Source from the content-addressed store, hash-verified

2047 * Reset and stop device.
2048 */
2049static int
2050txgbe_dev_close(struct rte_eth_dev *dev)
2051{
2052 struct txgbe_hw *hw = TXGBE_DEV_HW(dev);
2053 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
2054 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
2055 int retries = 0;
2056 int ret;
2057
2058 PMD_INIT_FUNC_TRACE();
2059
2060 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2061 return 0;
2062
2063 txgbe_pf_reset_hw(hw);
2064
2065 ret = txgbe_dev_stop(dev);
2066
2067 /* Let firmware take over control of hardware */
2068 wr32m(hw, TXGBE_PORTCTL, TXGBE_PORTCTL_DRVLOAD, 0);
2069
2070 txgbe_dev_free_queues(dev);
2071
2072 txgbe_set_pcie_master(hw, false);
2073
2074 /* reprogram the RAR[0] in case user changed it. */
2075 txgbe_set_rar(hw, 0, hw->mac.addr, 0, true);
2076
2077 /* Unlock any pending hardware semaphore */
2078 txgbe_swfw_lock_reset(hw);
2079
2080 /* disable uio intr before callback unregister */
2081 rte_intr_disable(intr_handle);
2082
2083 do {
2084 ret = rte_intr_callback_unregister(intr_handle,
2085 txgbe_dev_interrupt_handler, dev);
2086 if (ret >= 0 || ret == -ENOENT) {
2087 break;
2088 } else if (ret != -EAGAIN) {
2089 PMD_INIT_LOG(ERR,
2090 "intr callback unregister failed: %d",
2091 ret);
2092 }
2093 rte_delay_ms(100);
2094 } while (retries++ < (10 + TXGBE_LINK_UP_TIME));
2095
2096 /* cancel all alarm handler before remove dev */
2097 rte_eal_alarm_cancel(txgbe_dev_interrupt_delayed_handler, dev);
2098 rte_eal_alarm_cancel(txgbe_dev_detect_sfp, dev);
2099 rte_eal_alarm_cancel(txgbe_dev_setup_link_alarm_handler, dev);
2100
2101 /* uninitialize PF if max_vfs not zero */
2102 txgbe_pf_host_uninit(dev);
2103
2104 rte_free(dev->data->mac_addrs);
2105 dev->data->mac_addrs = NULL;
2106

Callers 1

eth_txgbe_dev_uninitFunction · 0.85

Calls 15

rte_eal_process_typeFunction · 0.85
txgbe_pf_reset_hwFunction · 0.85
txgbe_dev_stopFunction · 0.85
txgbe_dev_free_queuesFunction · 0.85
txgbe_set_pcie_masterFunction · 0.85
txgbe_set_rarFunction · 0.85
txgbe_swfw_lock_resetFunction · 0.85
rte_delay_msFunction · 0.85
txgbe_pf_host_uninitFunction · 0.85
rte_freeFunction · 0.85
txgbe_fdir_filter_uninitFunction · 0.85

Tested by

no test coverage detected