svn commit: r229709 - stable/8/sys/net

John Baldwin jhb at FreeBSD.org
Fri Jan 6 16:57:30 UTC 2012


Author: jhb
Date: Fri Jan  6 16:57:29 2012
New Revision: 229709
URL: http://svn.freebsd.org/changeset/base/229709

Log:
  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.

Modified:
  stable/8/sys/net/if_vlan.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/net/if_vlan.c
==============================================================================
--- stable/8/sys/net/if_vlan.c	Fri Jan  6 16:56:09 2012	(r229708)
+++ stable/8/sys/net/if_vlan.c	Fri Jan  6 16:57:29 2012	(r229709)
@@ -872,10 +872,12 @@ vlan_transmit(struct ifnet *ifp, struct 
 {
 	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 
 	 */
 	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 
 	 * 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);
 }


More information about the svn-src-all mailing list