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

Function ixgbe_dev_close

dpdk/drivers/net/ixgbe/ixgbe_ethdev.c:3066–3137  ·  view source on GitHub ↗

* Reset and stop device. */

Source from the content-addressed store, hash-verified

3064 * Reset and stop device.
3065 */
3066static int
3067ixgbe_dev_close(struct rte_eth_dev *dev)
3068{
3069 struct ixgbe_hw *hw =
3070 IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
3071 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
3072 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
3073 int retries = 0;
3074 int ret;
3075
3076 PMD_INIT_FUNC_TRACE();
3077 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
3078 return 0;
3079
3080 ixgbe_pf_reset_hw(hw);
3081
3082 ret = ixgbe_dev_stop(dev);
3083
3084 ixgbe_dev_free_queues(dev);
3085
3086 ixgbe_disable_pcie_master(hw);
3087
3088 /* reprogram the RAR[0] in case user changed it. */
3089 ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
3090
3091 /* Unlock any pending hardware semaphore */
3092 ixgbe_swfw_lock_reset(hw);
3093
3094 /* disable uio intr before callback unregister */
3095 rte_intr_disable(intr_handle);
3096
3097 do {
3098 ret = rte_intr_callback_unregister(intr_handle,
3099 ixgbe_dev_interrupt_handler, dev);
3100 if (ret >= 0 || ret == -ENOENT) {
3101 break;
3102 } else if (ret != -EAGAIN) {
3103 PMD_INIT_LOG(ERR,
3104 "intr callback unregister failed: %d",
3105 ret);
3106 }
3107 rte_delay_ms(100);
3108 } while (retries++ < (10 + IXGBE_LINK_UP_TIME));
3109
3110 /* cancel the delay handler before remove dev */
3111 rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, dev);
3112
3113 /* uninitialize PF if max_vfs not zero */
3114 ixgbe_pf_host_uninit(dev);
3115
3116 /* remove all the fdir filters & hash */
3117 ixgbe_fdir_filter_uninit(dev);
3118
3119 /* remove all the L2 tunnel filters & hash */
3120 ixgbe_l2_tn_filter_uninit(dev);
3121
3122 /* Remove all ntuple filters of the device */
3123 ixgbe_ntuple_filter_uninit(dev);

Callers 1

eth_ixgbe_dev_uninitFunction · 0.85

Calls 15

rte_eal_process_typeFunction · 0.85
ixgbe_pf_reset_hwFunction · 0.85
ixgbe_dev_stopFunction · 0.85
ixgbe_dev_free_queuesFunction · 0.85
ixgbe_set_rarFunction · 0.85
ixgbe_swfw_lock_resetFunction · 0.85
rte_delay_msFunction · 0.85
ixgbe_pf_host_uninitFunction · 0.85
ixgbe_fdir_filter_uninitFunction · 0.85

Tested by

no test coverage detected