From owner-freebsd-net@FreeBSD.ORG Tue Dec 16 22:07:26 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AACA1065673; Tue, 16 Dec 2008 22:07:26 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id BEB2A8FC18; Tue, 16 Dec 2008 22:07:25 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id CBA1BFEF4; Wed, 17 Dec 2008 11:07:24 +1300 (NZDT) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TRZGUpgrgjX4; Wed, 17 Dec 2008 11:07:20 +1300 (NZDT) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Wed, 17 Dec 2008 11:07:20 +1300 (NZDT) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id 0B1331142E; Wed, 17 Dec 2008 11:07:20 +1300 (NZDT) Date: Tue, 16 Dec 2008 14:07:19 -0800 From: Andrew Thompson To: Max Laier Message-ID: <20081216220719.GA19787@citylink.fud.org.nz> References: <4947D7A9.2050407@FreeBSD.org> <20081216190932.I74416@beagle.kn.op.dlr.de> <20081216182749.GE3082@citylink.fud.org.nz> <200812162008.00654.max@love2party.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="OgqxwSJOaUobr8KG" Content-Disposition: inline In-Reply-To: <200812162008.00654.max@love2party.net> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: freebsd-net@freebsd.org, Harti Brandt , Sergey Matveychuk Subject: Re: bsnmpd & 64bits counters problem X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 22:07:26 -0000 --OgqxwSJOaUobr8KG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Dec 16, 2008 at 08:08:00PM +0100, Max Laier wrote: > On Tuesday 16 December 2008 19:27:49 Andrew Thompson wrote: > > On Tue, Dec 16, 2008 at 07:12:24PM +0100, Harti Brandt wrote: > > > On Tue, 16 Dec 2008, Sergey Matveychuk wrote: > > > SM>> > > > SM>> The highspeed counters are only there if this is a high-speed > > > interface. SM>> High speed means that the baudrate in the interface MIB > > > (the one in the SM>> kernel) must be larger than 20Mbaud. > > > SM> > > > SM>Well, these is lagg interfaces: > > > SM>lagg0: flags=8843 metric 0 mtu > > > 9000 SM> > > > options=19b SM> > > > ether 00:30:48:67:d4:68 > > > SM> media: Ethernet autoselect > > > SM> status: active > > > SM> laggproto lacp > > > SM> laggport: em2 flags=1c > > > SM> laggport: em0 flags=1c > > > SM> > > > SM>There is no baudrate on them. But they are really high-speed however. > > > > > > All interfaces have a baudrate. Its in net/if.h ifi_baudrate. We had the > > > problem in the past with other interface types. 'virtual' interfaces must > > > take care to somehow propagate the rate of the underlying physical > > > interfaces up to the virtual one. > > > > This patch should fix it for the lacp case. What is the correct value to > > use for a collection of interfaces with possibly different speeds? > > highest/lowest? > > If aggregation is used you should add the individual speeds (as this is the > highest rate at which the interface counter could be increased). If it's in > failover you should propagate the speed of the active interface. When in > doubt, always report the highest value - at least for the purpose discussed > here. Patch updated, should work as you described. Andrew --OgqxwSJOaUobr8KG Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="lagg_baud.diff" Index: if_lagg.c =================================================================== --- if_lagg.c (revision 186188) +++ if_lagg.c (working copy) @@ -1206,6 +1206,7 @@ lagg_linkstate(struct lagg_softc *sc) { struct lagg_port *lp; int new_link = LINK_STATE_DOWN; + uint64_t speed = 0; /* Our link is considered up if at least one of our ports is active */ SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) { @@ -1215,6 +1216,24 @@ lagg_linkstate(struct lagg_softc *sc) } } if_link_state_change(sc->sc_ifp, new_link); + + /* Update if_baudrate to reflect the max possible speed */ + switch (sc->sc_proto) { + case LAGG_PROTO_FAILOVER: + sc->sc_ifp->if_baudrate = + sc->sc_primary->lp_ifp->if_baudrate; + break; + case LAGG_PROTO_ROUNDROBIN: + case LAGG_PROTO_LOADBALANCE: + case LAGG_PROTO_ETHERCHANNEL: + SLIST_FOREACH(lp, &sc->sc_ports, lp_entries) + speed += lp->lp_ifp->if_baudrate; + sc->sc_ifp->if_baudrate = speed; + break; + case LAGG_PROTO_LACP: + /* LACP updates if_baudrate itself */ + break; + } } static void Index: ieee8023ad_lacp.c =================================================================== --- ieee8023ad_lacp.c (revision 186188) +++ ieee8023ad_lacp.c (working copy) @@ -901,6 +901,7 @@ lacp_aggregator_bandwidth(struct lacp_aggregator * static void lacp_select_active_aggregator(struct lacp_softc *lsc) { + struct lagg_softc *sc = lsc->lsc_softc; struct lacp_aggregator *la; struct lacp_aggregator *best_la = NULL; uint64_t best_speed = 0; @@ -956,6 +957,7 @@ lacp_select_active_aggregator(struct lacp_softc *l #endif /* defined(LACP_DEBUG) */ if (lsc->lsc_active_aggregator != best_la) { + sc->sc_ifp->if_baudrate = best_speed; lsc->lsc_active_aggregator = best_la; lacp_update_portmap(lsc); if (best_la) { --OgqxwSJOaUobr8KG--