From owner-svn-src-stable@FreeBSD.ORG Sat May 26 07:58:13 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A83E21065673; Sat, 26 May 2012 07:58:13 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 88B1B8FC17; Sat, 26 May 2012 07:58:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4Q7wDRk060828; Sat, 26 May 2012 07:58:13 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4Q7wDP8060824; Sat, 26 May 2012 07:58:13 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201205260758.q4Q7wDP8060824@svn.freebsd.org> From: Andrew Thompson Date: Sat, 26 May 2012 07:58:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236055 - stable/8/sys/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: Sat, 26 May 2012 07:58:13 -0000 Author: thompsa Date: Sat May 26 07:58:12 2012 New Revision: 236055 URL: http://svn.freebsd.org/changeset/base/236055 Log: MFC r232014,r232030,r232070 - bstp_input() always consumes the packet so remove the mbuf handling dance around it. - Now that network interfaces advertise if they support linkstate notifications we do not need to perform a media ioctl every 15 seconds. - Indicate this function decrements the timer as well as testing for expiry. Modified: stable/8/sys/net/bridgestp.c stable/8/sys/net/bridgestp.h stable/8/sys/net/if_bridge.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) Modified: stable/8/sys/net/bridgestp.c ============================================================================== --- stable/8/sys/net/bridgestp.c Sat May 26 07:44:35 2012 (r236054) +++ stable/8/sys/net/bridgestp.c Sat May 26 07:58:12 2012 (r236055) @@ -134,7 +134,7 @@ static void bstp_tick(void *); static void bstp_timer_start(struct bstp_timer *, uint16_t); static void bstp_timer_stop(struct bstp_timer *); static void bstp_timer_latch(struct bstp_timer *); -static int bstp_timer_expired(struct bstp_timer *); +static int bstp_timer_dectest(struct bstp_timer *); static void bstp_hello_timer_expiry(struct bstp_state *, struct bstp_port *); static void bstp_message_age_expiry(struct bstp_state *, @@ -446,7 +446,7 @@ bstp_pdu_flags(struct bstp_port *bp) return (flags); } -struct mbuf * +void bstp_input(struct bstp_port *bp, struct ifnet *ifp, struct mbuf *m) { struct bstp_state *bs = bp->bp_bs; @@ -456,7 +456,7 @@ bstp_input(struct bstp_port *bp, struct if (bp->bp_active == 0) { m_freem(m); - return (NULL); + return; } BSTP_LOCK(bs); @@ -521,7 +521,6 @@ out: BSTP_UNLOCK(bs); if (m) m_freem(m); - return (NULL); } static void @@ -1862,30 +1861,32 @@ bstp_tick(void *arg) CURVNET_SET(bs->bs_vnet); - /* slow timer to catch missed link events */ - if (bstp_timer_expired(&bs->bs_link_timer)) { - LIST_FOREACH(bp, &bs->bs_bplist, bp_next) - bstp_ifupdstatus(bs, bp); + /* poll link events on interfaces that do not support linkstate */ + if (bstp_timer_dectest(&bs->bs_link_timer)) { + LIST_FOREACH(bp, &bs->bs_bplist, bp_next) { + if (!(bp->bp_ifp->if_capabilities & IFCAP_LINKSTATE)) + bstp_ifupdstatus(bs, bp); + } bstp_timer_start(&bs->bs_link_timer, BSTP_LINK_TIMER); } LIST_FOREACH(bp, &bs->bs_bplist, bp_next) { /* no events need to happen for these */ - bstp_timer_expired(&bp->bp_tc_timer); - bstp_timer_expired(&bp->bp_recent_root_timer); - bstp_timer_expired(&bp->bp_forward_delay_timer); - bstp_timer_expired(&bp->bp_recent_backup_timer); + bstp_timer_dectest(&bp->bp_tc_timer); + bstp_timer_dectest(&bp->bp_recent_root_timer); + bstp_timer_dectest(&bp->bp_forward_delay_timer); + bstp_timer_dectest(&bp->bp_recent_backup_timer); - if (bstp_timer_expired(&bp->bp_hello_timer)) + if (bstp_timer_dectest(&bp->bp_hello_timer)) bstp_hello_timer_expiry(bs, bp); - if (bstp_timer_expired(&bp->bp_message_age_timer)) + if (bstp_timer_dectest(&bp->bp_message_age_timer)) bstp_message_age_expiry(bs, bp); - if (bstp_timer_expired(&bp->bp_migrate_delay_timer)) + if (bstp_timer_dectest(&bp->bp_migrate_delay_timer)) bstp_migrate_delay_expiry(bs, bp); - if (bstp_timer_expired(&bp->bp_edge_delay_timer)) + if (bstp_timer_dectest(&bp->bp_edge_delay_timer)) bstp_edge_delay_expiry(bs, bp); /* update the various state machines for the port */ @@ -1924,7 +1925,7 @@ bstp_timer_latch(struct bstp_timer *t) } static int -bstp_timer_expired(struct bstp_timer *t) +bstp_timer_dectest(struct bstp_timer *t) { if (t->active == 0 || t->latched) return (0); Modified: stable/8/sys/net/bridgestp.h ============================================================================== --- stable/8/sys/net/bridgestp.h Sat May 26 07:44:35 2012 (r236054) +++ stable/8/sys/net/bridgestp.h Sat May 26 07:58:12 2012 (r236055) @@ -392,6 +392,6 @@ int bstp_set_edge(struct bstp_port *, in int bstp_set_autoedge(struct bstp_port *, int); int bstp_set_ptp(struct bstp_port *, int); int bstp_set_autoptp(struct bstp_port *, int); -struct mbuf *bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *); +void bstp_input(struct bstp_port *, struct ifnet *, struct mbuf *); #endif /* _KERNEL */ Modified: stable/8/sys/net/if_bridge.c ============================================================================== --- stable/8/sys/net/if_bridge.c Sat May 26 07:44:35 2012 (r236054) +++ stable/8/sys/net/if_bridge.c Sat May 26 07:58:12 2012 (r236055) @@ -2208,11 +2208,9 @@ bridge_input(struct ifnet *ifp, struct m /* Tap off 802.1D packets; they do not get forwarded. */ if (memcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN) == 0) { - m = bstp_input(&bif->bif_stp, ifp, m); - if (m == NULL) { - BRIDGE_UNLOCK(sc); - return (NULL); - } + bstp_input(&bif->bif_stp, ifp, m); /* consumes mbuf */ + BRIDGE_UNLOCK(sc); + return (NULL); } if ((bif->bif_flags & IFBIF_STP) &&