Date: Tue, 19 Jan 2021 05:08:30 GMT From: Bryan Venteicher <bryanv@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 4f18e23f8432 - main - if_vtnet: Schedule Rx task if pending items when enabling interrupt Message-ID: <202101190508.10J58UiY086095@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by bryanv: URL: https://cgit.FreeBSD.org/src/commit/?id=4f18e23f84320fb126ce3ccc899aa3f99b7ae925 commit 4f18e23f84320fb126ce3ccc899aa3f99b7ae925 Author: Bryan Venteicher <bryanv@FreeBSD.org> AuthorDate: 2021-01-19 04:55:25 +0000 Commit: Bryan Venteicher <bryanv@FreeBSD.org> CommitDate: 2021-01-19 04:55:25 +0000 if_vtnet: Schedule Rx task if pending items when enabling interrupt Prior to V1, the driver would enable interrupts and then notify the host that DRIVER_OK. Since for V1, DRIVER_OK needs to be set before notifying the virtqueues, there may be items in the queues waiting to be processed by the time interrupts are enabled. This fixes a bug where the Rx queue would appear stuck, only being usable after an interface down/up cycle. Reviewed by: grehan (mentor) Differential Revision: https://reviews.freebsd.org/D27922 --- sys/dev/virtio/network/if_vtnet.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e3a42413d5cd..dc232d769fa6 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -3120,11 +3120,13 @@ vtnet_stop_rendezvous(struct vtnet_softc *sc) struct vtnet_txq *txq; int i; + VTNET_CORE_LOCK_ASSERT(sc); + /* * Lock and unlock the per-queue mutex so we known the stop * state is visible. Doing only the active queues should be * sufficient, but it does not cost much extra to do all the - * queues. Note we hold the core mutex here too. + * queues. */ for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { rxq = &sc->vtnet_rxqs[i]; @@ -3168,8 +3170,8 @@ vtnet_stop(struct vtnet_softc *sc) virtio_stop(dev); vtnet_stop_rendezvous(sc); - /* Free any mbufs left in the virtqueues. */ vtnet_drain_rxtx_queues(sc); + sc->vtnet_act_vq_pairs = 1; } static int @@ -4278,10 +4280,14 @@ vtnet_txq_disable_intr(struct vtnet_txq *txq) static void vtnet_enable_rx_interrupts(struct vtnet_softc *sc) { + struct vtnet_rxq *rxq; int i; - for (i = 0; i < sc->vtnet_act_vq_pairs; i++) - vtnet_rxq_enable_intr(&sc->vtnet_rxqs[i]); + for (i = 0; i < sc->vtnet_act_vq_pairs; i++) { + rxq = &sc->vtnet_rxqs[i]; + if (vtnet_rxq_enable_intr(rxq) != 0) + taskqueue_enqueue(rxq->vtnrx_tq, &rxq->vtnrx_intrtask); + } } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101190508.10J58UiY086095>