diff options
| author | yamaguchi <yamaguchi@NetBSD.org> | 2020-05-25 09:45:40 +0000 |
|---|---|---|
| committer | yamaguchi <yamaguchi@NetBSD.org> | 2020-05-25 09:45:40 +0000 |
| commit | cf283744321816dcc37c183af40f6f261c0f7b64 (patch) | |
| tree | 3bff37140e6e8c1316346532cbeb89128f8e1329 /sys/dev | |
| parent | 392563ce0e687148e6ec04f4241b06c608b9b060 (diff) | |
Stop all processing related to rx before that related to tx for safety
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/if_vioif.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sys/dev/pci/if_vioif.c b/sys/dev/pci/if_vioif.c index 7fff6bfb21e..936ea396bdc 100644 --- a/sys/dev/pci/if_vioif.c +++ b/sys/dev/pci/if_vioif.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vioif.c,v 1.63 2020/05/25 09:41:27 yamaguchi Exp $ */ +/* $NetBSD: if_vioif.c,v 1.64 2020/05/25 09:45:40 yamaguchi Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.63 2020/05/25 09:41:27 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.64 2020/05/25 09:45:40 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -1121,11 +1121,11 @@ vioif_disable_interrupt_vqpairs(struct vioif_softc *sc) int i; for (i = 0; i < sc->sc_act_nvq_pairs; i++) { - txq = &sc->sc_txq[i]; rxq = &sc->sc_rxq[i]; + txq = &sc->sc_txq[i]; - virtio_stop_vq_intr(vsc, txq->txq_vq); virtio_stop_vq_intr(vsc, rxq->rxq_vq); + virtio_stop_vq_intr(vsc, txq->txq_vq); } } @@ -1202,13 +1202,13 @@ vioif_stop(struct ifnet *ifp, int disable) txq = &sc->sc_txq[i]; rxq = &sc->sc_rxq[i]; - mutex_enter(txq->txq_lock); - txq->txq_stopping = true; - mutex_exit(txq->txq_lock); - mutex_enter(rxq->rxq_lock); rxq->rxq_stopping = true; mutex_exit(rxq->rxq_lock); + + mutex_enter(txq->txq_lock); + txq->txq_stopping = true; + mutex_exit(txq->txq_lock); } /* disable interrupts */ @@ -1225,14 +1225,13 @@ vioif_stop(struct ifnet *ifp, int disable) txq = &sc->sc_txq[i]; rxq = &sc->sc_rxq[i]; - mutex_enter(txq->txq_lock); - mutex_exit(txq->txq_lock); - mutex_enter(rxq->rxq_lock); mutex_exit(rxq->rxq_lock); + vioif_work_wait(sc->sc_txrx_workqueue, &rxq->rxq_work); + mutex_enter(txq->txq_lock); + mutex_exit(txq->txq_lock); vioif_work_wait(sc->sc_txrx_workqueue, &txq->txq_work); - vioif_work_wait(sc->sc_txrx_workqueue, &rxq->rxq_work); } for (i = 0; i < sc->sc_act_nvq_pairs; i++) { |
