From 3d1b582c04e5bae831300222605597779940d141 Mon Sep 17 00:00:00 2001 From: uebayasi Date: Mon, 5 Oct 2015 19:05:09 +0000 Subject: [PATCH] Revert if_oqdrops accounting changes done in kernel, per request from mpi@. (Especially adding IF_DROP() after IFQ_ENQUEUE() was completely wrong because IFQ_ENQUEUE() already does it. Oops.) After this revert, the situation becomes: - if_snd.ifq_drops is incremented in either IFQ_ENQUEUE() or IF_DROP(), but it is not shown to userland, and - if_data.ifi_oqdrops is shown to userland, but it is not incremented by anyone. --- sys/net/if.c | 5 +---- sys/net/if_bridge.c | 5 ++++- sys/net/if_ppp.c | 14 +++++--------- sys/net/if_spppsubr.c | 4 +++- sys/net/if_vlan.c | 3 ++- sys/net80211/ieee80211_pae_output.c | 5 ++--- sys/netinet/ip_carp.c | 3 ++- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index b513eb34995..afb092a1778 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.384 2015/10/05 15:57:27 uebayasi Exp $ */ +/* $OpenBSD: if.c,v 1.385 2015/10/05 19:05:09 uebayasi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -542,8 +542,6 @@ if_start(struct ifnet *ifp) CLR(ifp->if_xflags, IFXF_TXREADY); } ifp->if_start(ifp); - ifp->if_oqdrops += ifp->if_snd.ifq_drops; - ifp->if_snd.ifq_drops = 0; return; } @@ -577,7 +575,6 @@ if_enqueue(struct ifnet *ifp, struct mbuf *m) */ IFQ_ENQUEUE(&ifp->if_snd, m, NULL, error); if (error) { - IF_DROP(&ifp->if_snd); splx(s); return (error); } diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index fda9ba72e14..eb625a979b2 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.266 2015/10/05 15:52:46 uebayasi Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.267 2015/10/05 19:05:09 uebayasi Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -1029,6 +1029,7 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, struct sockaddr *sa, if (IF_QFULL(&dst_if->if_snd)) { IF_DROP(&dst_if->if_snd); + sc->sc_if.if_oerrors++; continue; } if (TAILQ_NEXT(p, next) == NULL) { @@ -1467,6 +1468,7 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, #endif /* NMPW */ if (IF_QFULL(&dst_if->if_snd)) { IF_DROP(&dst_if->if_snd); + sc->sc_if.if_oerrors++; continue; } @@ -1552,6 +1554,7 @@ bridge_span(struct bridge_softc *sc, struct mbuf *m) if (IF_QFULL(&ifp->if_snd)) { IF_DROP(&ifp->if_snd); + sc->sc_if.if_oerrors++; continue; } diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 68570b3dcc6..6f11546a29d 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ppp.c,v 1.88 2015/10/05 15:57:27 uebayasi Exp $ */ +/* $OpenBSD: if_ppp.c,v 1.89 2015/10/05 19:05:09 uebayasi Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* @@ -803,13 +803,11 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, IF_ENQUEUE(ifq, m0); error = 0; } - } else { + } else IFQ_ENQUEUE(&sc->sc_if.if_snd, m0, NULL, error); - if (error) - IF_DROP(&sc->sc_if.if_snd); - } if (error) { splx(s); + sc->sc_if.if_oerrors++; sc->sc_stats.ppp_oerrors++; return (error); } @@ -868,12 +866,10 @@ ppp_requeue(struct ppp_softc *sc) IF_ENQUEUE(ifq, m); error = 0; } - } else { + } else IFQ_ENQUEUE(&sc->sc_if.if_snd, m, NULL, error); - if (error) - IF_DROP(&sc->sc_if.if_snd); - } if (error) { + sc->sc_if.if_oerrors++; sc->sc_stats.ppp_oerrors++; } break; diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 6383d091be1..8978df4e18b 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_spppsubr.c,v 1.140 2015/10/05 15:52:46 uebayasi Exp $ */ +/* $OpenBSD: if_spppsubr.c,v 1.141 2015/10/05 19:05:09 uebayasi Exp $ */ /* * Synchronous PPP link level subroutines. * @@ -1024,6 +1024,7 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type, if (IF_QFULL (&sp->pp_cpq)) { IF_DROP (&ifp->if_snd); m_freem (m); + ++ifp->if_oerrors; m = NULL; } else IF_ENQUEUE (&sp->pp_cpq, m); @@ -4130,6 +4131,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp, if (IF_QFULL (&sp->pp_cpq)) { IF_DROP (&ifp->if_snd); m_freem (m); + ++ifp->if_oerrors; m = NULL; } else IF_ENQUEUE (&sp->pp_cpq, m); diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 48aff35c646..d9f1772d619 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vlan.c,v 1.144 2015/10/05 15:52:46 uebayasi Exp $ */ +/* $OpenBSD: if_vlan.c,v 1.145 2015/10/05 19:05:09 uebayasi Exp $ */ /* * Copyright 1998 Massachusetts Institute of Technology @@ -249,6 +249,7 @@ vlan_start(struct ifnet *ifp) if ((p->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { IF_DROP(&p->if_snd); + ifp->if_oerrors++; m_freem(m); continue; } diff --git a/sys/net80211/ieee80211_pae_output.c b/sys/net80211/ieee80211_pae_output.c index 4e534656ba0..eb293610247 100644 --- a/sys/net80211/ieee80211_pae_output.c +++ b/sys/net80211/ieee80211_pae_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_pae_output.c,v 1.22 2015/10/05 15:57:27 uebayasi Exp $ */ +/* $OpenBSD: ieee80211_pae_output.c,v 1.23 2015/10/05 19:05:09 uebayasi Exp $ */ /*- * Copyright (c) 2007,2008 Damien Bergamini @@ -131,8 +131,7 @@ ieee80211_send_eapol_key(struct ieee80211com *ic, struct mbuf *m, ifp->if_obytes += len; if ((ifp->if_flags & IFF_OACTIVE) == 0) (*ifp->if_start)(ifp); - } else - IF_DROP(&ifp->if_snd); + } splx(s); return error; diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c index 3d1382797e5..c703c8d707c 100644 --- a/sys/netinet/ip_carp.c +++ b/sys/netinet/ip_carp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_carp.c,v 1.274 2015/10/05 15:52:46 uebayasi Exp $ */ +/* $OpenBSD: ip_carp.c,v 1.275 2015/10/05 19:05:09 uebayasi Exp $ */ /* * Copyright (c) 2002 Michael Shalayeff. All rights reserved. @@ -2390,6 +2390,7 @@ carp_start(struct ifnet *ifp) if ((ifp->if_carpdev->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) { IF_DROP(&ifp->if_carpdev->if_snd); + ifp->if_oerrors++; m_freem(m); continue; } -- 2.20.1