• Brett Creeley's avatar
    ice: Fix removing driver while bare-metal VFs pass traffic · f844d521
    Brett Creeley authored
    Currently, if there are bare-metal VFs passing traffic and the ice
    driver is removed, there is a possibility of VFs triggering a Tx timeout
    right before iavf_remove(). This is causing iavf_close() to not be
    called because there is a check in the beginning of iavf_remove() that
    bails out early if (adapter->state < IAVF_DOWN_PENDING). This makes it
    so some resources do not get cleaned up. Specifically, free_irq()
    is never called for data interrupts, which results in the following line
    of code to trigger:
    
    pci_disable_msix()
    	free_msi_irqs()
    		...
    		BUG_ON(irq_has_action(entry->irq + i));
    		...
    
    To prevent the Tx timeout from occurring on the VF during driver unload
    for ice and the iavf there are a few changes that are needed.
    
    [1] Don't disable all active VF Tx/Rx queues prior to calling
    pci_disable_sriov.
    
    [2] Call ice_free_vfs() before disabling the service task.
    
    [3] Disable VF resets when the ice driver is being unloaded by setting
    the pf->state flag __ICE_VF_RESETS_DISABLED.
    
    Changing [1] and [2] allow each VF driver's remove flow to successfully
    send VIRTCHNL requests, which includes queue disable. This prevents
    unexpected Tx timeouts because the PF driver is no longer forcefully
    disabling queues.
    
    Due to [1] and [2] there is a possibility that the PF driver will get a
    VFLR or reset request over VIRTCHNL from a VF during PF driver unload.
    Prevent that by doing [3].
    Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    f844d521
ice.h 15.8 KB