From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:04:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31EAB106566C; Wed, 24 Jun 2009 19:04:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0555C8FC08; Wed, 24 Jun 2009 19:04:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJ48aS025355; Wed, 24 Jun 2009 19:04:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJ48ZH025352; Wed, 24 Jun 2009 19:04:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906241904.n5OJ48ZH025352@svn.freebsd.org> From: Marius Strobl Date: Wed, 24 Jun 2009 19:04:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194886 - head/sys/dev/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:04:10 -0000 Author: marius Date: Wed Jun 24 19:04:08 2009 New Revision: 194886 URL: http://svn.freebsd.org/changeset/base/194886 Log: Revert the part of r194763 which added a dying flag and instead call ether_ifdetach(9) before stopping the controller and the callouts. The consensus is that the latter is now safe to do and should also solve the problem of active BPF listeners clearing promiscuous mode can result in the tick callout being restarted which in turn will trigger a panic once it's actually gone. Modified: head/sys/dev/gem/if_gem.c head/sys/dev/gem/if_gemvar.h Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Wed Jun 24 18:54:54 2009 (r194885) +++ head/sys/dev/gem/if_gem.c Wed Jun 24 19:04:08 2009 (r194886) @@ -403,15 +403,14 @@ gem_detach(struct gem_softc *sc) struct ifnet *ifp = sc->sc_ifp; int i; + ether_ifdetach(ifp); GEM_LOCK(sc); - sc->sc_flags |= GEM_DYING; gem_stop(ifp, 1); GEM_UNLOCK(sc); callout_drain(&sc->sc_tick_ch); #ifdef GEM_RINT_TIMEOUT callout_drain(&sc->sc_rx_ch); #endif - ether_ifdetach(ifp); if_free(ifp); device_delete_child(sc->sc_dev, sc->sc_miibus); @@ -2107,11 +2106,6 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFFLAGS: GEM_LOCK(sc); - if ((sc->sc_flags & GEM_DYING) != 0) { - error = EINVAL; - GEM_UNLOCK(sc); - break; - } if ((ifp->if_flags & IFF_UP) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && ((ifp->if_flags ^ sc->sc_ifflags) & Modified: head/sys/dev/gem/if_gemvar.h ============================================================================== --- head/sys/dev/gem/if_gemvar.h Wed Jun 24 18:54:54 2009 (r194885) +++ head/sys/dev/gem/if_gemvar.h Wed Jun 24 19:04:08 2009 (r194886) @@ -141,11 +141,10 @@ struct gem_softc { u_int sc_flags; #define GEM_INITED (1 << 0) /* reset persistent regs init'ed */ -#define GEM_DYING (1 << 1) /* detach initiated */ -#define GEM_LINK (1 << 2) /* link is up */ -#define GEM_PCI (1 << 3) /* PCI busses are little-endian */ -#define GEM_PCI66 (1 << 4) /* PCI bus runs at 66MHz */ -#define GEM_SERDES (1 << 5) /* use the SERDES */ +#define GEM_LINK (1 << 1) /* link is up */ +#define GEM_PCI (1 << 2) /* PCI busses are little-endian */ +#define GEM_PCI66 (1 << 3) /* PCI bus runs at 66MHz */ +#define GEM_SERDES (1 << 4) /* use the SERDES */ /* * ring buffer DMA stuff