From 778f1b4b1a70a3c243ac7be47b08318af7c56725 Mon Sep 17 00:00:00 2001 From: kettenis Date: Tue, 27 Jul 2010 20:53:39 +0000 Subject: [PATCH] Make sure we stop DMA before we suspend. Remove unused argument to re_stop() to avoid the dilemma what meaningless value to pass. ok deraadt@ --- sys/dev/ic/re.c | 8 ++++---- sys/dev/ic/revar.h | 4 ++-- sys/dev/pci/if_re_pci.c | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index ecd58ce86be..0cc77f7c519 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.123 2010/07/14 19:24:27 naddy Exp $ */ +/* $OpenBSD: re.c,v 1.124 2010/07/27 20:53:39 kettenis Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -1942,7 +1942,7 @@ re_init(struct ifnet *ifp) /* * Cancel pending I/O and free all RX/TX buffers. */ - re_stop(ifp, 0); + re_stop(ifp); /* * Enable C+ RX and TX mode, as well as RX checksum offload. @@ -2118,7 +2118,7 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data) re_init(ifp); } else { if (ifp->if_flags & IFF_RUNNING) - re_stop(ifp, 1); + re_stop(ifp); } break; case SIOCGIFMEDIA: @@ -2163,7 +2163,7 @@ re_watchdog(struct ifnet *ifp) * RX and TX lists. */ void -re_stop(struct ifnet *ifp, int disable) +re_stop(struct ifnet *ifp) { struct rl_softc *sc; int i; diff --git a/sys/dev/ic/revar.h b/sys/dev/ic/revar.h index ba96758a6fd..971a4da8c88 100644 --- a/sys/dev/ic/revar.h +++ b/sys/dev/ic/revar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: revar.h,v 1.6 2009/11/24 17:40:43 kettenis Exp $ */ +/* $OpenBSD: revar.h,v 1.7 2010/07/27 20:53:39 kettenis Exp $ */ /* * Copyright (c) 2005 Peter Valchev @@ -20,4 +20,4 @@ int re_intr(void *); int re_attach(struct rl_softc *, const char *); void re_reset(struct rl_softc *); int re_init(struct ifnet *); -void re_stop(struct ifnet *, int); +void re_stop(struct ifnet *); diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index 34011c517b4..9588b64972e 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.27 2009/11/26 00:12:31 kettenis Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.28 2010/07/27 20:53:39 kettenis Exp $ */ /* * Copyright (c) 2005 Peter Valchev @@ -249,10 +249,12 @@ re_pci_activate(struct device *self, int act) switch(act) { case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + re_stop(ifp); break; case DVACT_RESUME: re_reset(sc); - if (ifp->if_flags & IFF_RUNNING) + if (ifp->if_flags & IFF_UP) re_init(ifp); break; } -- 2.20.1