Previously it was assumed that idpf_vc_core_deinit() is always being
called during reset handling, where the MBX is disabled by the reset,
with remove being the exception. Ideally the driver needs to communicate
the changes to FW in all instances where the MBX is not already disabled.
Remove the remove_in_prog check from idpf_vc_core_deinit() as the MBX was
already disabled while handling the reset via libie_ctlq_xn_shutdown()
in the service task. This is also needed by the following patch,
introducing PCI callbacks support, specifically in the case where FLR is
being triggered by a user, in which case, the driver still has the ability
to notify FW before the reset happens.

Add call to libie_ctlq_xn_shutdown() in idpf_shutdown() to avoid a possible
regression where long timeouts can happen on shutdown when FW is down.

Signed-off-by: Emil Tantilov <[email protected]>
Reviewed-by: Jay Bhat <[email protected]>
Reviewed-by: Madhu Chittim <[email protected]>
Reviewed-by: Aleksandr Loktionov <[email protected]>
---
 drivers/net/ethernet/intel/idpf/idpf_main.c     |  2 ++
 drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 10 +---------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c 
b/drivers/net/ethernet/intel/idpf/idpf_main.c
index 5a191644b28e..064bf3583824 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -191,6 +191,8 @@ static void idpf_shutdown(struct pci_dev *pdev)
 
        cancel_delayed_work_sync(&adapter->serv_task);
        cancel_delayed_work_sync(&adapter->vc_event_task);
+       if (adapter->xnm)
+               libie_ctlq_xn_shutdown(adapter->xnm);
        idpf_vc_core_deinit(adapter);
        idpf_deinit_dflt_mbx(adapter);
 
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c 
b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index e0e510b1f1e1..cc5aeec3d00b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3195,24 +3195,16 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
  */
 void idpf_vc_core_deinit(struct idpf_adapter *adapter)
 {
-       bool remove_in_prog;
-
        if (!test_bit(IDPF_VC_CORE_INIT, adapter->flags))
                return;
 
-       /* Avoid transaction timeouts when called during reset */
-       remove_in_prog = test_bit(IDPF_REMOVE_IN_PROG, adapter->flags);
-       if (!remove_in_prog)
-               libie_ctlq_xn_shutdown(adapter->xnm);
-
        idpf_ptp_release(adapter);
        idpf_deinit_task(adapter);
        idpf_idc_deinit_core_aux_device(adapter);
        idpf_rel_rx_pt_lkup(adapter);
        idpf_intr_rel(adapter);
 
-       if (remove_in_prog)
-               libie_ctlq_xn_shutdown(adapter->xnm);
+       libie_ctlq_xn_shutdown(adapter->xnm);
 
        cancel_delayed_work_sync(&adapter->serv_task);
        cancel_delayed_work_sync(&adapter->mbx_task);
-- 
2.37.3

Reply via email to