net/qede: print adapter info during init failure
[dpdk.git] / drivers / net / ice / ice_ethdev.c
index c126d96..022b58c 100644 (file)
@@ -41,6 +41,15 @@ static const char * const ice_valid_args[] = {
 
 int ice_logtype_init;
 int ice_logtype_driver;
+#ifdef RTE_LIBRTE_ICE_DEBUG_RX
+int ice_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_ICE_DEBUG_TX
+int ice_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE
+int ice_logtype_tx_free;
+#endif
 
 static int ice_dev_configure(struct rte_eth_dev *dev);
 static int ice_dev_start(struct rte_eth_dev *dev);
@@ -1924,6 +1933,11 @@ ice_dev_init(struct rte_eth_dev *dev)
                goto err_init_mac;
        }
 
+       /* Pass the information to the rte_eth_dev_close() that it should also
+        * release the private port resources.
+        */
+       dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
        ret = ice_res_pool_init(&pf->msix_pool, 1,
                                hw->func_caps.common_cap.num_msix_vectors - 1);
        if (ret) {
@@ -2090,6 +2104,9 @@ ice_dev_close(struct rte_eth_dev *dev)
 {
        struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
        struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+       struct rte_flow *p_flow;
 
        /* Since stop will make link down, then the link event will be
         * triggered, disable the irq firstly to avoid the port_infoe etc
@@ -2109,22 +2126,6 @@ ice_dev_close(struct rte_eth_dev *dev)
        rte_free(hw->port_info);
        hw->port_info = NULL;
        ice_shutdown_all_ctrlq(hw);
-       rte_free(pf->proto_xtr);
-       pf->proto_xtr = NULL;
-}
-
-static int
-ice_dev_uninit(struct rte_eth_dev *dev)
-{
-       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-       struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-       struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-       struct rte_flow *p_flow;
-
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-               return 0;
-
-       ice_dev_close(dev);
 
        dev->dev_ops = NULL;
        dev->rx_pkt_burst = NULL;
@@ -2146,6 +2147,12 @@ ice_dev_uninit(struct rte_eth_dev *dev)
                ice_free_switch_filter_rule(p_flow->rule);
                rte_free(p_flow);
        }
+}
+
+static int
+ice_dev_uninit(struct rte_eth_dev *dev)
+{
+       ice_dev_close(dev);
 
        return 0;
 }
@@ -4281,4 +4288,22 @@ RTE_INIT(ice_init_log)
        ice_logtype_driver = rte_log_register("pmd.net.ice.driver");
        if (ice_logtype_driver >= 0)
                rte_log_set_level(ice_logtype_driver, RTE_LOG_NOTICE);
+
+#ifdef RTE_LIBRTE_ICE_DEBUG_RX
+       ice_logtype_rx = rte_log_register("pmd.net.ice.rx");
+       if (ice_logtype_rx >= 0)
+               rte_log_set_level(ice_logtype_rx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_ICE_DEBUG_TX
+       ice_logtype_tx = rte_log_register("pmd.net.ice.tx");
+       if (ice_logtype_tx >= 0)
+               rte_log_set_level(ice_logtype_tx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE
+       ice_logtype_tx_free = rte_log_register("pmd.net.ice.tx_free");
+       if (ice_logtype_tx_free >= 0)
+               rte_log_set_level(ice_logtype_tx_free, RTE_LOG_DEBUG);
+#endif
 }