aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/netmap/if_vtnet_netmap.h6
-rw-r--r--sys/dev/netmap/netmap.c4
-rw-r--r--sys/dev/virtio/network/if_vtnet.c10
3 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h
index a44cc13baae2..f787bf573a28 100644
--- a/sys/dev/netmap/if_vtnet_netmap.h
+++ b/sys/dev/netmap/if_vtnet_netmap.h
@@ -40,9 +40,6 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state)
struct ifnet *ifp = na->ifp;
struct vtnet_softc *sc = ifp->if_softc;
- /* Stop all txsync/rxsync and disable them. */
- netmap_disable_all_rings(ifp);
-
/*
* Trigger a device reinit, asking vtnet_init_locked() to
* also enter or exit netmap mode.
@@ -53,9 +50,6 @@ vtnet_netmap_reg(struct netmap_adapter *na, int state)
: VTNET_INIT_NETMAP_EXIT);
VTNET_CORE_UNLOCK(sc);
- /* Enable txsync/rxsync again. */
- netmap_enable_all_rings(ifp);
-
return (0);
}
diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c
index cf85671cae55..cabbd35aec20 100644
--- a/sys/dev/netmap/netmap.c
+++ b/sys/dev/netmap/netmap.c
@@ -619,6 +619,10 @@ netmap_set_all_rings(struct netmap_adapter *na, int stopped)
if (!nm_netmap_on(na))
return;
+ if (netmap_verbose) {
+ nm_prinf("%s: %sable all rings", na->name,
+ (stopped ? "dis" : "en"));
+ }
for_rx_tx(t) {
for (i = 0; i < netmap_real_rings(na, t); i++) {
netmap_set_ring(na, i, t, stopped);
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
index cff9fa5831f2..2bfa72734f9e 100644
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -2900,6 +2900,11 @@ vtnet_stop(struct vtnet_softc *sc)
/* Only advisory. */
vtnet_disable_interrupts(sc);
+#ifdef DEV_NETMAP
+ /* Stop any pending txsync/rxsync and disable them. */
+ netmap_disable_all_rings(ifp);
+#endif /* DEV_NETMAP */
+
/*
* Stop the host adapter. This resets it to the pre-initialized
* state. It will not generate any interrupts until after it is
@@ -3165,6 +3170,11 @@ vtnet_init_locked(struct vtnet_softc *sc, int init_mode)
vtnet_update_link_status(sc);
callout_reset(&sc->vtnet_tick_ch, hz, vtnet_tick, sc);
+#ifdef DEV_NETMAP
+ /* Re-enable txsync/rxsync. */
+ netmap_enable_all_rings(ifp);
+#endif /* DEV_NETMAP */
+
return;
fail: