Module Name:    src
Committed By:   yamaguchi
Date:           Thu Mar 23 01:36:50 UTC 2023

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

Log Message:
vioif(4): stop interrupt before schedule handler


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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.86 src/sys/dev/pci/if_vioif.c:1.87
--- src/sys/dev/pci/if_vioif.c:1.86	Thu Mar 23 01:33:20 2023
+++ src/sys/dev/pci/if_vioif.c	Thu Mar 23 01:36:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.86 2023/03/23 01:33:20 yamaguchi Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.87 2023/03/23 01:36: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.86 2023/03/23 01:33:20 yamaguchi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.87 2023/03/23 01:36:50 yamaguchi Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1685,6 +1685,7 @@ vioif_rx_handle_locked(void *xrxq, u_int
 	struct virtio_softc *vsc = vq->vq_owner;
 	struct vioif_softc *sc = device_private(virtio_child(vsc));
 	bool more;
+	int enqueued;
 
 	KASSERT(mutex_owned(rxq->rxq_lock));
 	KASSERT(!rxq->rxq_stopping);
@@ -1694,8 +1695,10 @@ vioif_rx_handle_locked(void *xrxq, u_int
 		vioif_rx_sched_handle(sc, rxq);
 		return;
 	}
-	more = virtio_start_vq_intr(vsc, rxq->rxq_vq);
-	if (more) {
+
+	enqueued = virtio_start_vq_intr(vsc, rxq->rxq_vq);
+	if (enqueued != 0) {
+		virtio_stop_vq_intr(vsc, rxq->rxq_vq);
 		vioif_rx_sched_handle(sc, rxq);
 		return;
 	}
@@ -1805,6 +1808,7 @@ vioif_tx_handle_locked(struct vioif_txqu
 	struct vioif_softc *sc = device_private(virtio_child(vsc));
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 	bool more;
+	int enqueued;
 
 	KASSERT(mutex_owned(txq->txq_lock));
 	KASSERT(!txq->txq_stopping);
@@ -1815,11 +1819,11 @@ vioif_tx_handle_locked(struct vioif_txqu
 		return;
 	}
 
-	if (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX)
-		more = virtio_postpone_intr_smart(vsc, vq);
-	else
-		more = virtio_start_vq_intr(vsc, vq);
-	if (more) {
+	enqueued = (virtio_features(vsc) & VIRTIO_F_RING_EVENT_IDX) ?
+	    virtio_postpone_intr_smart(vsc, vq):
+	    virtio_start_vq_intr(vsc, vq);
+	if (enqueued != 0) {
+		virtio_stop_vq_intr(vsc, vq);
 		vioif_tx_sched_handle(sc, txq);
 		return;
 	}

Reply via email to