Currently, when handling a hardware reset, the uninit path skips
releasing the event handler reference while in_reset_recovery is set,
to prevent premature teardown of the event handler thread. However, the
subsequent re-init call unconditionally increments the reference count,
inflating ndev on every reset cycle. On the final device removal, the
count never reaches zero and the event handler thread is never joined.

Fix it by also skipping the event handler reference acquisition during
reset recovery, matching the symmetric skip in the uninit path so the
count stays stable across each reset cycle.

Fixes: 3e6a5d2d310a ("net/iavf: add devargs to enable VF auto-reset")
Cc: [email protected]

Signed-off-by: Ciara Loftus <[email protected]>
---
 drivers/net/intel/iavf/iavf_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/intel/iavf/iavf_ethdev.c 
b/drivers/net/intel/iavf/iavf_ethdev.c
index a38132e80e..ec1ad02826 100644
--- a/drivers/net/intel/iavf/iavf_ethdev.c
+++ b/drivers/net/intel/iavf/iavf_ethdev.c
@@ -3031,7 +3031,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
        adapter->tpid = RTE_ETHER_TYPE_VLAN; /* VLAN TPID set to 0x8100 by 
default */
        rte_spinlock_init(&adapter->phc_sync_lock);
 
-       if (iavf_dev_event_handler_init())
+       if (!vf->in_reset_recovery && iavf_dev_event_handler_init())
                goto init_vf_err;
 
        if (iavf_init_vf(eth_dev) != 0) {
-- 
2.43.0

Reply via email to