Skip to content

Commit 7e9c262

Browse files
Casey Leedomdavem330
authored andcommitted
cxgb4vf: Quiesce Virtual Interfaces on shutdown ...
When a Virtual Machine is rebooted, KVM currently fails to issue a Function Level Reset against any "Attached PCI Devices" (AKA "PCI Passthrough"). In addition to leaving the attached device in a random state in the next booted kernel (which sort of violates the entire idea of a reboot reseting hardware state), this leaves our peer thinking that the link is still up. (Note that a bug has been filed with the KVM folks, #25332, but there's been no response on that as of yet.) So, we add a "->shutdown()" method for the Virtual Function PCI Device to handle administrative shutdowns like a reboot. Signed-off-by: Casey Leedom <leedom@chelsio.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 843635e commit 7e9c262

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

drivers/net/cxgb4vf/cxgb4vf_main.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,6 +2861,46 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev)
28612861
pci_release_regions(pdev);
28622862
}
28632863

2864+
/*
2865+
* "Shutdown" quiesce the device, stopping Ingress Packet and Interrupt
2866+
* delivery.
2867+
*/
2868+
static void __devexit cxgb4vf_pci_shutdown(struct pci_dev *pdev)
2869+
{
2870+
struct adapter *adapter;
2871+
int pidx;
2872+
2873+
adapter = pci_get_drvdata(pdev);
2874+
if (!adapter)
2875+
return;
2876+
2877+
/*
2878+
* Disable all Virtual Interfaces. This will shut down the
2879+
* delivery of all ingress packets into the chip for these
2880+
* Virtual Interfaces.
2881+
*/
2882+
for_each_port(adapter, pidx) {
2883+
struct net_device *netdev;
2884+
struct port_info *pi;
2885+
2886+
if (!test_bit(pidx, &adapter->registered_device_map))
2887+
continue;
2888+
2889+
netdev = adapter->port[pidx];
2890+
if (!netdev)
2891+
continue;
2892+
2893+
pi = netdev_priv(netdev);
2894+
t4vf_enable_vi(adapter, pi->viid, false, false);
2895+
}
2896+
2897+
/*
2898+
* Free up all Queues which will prevent further DMA and
2899+
* Interrupts allowing various internal pathways to drain.
2900+
*/
2901+
t4vf_free_sge_resources(adapter);
2902+
}
2903+
28642904
/*
28652905
* PCI Device registration data structures.
28662906
*/
@@ -2894,6 +2934,7 @@ static struct pci_driver cxgb4vf_driver = {
28942934
.id_table = cxgb4vf_pci_tbl,
28952935
.probe = cxgb4vf_pci_probe,
28962936
.remove = __devexit_p(cxgb4vf_pci_remove),
2937+
.shutdown = __devexit_p(cxgb4vf_pci_shutdown),
28972938
};
28982939

28992940
/*

0 commit comments

Comments
 (0)