From 12b2090ee835bdfecda40c9337a1d32f0425ce6d Mon Sep 17 00:00:00 2001 From: jhb Date: Fri, 6 Jan 2012 16:57:29 +0000 Subject: [PATCH] MFC 228967: Update if_obytes and if_omcast after successful transmit. While I'm here update if_oerrors if parent interface of vlan is not up and running. Previously it updated collision counter and it was confusing to interprete it. git-svn-id: svn://svn.freebsd.org/base/stable/8@229709 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/net/if_vlan.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 362667732..c46c0ac09 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -872,10 +872,12 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) { struct ifvlan *ifv; struct ifnet *p; - int error; + int error, len, mcast; ifv = ifp->if_softc; p = PARENT(ifv); + len = m->m_pkthdr.len; + mcast = (m->m_flags & (M_MCAST | M_BCAST)) ? 1 : 0; BPF_MTAP(ifp, m); @@ -885,7 +887,7 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) */ if (!UP_AND_RUNNING(p)) { m_freem(m); - ifp->if_collisions++; + ifp->if_oerrors++; return (0); } @@ -941,9 +943,11 @@ vlan_transmit(struct ifnet *ifp, struct mbuf *m) * Send it, precisely as ether_output() would have. */ error = (p->if_transmit)(p, m); - if (!error) + if (!error) { ifp->if_opackets++; - else + ifp->if_omcasts += mcast; + ifp->if_obytes += len; + } else ifp->if_oerrors++; return (error); } -- 2.45.0