netmap: vtnet: enable/disable krings on any interface reinit

See 3d65fd97e8 for a detailed explanation.

PR:             252453
MFC after:      1 week
This commit is contained in:
Vincenzo Maffione 2021-01-10 14:09:00 +00:00
parent 4ba9ad0dc3
commit bb714db6d3
3 changed files with 14 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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: