Module Name:    src
Committed By:   yamaguchi
Date:           Thu Mar 24 07:47:50 UTC 2022

Modified Files:
        src/sys/dev/pci: if_vioif.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/if_vioif.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.71 src/sys/dev/pci/if_vioif.c:1.72
--- src/sys/dev/pci/if_vioif.c:1.71	Thu Oct 28 01:36:43 2021
+++ src/sys/dev/pci/if_vioif.c	Thu Mar 24 07:47:50 2022
@@ -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 @@ static void
 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 @@ static void
 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

Reply via email to