Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jan 2012 16:56:09 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229708 - stable/9/sys/net
Message-ID:  <201201061656.q06Gu9TX098474@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201061656.q06Gu9TX098474>