Date: Sun, 10 Jan 2021 14:11:00 GMT From: Vincenzo Maffione <vmaffione@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bb714db6d395 - main - netmap: vtnet: enable/disable krings on any interface reinit Message-ID: <202101101411.10AEB02x051475@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=bb714db6d39583a9fbf5d11849c5e2365e7c0d80 commit bb714db6d39583a9fbf5d11849c5e2365e7c0d80 Author: Vincenzo Maffione <vmaffione@FreeBSD.org> AuthorDate: 2021-01-10 14:09:00 +0000 Commit: Vincenzo Maffione <vmaffione@FreeBSD.org> CommitDate: 2021-01-10 14:10:09 +0000 netmap: vtnet: enable/disable krings on any interface reinit See 3d65fd97e85ab807f3b for a detailed explanation. PR: 252453 MFC after: 1 week --- sys/dev/netmap/if_vtnet_netmap.h | 6 ------ sys/dev/netmap/netmap.c | 4 ++++ sys/dev/virtio/network/if_vtnet.c | 10 ++++++++++ 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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101101411.10AEB02x051475>