From owner-svn-src-stable@FreeBSD.ORG Fri Feb 6 15:28:09 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F57A1065670; Fri, 6 Feb 2009 15:28:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C6C58FC1D; Fri, 6 Feb 2009 15:28:09 +0000 (UTC) (envelope-from jhb@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 n16FS8oI065037; Fri, 6 Feb 2009 15:28:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n16FS8cu065036; Fri, 6 Feb 2009 15:28:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200902061528.n16FS8cu065036@svn.freebsd.org> From: John Baldwin Date: Fri, 6 Feb 2009 15:28:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188238 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Feb 2009 15:28:10 -0000 Author: jhb Date: Fri Feb 6 15:28:08 2009 New Revision: 188238 URL: http://svn.freebsd.org/changeset/base/188238 Log: MFC: Only start the if_slowtimo timer if it is needed. Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) stable/7/sys/net/if.c Modified: stable/7/sys/net/if.c ============================================================================== --- stable/7/sys/net/if.c Fri Feb 6 15:27:40 2009 (r188237) +++ stable/7/sys/net/if.c Fri Feb 6 15:28:08 2009 (r188238) @@ -84,6 +84,8 @@ #include +static int slowtimo_started; + SYSCTL_NODE(_net, PF_LINK, link, CTLFLAG_RW, 0, "Link layers"); SYSCTL_NODE(_net_link, 0, generic, CTLFLAG_RW, 0, "Generic link-management"); @@ -399,7 +401,13 @@ if_check(void *dummy __unused) } IFNET_RUNLOCK(); splx(s); - if_slowtimo(0); + + /* + * If at least one interface added during boot uses + * if_watchdog then start the timer. + */ + if (slowtimo_started) + if_slowtimo(0); } /* @@ -602,9 +610,17 @@ if_attach(struct ifnet *ifp) /* Announce the interface. */ rt_ifannouncemsg(ifp, IFAN_ARRIVAL); - if (ifp->if_watchdog != NULL) + if (ifp->if_watchdog != NULL) { if_printf(ifp, "WARNING: using obsoleted if_watchdog interface\n"); + + /* + * Note that we need if_slowtimo(). If this happens after + * boot, then call if_slowtimo() directly. + */ + if (atomic_cmpset_int(&slowtimo_started, 0, 1) && !cold) + if_slowtimo(0); + } if (ifp->if_flags & IFF_NEEDSGIANT) if_printf(ifp, "WARNING: using obsoleted IFF_NEEDSGIANT flag\n");