net/ice: fix memzone leak after device init failure
authorHaiyue Wang <haiyue.wang@intel.com>
Fri, 13 Aug 2021 06:21:54 +0000 (14:21 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Sun, 29 Aug 2021 11:13:54 +0000 (13:13 +0200)
When flow engine initialization or FXP resource reset failed, it needs
to free the memory zone and unregister the interrupt callback.

Bugzilla ID: 752
Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine")
Fixes: 7615a6895009 ("net/ice: rework for generic flow enabling")
Fixes: 7edc7158d771 ("net/ice: cleanup RSS/FDIR profile on device init")
Cc: stable@dpdk.org
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_ethdev.c
drivers/net/ice/ice_fdir_filter.c

index a4cd39c..0683296 100644 (file)
@@ -2139,20 +2139,26 @@ ice_dev_init(struct rte_eth_dev *dev)
                ret = ice_flow_init(ad);
                if (ret) {
                        PMD_INIT_LOG(ERR, "Failed to initialize flow");
-                       return ret;
+                       goto err_flow_init;
                }
        }
 
        ret = ice_reset_fxp_resource(hw);
        if (ret) {
                PMD_INIT_LOG(ERR, "Failed to reset fxp resource");
-               return ret;
+               goto err_flow_init;
        }
 
        pf->supported_rxdid = ice_get_supported_rxdid(hw);
 
        return 0;
 
+err_flow_init:
+       ice_flow_uninit(ad);
+       rte_intr_disable(intr_handle);
+       ice_pf_disable_irq0(hw);
+       rte_intr_callback_unregister(intr_handle,
+                                    ice_interrupt_handler, dev);
 err_pf_setup:
        ice_res_pool_destroy(&pf->msix_pool);
 err_msix_pool_init:
index 82adb1f..7ba65b9 100644 (file)
@@ -651,8 +651,10 @@ ice_fdir_teardown(struct ice_pf *pf)
 
        ice_tx_queue_release(pf->fdir.txq);
        pf->fdir.txq = NULL;
+       rte_eth_dma_zone_free(eth_dev, "fdir_tx_ring", ICE_FDIR_QUEUE_ID);
        ice_rx_queue_release(pf->fdir.rxq);
        pf->fdir.rxq = NULL;
+       rte_eth_dma_zone_free(eth_dev, "fdir_rx_ring", ICE_FDIR_QUEUE_ID);
        ice_fdir_prof_rm_all(pf);
        ice_fdir_prof_free(hw);
        ice_release_vsi(vsi);