From owner-freebsd-hardware@FreeBSD.ORG Tue Dec 27 16:16:59 2005 Return-Path: X-Original-To: freebsd-hardware@freebsd.org Delivered-To: freebsd-hardware@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32B2016A41F; Tue, 27 Dec 2005 16:16:59 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from speedfactory.net (mail6.speedfactory.net [66.23.216.219]) by mx1.FreeBSD.org (Postfix) with ESMTP id 34C0E43D5F; Tue, 27 Dec 2005 16:16:58 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (unverified [66.23.211.162]) by speedfactory.net (SurgeMail 3.5b3) with ESMTP id 4660867 for multiple; Tue, 27 Dec 2005 11:18:47 -0500 Received: from localhost (john@localhost [127.0.0.1]) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id jBRGGthN019190; Tue, 27 Dec 2005 11:16:56 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hardware@freebsd.org Date: Tue, 27 Dec 2005 11:17:13 -0500 User-Agent: KMail/1.8.2 References: <20051226172520.V29157@omega.nanophys.kth.se> <200512262237.02342.groot@kde.org> In-Reply-To: <200512262237.02342.groot@kde.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512271117.15361.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1218/Mon Dec 26 08:46:59 2005 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=4.2 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx X-Server: High Performance Mail Server - http://surgemail.com r=1653887525 Cc: Adriaan de Groot , Alexander Konovalenko , freebsd-acpi@freebsd.org Subject: Re: "no carrier" on vr0 caused by suspend (FreeBSD 6.0) X-BeenThere: freebsd-hardware@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General discussion of FreeBSD hardware List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2005 16:16:59 -0000 On Monday 26 December 2005 04:36 pm, Adriaan de Groot wrote: > On Monday 26 December 2005 17:44, Alexander Konovalenko wrote: > > recently I have upgraded my AMD Athlono-XP laptop to 6.0 STABLE, > > everything works fine, even suspending with zzz works except > > network interface vr0 which is in state "no carrier" right after wake up. > > The only thing which helps is reboot. > > I just finished working on a Via C3-mini ITX box, also with a vr0 > interface; it's not a laptop, but I felt it needed to suspend anyway. > Suspend into S3 causes the vr0 to hang on resume, in my case with regular > vr0: watchdog timeout messages. > > Solution: reset the driver. > > Implementation: build a custom kernel with _no_ vr interface built in. Make > sure vr is built as a module. In the suspend script, unload the module. In > resume, reload it, then run rc.d/netif and rc.d/routing. For simple > machines with uncomplicated interfaces and routing, that ought to do the > trick. You can try stopping the chip during suspend and init on resume. Something like this: Index: if_vr.c =================================================================== RCS file: /usr/cvs/src/sys/pci/if_vr.c,v retrieving revision 1.114 diff -u -r1.114 if_vr.c --- if_vr.c 11 Nov 2005 16:04:58 -0000 1.114 +++ if_vr.c 27 Dec 2005 16:16:55 -0000 @@ -132,6 +132,8 @@ static int vr_probe(device_t); static int vr_attach(device_t); static int vr_detach(device_t); +static int vr_suspend(device_t); +static int vr_resume(device_t); static int vr_newbuf(struct vr_softc *, struct vr_chain_onefrag *, struct mbuf *); @@ -182,6 +184,8 @@ DEVMETHOD(device_probe, vr_probe), DEVMETHOD(device_attach, vr_attach), DEVMETHOD(device_detach, vr_detach), + DEVMETHOD(device_suspend, vr_suspend), + DEVMETHOD(device_resume, vr_resume), DEVMETHOD(device_shutdown, vr_shutdown), /* bus interface */ @@ -830,6 +834,30 @@ return (0); } +static int +vr_suspend(device_t dev) +{ + struct vr_softc *sc = device_get_softc(dev); + + VR_LOCK(sc); + sc->suspended = 1; + vr_stop(sc); + VR_UNLOCK(sc); + return (0); +} + +static int +vr_resume(device_t dev) +{ + struct vr_softc *sc = device_get_softc(dev); + + VR_LOCK(sc); + sc->suspended = 0; + vr_init_locked(sc); + VR_UNLOCK(sc); + return (0); +} + /* * Initialize the transmit descriptors. */ -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org