aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2021-01-10 14:09:00 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2021-01-10 14:10:09 +0000
commitbb714db6d39583a9fbf5d11849c5e2365e7c0d80 (patch)
tree3474288f2af0f401200766f9d8666fd7c748a839
parent4ba9ad0dc316940f32065b05f24259f942c0692d (diff)
downloadsrc-bb714db6d39583a9fbf5d11849c5e2365e7c0d80.tar.gz
src-bb714db6d39583a9fbf5d11849c5e2365e7c0d80.zip
netmap: vtnet: enable/disable krings on any interface reinit
See 3d65fd97e85ab807f3b for a detailed explanation. PR: 252453 MFC after: 1 week
-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: