The device watchdog polls VFGEN_RSTAT to detect a VF reset and drives
the auto-reset recovery path.
It is disabled when a link-up event arrives, on the assumption that a
working link means no reset is in flight.
That assumption does not hold during recovery.

Keep the watchdog armed while vf->in_reset_recovery is set, and enable
it on VIRTCHNL_EVENT_RESET_IMPENDING, so it stays armed from the PF
reset notification until recovery completes.

Signed-off-by: Anurag Mandal <[email protected]>
---
 drivers/net/intel/iavf/iavf_vchnl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/intel/iavf/iavf_vchnl.c 
b/drivers/net/intel/iavf/iavf_vchnl.c
index e04afe1d6a..3ceebce454 100644
--- a/drivers/net/intel/iavf/iavf_vchnl.c
+++ b/drivers/net/intel/iavf/iavf_vchnl.c
@@ -260,7 +260,7 @@ iavf_handle_link_change_event(struct rte_eth_dev *dev,
         * (link is down or a VF reset is in progress); the watchdog drives
         * auto-reset recovery, so it must remain armed in those cases.
         */
-       if (vf->link_up && !vf->vf_reset)
+       if (vf->link_up && !vf->vf_reset && !vf->in_reset_recovery)
                iavf_dev_watchdog_disable(adapter);
        else
                iavf_dev_watchdog_enable(adapter);
@@ -574,6 +574,7 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t 
*msg,
                if (!vf->vf_reset) {
                        vf->vf_reset = true;
                        iavf_set_no_poll(adapter, false);
+                       iavf_dev_watchdog_enable(adapter);
                        if (adapter->devargs.no_poll_on_link_down)
                                iavf_dev_tx_drain(dev);
                        iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET,
-- 
2.34.1

Reply via email to