svn commit: r229708 - stable/9/sys/net

John Baldwin jhb at FreeBSD.org
Fri Jan 6 16:56:10 UTC 2012


Author: jhb
Date: Fri Jan  6 16:56:09 2012
New Revision: 229708
URL: http://svn.freebsd.org/changeset/base/229708

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/9/sys/net/if_vlan.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/net/if_vlan.c
==============================================================================
--- stable/9/sys/net/if_vlan.c	Fri Jan  6 16:54:16 2012	(r229707)
+++ stable/9/sys/net/if_vlan.c	Fri Jan  6 16:56:09 2012	(r229708)
@@ -1010,10 +1010,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);
 
@@ -1023,7 +1025,7 @@ vlan_transmit(struct ifnet *ifp, struct 
 	 */
 	if (!UP_AND_RUNNING(p)) {
 		m_freem(m);
-		ifp->if_collisions++;
+		ifp->if_oerrors++;
 		return (0);
 	}
 
@@ -1079,9 +1081,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-stable-9 mailing list