Date: Fri, 6 Feb 2009 15:28:08 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r188238 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb net Message-ID: <200902061528.n16FS8cu065036@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <security/mac/mac_framework.h> +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");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902061528.n16FS8cu065036>