Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Take TX/RX locks when sc_stopping = true in if_stop
details: https://anonhg.NetBSD.org/src/rev/57e923216cd6
branches: trunk
changeset: 805218:57e923216cd6
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Dec 24 02:48:24 2014 +0000
description:
Take TX/RX locks when sc_stopping = true in if_stop
Taking the locks is needed to ensure ongoing TX/RX operations finish.
Otherwise, if_stop may run during TX/RX operations.
diffstat:
sys/dev/pci/if_vioif.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (31 lines):
diff -r 5fab1bb6d7ec -r 57e923216cd6 sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c Wed Dec 24 00:36:09 2014 +0000
+++ b/sys/dev/pci/if_vioif.c Wed Dec 24 02:48:24 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vioif.c,v 1.12 2014/12/19 06:54:40 ozaki-r Exp $ */
+/* $NetBSD: if_vioif.c,v 1.13 2014/12/24 02:48:24 ozaki-r Exp $ */
/*
* Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.12 2014/12/19 06:54:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.13 2014/12/24 02:48:24 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -707,7 +707,12 @@
struct vioif_softc *sc = ifp->if_softc;
struct virtio_softc *vsc = sc->sc_virtio;
+ /* Take the locks to ensure that ongoing TX/RX finish */
+ VIOIF_TX_LOCK(sc);
+ VIOIF_RX_LOCK(sc);
sc->sc_stopping = true;
+ VIOIF_RX_UNLOCK(sc);
+ VIOIF_TX_UNLOCK(sc);
/* only way to stop I/O and DMA is resetting... */
virtio_reset(vsc);
Home |
Main Index |
Thread Index |
Old Index