The representor info array is only freed by ice_dcf_dev_uninit(),
which runs on device removal.
Closing the DCF port with rte_eth_dev_close() releases the port
without freeing it.

Free it in ice_dcf_dev_close().
ice_dcf_dev_reset() needs the info to survive, as init notifies
the representors again, so move the rest of close into
ice_dcf_dev_teardown() and call that from reset instead.

Fixes: c7e1a1a3bfeb ("net/ice: refactor DCF VLAN handling")
Cc: [email protected]

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

diff --git a/drivers/net/intel/ice/ice_dcf_ethdev.c 
b/drivers/net/intel/ice/ice_dcf_ethdev.c
index c78b290b0d..26c22265eb 100644
--- a/drivers/net/intel/ice/ice_dcf_ethdev.c
+++ b/drivers/net/intel/ice/ice_dcf_ethdev.c
@@ -1660,20 +1660,28 @@ ice_dcf_init_repr_info(struct ice_dcf_adapter 
*dcf_adapter)
        return 0;
 }
 
-static int
-ice_dcf_dev_close(struct rte_eth_dev *dev)
+static void
+ice_dcf_dev_teardown(struct rte_eth_dev *dev)
 {
        struct ice_dcf_adapter *adapter = dev->data->dev_private;
 
-       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-               return 0;
-
        ice_dcf_vf_repr_notify_all(adapter, false);
        (void)ice_dcf_dev_stop(dev);
 
        ice_free_queues(dev);
        ice_dcf_uninit_parent_adapter(dev);
        ice_dcf_uninit_hw(dev, &adapter->real_hw);
+}
+
+static int
+ice_dcf_dev_close(struct rte_eth_dev *dev)
+{
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return 0;
+
+       ice_dcf_dev_teardown(dev);
+       /* representor info survives ice_dcf_dev_reset, so only release it here 
*/
+       ice_dcf_free_repr_info(dev->data->dev_private);
 
        return 0;
 }
@@ -1861,9 +1869,8 @@ ice_dcf_dev_reset(struct rte_eth_dev *dev)
                ice_dcf_reset_hw(dev, hw);
        }
 
-       ret = ice_dcf_dev_close(dev);
-       if (ret)
-               return ret;
+       if (rte_eal_process_type() == RTE_PROC_PRIMARY)
+               ice_dcf_dev_teardown(dev);
 
        ret = ice_dcf_dev_init(dev);
 
-- 
2.25.1

Reply via email to