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); } _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"