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

Function iavf_dev_close

dpdk/drivers/net/iavf/iavf_ethdev.c:2828–2929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2826}
2827
2828static int
2829iavf_dev_close(struct rte_eth_dev *dev)
2830{
2831 struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
2832 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
2833 struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
2834 struct iavf_adapter *adapter =
2835 IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
2836 struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
2837 int ret;
2838
2839 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
2840 return 0;
2841
2842 if (adapter->closed) {
2843 ret = 0;
2844 goto out;
2845 }
2846
2847 ret = iavf_dev_stop(dev);
2848
2849 /*
2850 * Release redundant queue resource when close the dev
2851 * so that other vfs can re-use the queues.
2852 */
2853 if (vf->lv_enabled) {
2854 ret = iavf_request_queues(dev, IAVF_MAX_NUM_QUEUES_DFLT);
2855 if (ret)
2856 PMD_DRV_LOG(ERR, "Reset the num of queues failed");
2857
2858 vf->max_rss_qregion = IAVF_MAX_NUM_QUEUES_DFLT;
2859 }
2860
2861 adapter->closed = true;
2862
2863 /* free iAVF security device context all related resources */
2864 iavf_security_ctx_destroy(adapter);
2865
2866 iavf_flow_flush(dev, NULL);
2867 iavf_flow_uninit(adapter);
2868
2869 /*
2870 * disable promiscuous mode before reset vf
2871 * it is a workaround solution when work with kernel driver
2872 * and it is not the normal way
2873 */
2874 if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
2875 iavf_config_promisc(adapter, false, false);
2876
2877 iavf_vf_reset(hw);
2878 iavf_shutdown_adminq(hw);
2879 if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
2880 /* disable uio intr before callback unregister */
2881 rte_intr_disable(intr_handle);
2882
2883 /* unregister callback func from eal lib */
2884 rte_intr_callback_unregister(intr_handle,
2885 iavf_dev_interrupt_handler, dev);

Callers 1

iavf_dev_uninitFunction · 0.85

Calls 15

rte_eal_process_typeFunction · 0.85
iavf_dev_stopFunction · 0.85
iavf_request_queuesFunction · 0.85
iavf_flow_flushFunction · 0.85
iavf_flow_uninitFunction · 0.85
iavf_config_promiscFunction · 0.85
iavf_vf_resetFunction · 0.85
iavf_shutdown_adminqFunction · 0.85
iavf_disable_irq0Function · 0.85
iavf_tm_conf_uninitFunction · 0.85
rte_freeFunction · 0.85

Tested by

no test coverage detected