Date: Sat, 26 May 2012 07:58:13 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r236055 - stable/8/sys/net Message-ID: <201205260758.q4Q7wDP8060824@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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) &&
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205260758.q4Q7wDP8060824>