ice_dcf_uninit_hw() releases the TM nodes and shaper profiles only
when the hierarchy gets committed.
If the application adds nodes or profiles but never commits them,
or the commit fails without clearing them, they leak on close and
reset.

Only clearing the bandwidth needs a committed hierarchy,
so releasing the TM config whenever QoS is supported.

Fixes: 775a25a372f5 ("net/ice: clear QoS bandwidth on DCF close")
Cc: [email protected]

Signed-off-by: Anurag Mandal <[email protected]>
---
 drivers/net/intel/ice/ice_dcf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/intel/ice/ice_dcf.c b/drivers/net/intel/ice/ice_dcf.c
index c2b557d0da..df4212267d 100644
--- a/drivers/net/intel/ice/ice_dcf.c
+++ b/drivers/net/intel/ice/ice_dcf.c
@@ -886,11 +886,11 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct 
ice_dcf_hw *hw)
        struct rte_intr_handle *intr_handle = pci_dev->intr_handle;
        uint16_t i;
 
-       if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS)
-               if (hw->tm_conf.committed) {
+       if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_QOS) {
+               if (hw->tm_conf.committed)
                        ice_dcf_clear_bw(hw);
-                       ice_dcf_tm_conf_uninit(eth_dev);
-               }
+               ice_dcf_tm_conf_uninit(eth_dev);
+       }
 
        ice_dcf_disable_irq0(hw);
        rte_intr_disable(intr_handle);
-- 
2.25.1

Reply via email to