From owner-svn-src-head@freebsd.org Mon Apr 13 23:06:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0BFE2AC05C; Mon, 13 Apr 2020 23:06:56 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 491PQ857wdz4LF5; Mon, 13 Apr 2020 23:06:56 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9174F23325; Mon, 13 Apr 2020 23:06:56 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 03DN6uPw041805; Mon, 13 Apr 2020 23:06:56 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 03DN6uXF041804; Mon, 13 Apr 2020 23:06:56 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <202004132306.03DN6uXF041804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 13 Apr 2020 23:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359908 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 359908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2020 23:06:56 -0000 Author: gallatin Date: Mon Apr 13 23:06:56 2020 New Revision: 359908 URL: https://svnweb.freebsd.org/changeset/base/359908 Log: lagg: stop double-counting output errors and counting drops as errors Before this change, lagg double-counted errors from lagg members, and counted every drop by a lagg member as an error. Eg, if lagg sent a packet, and the underlying hardware driver dropped it, a counter would be incremented by both lagg and the underlying driver. This change attempts to fix that by incrementing lagg's counters only for errors that do not come from underlying drivers. Reviewed by: hselasky, jhb Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D24331 Modified: head/sys/net/if_lagg.c Modified: head/sys/net/if_lagg.c ============================================================================== --- head/sys/net/if_lagg.c Mon Apr 13 22:21:01 2020 (r359907) +++ head/sys/net/if_lagg.c Mon Apr 13 23:06:56 2020 (r359908) @@ -1874,10 +1874,6 @@ lagg_transmit(struct ifnet *ifp, struct mbuf *m) error = lagg_proto_start(sc, m); LAGG_RUNLOCK(); - - if (error != 0) - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - return (error); } @@ -2100,6 +2096,7 @@ lagg_rr_start(struct lagg_softc *sc, struct mbuf *m) * port if the link is down or the port is NULL. */ if ((lp = lagg_link_active(sc, lp)) == NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENETDOWN); } @@ -2145,31 +2142,28 @@ lagg_bcast_start(struct lagg_softc *sc, struct mbuf *m errors++; break; } - - ret = lagg_enqueue(last->lp_ifp, m0); - if (ret != 0) - errors++; + lagg_enqueue(last->lp_ifp, m0); } last = lp; } if (last == NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENOENT); } if ((last = lagg_link_active(sc, last)) == NULL) { + errors++; + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, errors); m_freem(m); return (ENETDOWN); } ret = lagg_enqueue(last->lp_ifp, m); - if (ret != 0) - errors++; + if (errors != 0) + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, errors); - if (errors == 0) - return (ret); - - return (0); + return (ret); } static struct mbuf* @@ -2192,6 +2186,7 @@ lagg_fail_start(struct lagg_softc *sc, struct mbuf *m) /* Use the master port if active or the next available port */ if ((lp = lagg_link_active(sc, sc->sc_primary)) == NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENETDOWN); } @@ -2315,6 +2310,7 @@ lagg_lb_start(struct lagg_softc *sc, struct mbuf *m) * port if the link is down or the port is NULL. */ if ((lp = lagg_link_active(sc, lp)) == NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENETDOWN); } @@ -2386,6 +2382,7 @@ lagg_lacp_start(struct lagg_softc *sc, struct mbuf *m) lp = lacp_select_tx_port(sc, m); if (lp == NULL) { + if_inc_counter(sc->sc_ifp, IFCOUNTER_OERRORS, 1); m_freem(m); return (ENETDOWN); }