From owner-svn-src-all@FreeBSD.ORG Mon Aug 23 00:31:56 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D9841065675; Mon, 23 Aug 2010 00:31:56 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0281D8FC12; Mon, 23 Aug 2010 00:31:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7N0Vtuh021485; Mon, 23 Aug 2010 00:31:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7N0VtbR021483; Mon, 23 Aug 2010 00:31:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201008230031.o7N0VtbR021483@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 23 Aug 2010 00:31:55 +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: r211671 - head/sys/dev/xl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2010 00:31:56 -0000 Author: yongari Date: Mon Aug 23 00:31:55 2010 New Revision: 211671 URL: http://svn.freebsd.org/changeset/base/211671 Log: Remove unnecessary controller reinitialization by checking IFF_DRV_RUNNING flag. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Aug 23 00:24:12 2010 (r211670) +++ head/sys/dev/xl/if_xl.c Mon Aug 23 00:31:55 2010 (r211671) @@ -2247,6 +2247,7 @@ xl_intr(void *arg) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2318,6 +2319,7 @@ xl_poll_locked(struct ifnet *ifp, enum p if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2745,6 +2747,8 @@ xl_init_locked(struct xl_softc *sc) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2993,6 +2997,7 @@ xl_ifmedia_upd(struct ifnet *ifp) if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX || sc->xl_media & XL_MEDIAOPT_BT4) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } else { xl_setmode(sc, ifm->ifm_media); @@ -3108,10 +3113,8 @@ xl_ioctl(struct ifnet *ifp, u_long comma CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - xl_init_locked(sc); - } + } else + xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); @@ -3234,6 +3237,7 @@ xl_watchdog(struct xl_softc *sc) "no carrier - transceiver cable problem?\n"); xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -3364,8 +3368,10 @@ xl_resume(device_t dev) XL_LOCK(sc); xl_reset(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); + } XL_UNLOCK(sc);