| 2002 | } |
| 2003 | |
| 2004 | static int |
| 2005 | cnxk_eth_dev_uninit(struct rte_eth_dev *eth_dev, bool reset) |
| 2006 | { |
| 2007 | struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); |
| 2008 | const struct eth_dev_ops *dev_ops = eth_dev->dev_ops; |
| 2009 | struct cnxk_pfc_cfg *pfc_cfg = &dev->pfc_cfg; |
| 2010 | struct cnxk_fc_cfg *fc_cfg = &dev->fc_cfg; |
| 2011 | struct rte_eth_pfc_queue_conf pfc_conf; |
| 2012 | struct roc_nix *nix = &dev->nix; |
| 2013 | struct rte_eth_fc_conf fc_conf; |
| 2014 | int rc, i; |
| 2015 | |
| 2016 | plt_free(eth_dev->security_ctx); |
| 2017 | eth_dev->security_ctx = NULL; |
| 2018 | |
| 2019 | /* Nothing to be done for secondary processes */ |
| 2020 | if (rte_eal_process_type() != RTE_PROC_PRIMARY) |
| 2021 | return 0; |
| 2022 | |
| 2023 | /* Disable switch hdr pkind */ |
| 2024 | roc_nix_switch_hdr_set(&dev->nix, 0, 0, 0, 0); |
| 2025 | |
| 2026 | /* Clear the flag since we are closing down */ |
| 2027 | dev->configured = 0; |
| 2028 | |
| 2029 | roc_nix_npc_rx_ena_dis(nix, false); |
| 2030 | |
| 2031 | /* Restore 802.3 Flow control configuration */ |
| 2032 | memset(&pfc_conf, 0, sizeof(struct rte_eth_pfc_queue_conf)); |
| 2033 | memset(&fc_conf, 0, sizeof(struct rte_eth_fc_conf)); |
| 2034 | if (fc_cfg->rx_pause || fc_cfg->tx_pause) { |
| 2035 | fc_conf.mode = RTE_ETH_FC_NONE; |
| 2036 | rc = cnxk_nix_flow_ctrl_set(eth_dev, &fc_conf); |
| 2037 | if (rc < 0) |
| 2038 | plt_err("Failed to reset control flow. error code(%d)", |
| 2039 | rc); |
| 2040 | } |
| 2041 | if (pfc_cfg->rx_pause_en || pfc_cfg->tx_pause_en) { |
| 2042 | for (i = 0; i < RTE_MAX(eth_dev->data->nb_rx_queues, |
| 2043 | eth_dev->data->nb_tx_queues); |
| 2044 | i++) { |
| 2045 | pfc_conf.mode = RTE_ETH_FC_NONE; |
| 2046 | pfc_conf.rx_pause.tc = ROC_NIX_PFC_CLASS_INVALID; |
| 2047 | pfc_conf.rx_pause.tx_qid = i; |
| 2048 | pfc_conf.tx_pause.tc = ROC_NIX_PFC_CLASS_INVALID; |
| 2049 | pfc_conf.tx_pause.rx_qid = i; |
| 2050 | rc = cnxk_nix_priority_flow_ctrl_queue_config(eth_dev, |
| 2051 | &pfc_conf); |
| 2052 | if (rc && rc != -ENOTSUP) |
| 2053 | plt_err("Failed to reset PFC. error code(%d)", rc); |
| 2054 | } |
| 2055 | } |
| 2056 | |
| 2057 | /* Disable and free rte_meter entries */ |
| 2058 | nix_meter_fini(dev); |
| 2059 | |
| 2060 | /* Disable and free rte_flow entries */ |
| 2061 | roc_npc_fini(&dev->npc); |
no test coverage detected