Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci vioif(4): do not schedule packet processing whil...



details:   https://anonhg.NetBSD.org/src/rev/da8e9f4414fa
branches:  trunk
changeset: 364422:da8e9f4414fa
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Thu Mar 24 07:47:50 2022 +0000

description:
vioif(4): do not schedule packet processing while stopping the device

diffstat:

 sys/dev/pci/if_vioif.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 05f220b5910b -r da8e9f4414fa sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c    Thu Mar 24 02:24:24 2022 +0000
+++ b/sys/dev/pci/if_vioif.c    Thu Mar 24 07:47:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vioif.c,v 1.71 2021/10/28 01:36:43 yamaguchi Exp $  */
+/*     $NetBSD: if_vioif.c,v 1.72 2022/03/24 07:47:50 yamaguchi Exp $  */
 
 /*
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.71 2021/10/28 01:36:43 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.72 2022/03/24 07:47:50 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1736,6 +1736,11 @@
 vioif_rx_sched_handle(struct vioif_softc *sc, struct vioif_rxqueue *rxq)
 {
 
+       KASSERT(mutex_owned(rxq->rxq_lock));
+
+       if (rxq->rxq_stopping)
+               return;
+
        if (rxq->rxq_workqueue)
                vioif_work_add(sc->sc_txrx_workqueue, &rxq->rxq_work);
        else
@@ -1853,6 +1858,11 @@
 vioif_tx_sched_handle(struct vioif_softc *sc, struct vioif_txqueue *txq)
 {
 
+       KASSERT(mutex_owned(txq->txq_lock));
+
+       if (txq->txq_stopping)
+               return;
+
        if (txq->txq_workqueue)
                vioif_work_add(sc->sc_txrx_workqueue, &txq->txq_work);
        else



Home | Main Index | Thread Index | Old Index