aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen/netfront
diff options
context:
space:
mode:
authorRoger Pau Monné <royger@FreeBSD.org>2017-03-07 09:16:51 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2017-03-07 09:16:51 +0000
commit8dee0e9bd64849deca80da9052c806e764ef026c (patch)
tree8a90eb2b376d4cfc1722f58a22b0ec4bf0f7b581 /sys/dev/xen/netfront
parentacd63c37d6702be2ca95b55e5d62baff86c97f71 (diff)
downloadsrc-8dee0e9bd64849deca80da9052c806e764ef026c.tar.gz
src-8dee0e9bd64849deca80da9052c806e764ef026c.zip
xen: add support for canceled suspend
When running on Xen, it's possible that a suspend request to the hypervisor fails (return from HYPERVISOR_suspend different than 0). This means that the suspend hasn't succeed, and the resume procedure needs to properly handle this case. First of all, when such situation happens there's no need to reset the vector callback, hypercall page, shared info, event channels or grant table, because it's state is preserved. Also, the PV drivers don't need to be reset to the initial state, since the connection with the backed has not been interrupted. Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D9635
Notes
Notes: svn path=/head/; revision=314840
Diffstat (limited to 'sys/dev/xen/netfront')
-rw-r--r--sys/dev/xen/netfront/netfront.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/dev/xen/netfront/netfront.c b/sys/dev/xen/netfront/netfront.c
index 459712ab3fdc..dea722a35a43 100644
--- a/sys/dev/xen/netfront/netfront.c
+++ b/sys/dev/xen/netfront/netfront.c
@@ -439,6 +439,20 @@ static int
netfront_resume(device_t dev)
{
struct netfront_info *info = device_get_softc(dev);
+ u_int i;
+
+ if (xen_suspend_cancelled) {
+ for (i = 0; i < info->num_queues; i++) {
+ XN_RX_LOCK(&info->rxq[i]);
+ XN_TX_LOCK(&info->txq[i]);
+ }
+ netfront_carrier_on(info);
+ for (i = 0; i < info->num_queues; i++) {
+ XN_RX_UNLOCK(&info->rxq[i]);
+ XN_TX_UNLOCK(&info->txq[i]);
+ }
+ return (0);
+ }
netif_disconnect_backend(info);
return (0);