Author: sephe
Date: Fri Oct 14 05:41:51 2016
New Revision: 307262
URL: https://svnweb.freebsd.org/changeset/base/307262

Log:
  hyperv/hn: Management parts always need suspend and resume.
  
  MFC after:    3 days
  Sponsored by: Microsoft

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 14 05:32:47 
2016        (r307261)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Fri Oct 14 05:41:51 
2016        (r307262)
@@ -354,6 +354,8 @@ static void hn_suspend(struct hn_softc *
 static void hn_suspend_data(struct hn_softc *);
 static void hn_suspend_mgmt(struct hn_softc *);
 static void hn_resume(struct hn_softc *);
+static void hn_resume_data(struct hn_softc *);
+static void hn_resume_mgmt(struct hn_softc *);
 static void hn_rx_drain(struct vmbus_channel *);
 static void hn_tx_resume(struct hn_softc *, int);
 static void hn_tx_ring_qflush(struct hn_tx_ring *);
@@ -1689,8 +1691,11 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
                        hn_set_lro_lenlim(sc, HN_LRO_LENLIM_MIN(ifp));
 #endif
 
-               if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-                       hn_suspend(sc);
+               /*
+                * Suspend this interface before the synthetic parts
+                * are ripped.
+                */
+               hn_suspend(sc);
 
                /*
                 * Detach the synthetics parts, i.e. NVS and RNDIS.
@@ -1708,9 +1713,10 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, 
                        hn_set_chim_size(sc, sc->hn_chim_szmax);
                hn_set_tso_maxsize(sc, hn_tso_maxlen, ifr->ifr_mtu);
 
-               /* All done!  Resume now. */
-               if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-                       hn_resume(sc);
+               /*
+                * All done!  Resume the interface now.
+                */
+               hn_resume(sc);
 
                HN_UNLOCK(sc);
                break;
@@ -3717,7 +3723,8 @@ static void
 hn_suspend(struct hn_softc *sc)
 {
 
-       hn_suspend_data(sc);
+       if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING)
+               hn_suspend_data(sc);
        hn_suspend_mgmt(sc);
 }
 
@@ -3739,7 +3746,7 @@ hn_tx_resume(struct hn_softc *sc, int tx
 }
 
 static void
-hn_resume(struct hn_softc *sc)
+hn_resume_data(struct hn_softc *sc)
 {
        int i;
 
@@ -3779,6 +3786,11 @@ hn_resume(struct hn_softc *sc)
                 */
                taskqueue_enqueue(txr->hn_tx_taskq, &txr->hn_txeof_task);
        }
+}
+
+static void
+hn_resume_mgmt(struct hn_softc *sc)
+{
 
        /*
         * Kick off link status check.
@@ -3788,6 +3800,15 @@ hn_resume(struct hn_softc *sc)
 }
 
 static void
+hn_resume(struct hn_softc *sc)
+{
+
+       if (sc->hn_ifp->if_drv_flags & IFF_DRV_RUNNING)
+               hn_resume_data(sc);
+       hn_resume_mgmt(sc);
+}
+
+static void
 hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt)
 {
        const struct hn_nvs_hdr *hdr;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to