From: Casey Leedom <leedom@chelsio.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, Casey Leedom <leedom@chelsio.com>
Subject: [PATCH net-26 4/5] cxgb4vf: Quiesce Virtual Interfaces on shutdown ...
Date: Fri, 11 Feb 2011 17:00:22 -0800 [thread overview]
Message-ID: <1297472423-15672-5-git-send-email-leedom@chelsio.com> (raw)
In-Reply-To: <1297472423-15672-1-git-send-email-leedom@chelsio.com>
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>
---
drivers/net/cxgb4vf/cxgb4vf_main.c | 41 ++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index daac6ed..f78d6e1 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -2886,6 +2886,46 @@ static void __devexit cxgb4vf_pci_remove(struct pci_dev *pdev)
}
/*
+ * "Shutdown" quiesce the device, stopping Ingress Packet and Interrupt
+ * delivery.
+ */
+static void __devexit cxgb4vf_pci_shutdown(struct pci_dev *pdev)
+{
+ struct adapter *adapter;
+ int pidx;
+
+ adapter = pci_get_drvdata(pdev);
+ if (!adapter)
+ return;
+
+ /*
+ * Disable all Virtual Interfaces. This will shut down the
+ * delivery of all ingress packets into the chip for these
+ * Virtual Interfaces.
+ */
+ for_each_port(adapter, pidx) {
+ struct net_device *netdev;
+ struct port_info *pi;
+
+ if (!test_bit(pidx, &adapter->registered_device_map))
+ continue;
+
+ netdev = adapter->port[pidx];
+ if (!netdev)
+ continue;
+
+ pi = netdev_priv(netdev);
+ t4vf_enable_vi(adapter, pi->viid, false, false);
+ }
+
+ /*
+ * Free up all Queues which will prevent further DMA and
+ * Interrupts allowing various internal pathways to drain.
+ */
+ t4vf_free_sge_resources(adapter);
+}
+
+/*
* PCI Device registration data structures.
*/
#define CH_DEVICE(devid, idx) \
@@ -2918,6 +2958,7 @@ static struct pci_driver cxgb4vf_driver = {
.id_table = cxgb4vf_pci_tbl,
.probe = cxgb4vf_pci_probe,
.remove = __devexit_p(cxgb4vf_pci_remove),
+ .shutdown = __devexit_p(cxgb4vf_pci_shutdown),
};
/*
--
1.7.0.4
next prev parent reply other threads:[~2011-02-12 1:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-12 1:00 [PATCH net-26 0/5] cxgb4vf: minor bug fixes Casey Leedom
2011-02-12 1:00 ` [PATCH net-26 1/5] cxgb4vf: Virtual Interfaces are always up Casey Leedom
2011-02-12 5:19 ` David Miller
2011-02-14 19:13 ` Casey Leedom
2011-02-14 22:31 ` Casey Leedom
2011-02-14 22:34 ` David Miller
2011-02-12 1:00 ` [PATCH net-26 2/5] cxgb4vf: Check driver parameters in the right place Casey Leedom
2011-02-12 1:00 ` [PATCH net-26 3/5] cxgb4vf: Behave properly when CONFIG_DEBUG_FS isn't defined Casey Leedom
2011-02-12 1:00 ` Casey Leedom [this message]
2011-02-12 7:17 ` [PATCH net-26 4/5] cxgb4vf: Quiesce Virtual Interfaces on shutdown Anirban Chakraborty
2011-02-14 19:01 ` Casey Leedom
2011-02-12 1:00 ` [PATCH net-26 5/5] cxgb4vf: Use defined Mailbox Timeout Casey Leedom
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1297472423-15672-5-git-send-email-leedom@chelsio.com \
--to=leedom@chelsio.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).