Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2009 19:14:20 +0000 (UTC)
From:      Sam Leffler <sam@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192660 - head/sys/arm/xscale/ixp425
Message-ID:  <200905231914.n4NJEKMZ064439@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sam
Date: Sat May 23 19:14:20 2009
New Revision: 192660
URL: http://svn.freebsd.org/changeset/base/192660

Log:
  accumulate npe statistics and expose them through dev.npe.X.stats

Modified:
  head/sys/arm/xscale/ixp425/if_npe.c

Modified: head/sys/arm/xscale/ixp425/if_npe.c
==============================================================================
--- head/sys/arm/xscale/ixp425/if_npe.c	Sat May 23 18:44:26 2009	(r192659)
+++ head/sys/arm/xscale/ixp425/if_npe.c	Sat May 23 19:14:20 2009	(r192660)
@@ -143,6 +143,7 @@ struct npe_softc {
 	struct npestats	*sc_stats;
 	bus_dmamap_t	sc_stats_map;
 	bus_addr_t	sc_stats_phys;	/* phys addr of sc_stats */
+	struct npestats	sc_totals;	/* accumulated sc_stats */
 };
 
 /*
@@ -374,6 +375,8 @@ npe_attach(device_t dev)
 	    CTLFLAG_RW, &sc->sc_debug, 0, "control debugging printfs");
 	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "tickinterval",
 	    CTLFLAG_RW, &sc->sc_tickinterval, 0, "periodic work frequency");
+	SYSCTL_ADD_STRUCT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "stats",
+	    CTLFLAG_RD, &sc->sc_totals, npestats, "onboard stats");
 
 	ether_ifattach(ifp, eaddr);
 	return 0;
@@ -867,12 +870,24 @@ npe_ifmedia_status(struct ifnet *ifp, st
 static void
 npe_addstats(struct npe_softc *sc)
 {
-#define	MIBADD(x)	sc->mibdata.x += be32toh(ns->x)
+#define	NPEADD(x)	sc->sc_totals.x += be32toh(ns->x)
+#define	MIBADD(x) do { sc->mibdata.x += be32toh(ns->x); NPEADD(x); } while (0)
 	struct ifnet *ifp = sc->sc_ifp;
 	struct npestats *ns = sc->sc_stats;
 
 	MIBADD(dot3StatsAlignmentErrors);
 	MIBADD(dot3StatsFCSErrors);
+	MIBADD(dot3StatsInternalMacReceiveErrors);
+	NPEADD(RxOverrunDiscards);
+	NPEADD(RxLearnedEntryDiscards);
+	NPEADD(RxLargeFramesDiscards);
+	NPEADD(RxSTPBlockedDiscards);
+	NPEADD(RxVLANTypeFilterDiscards);
+	NPEADD(RxVLANIdFilterDiscards);
+	NPEADD(RxInvalidSourceDiscards);
+	NPEADD(RxBlackListDiscards);
+	NPEADD(RxWhiteListDiscards);
+	NPEADD(RxUnderflowEntryDiscards);
 	MIBADD(dot3StatsSingleCollisionFrames);
 	MIBADD(dot3StatsMultipleCollisionFrames);
 	MIBADD(dot3StatsDeferredTransmissions);
@@ -880,10 +895,12 @@ npe_addstats(struct npe_softc *sc)
 	MIBADD(dot3StatsExcessiveCollisions);
 	MIBADD(dot3StatsInternalMacTransmitErrors);
 	MIBADD(dot3StatsCarrierSenseErrors);
+	NPEADD(TxLargeFrameDiscards);
+	NPEADD(TxVLANIdFilterDiscards);
+
 	sc->mibdata.dot3StatsFrameTooLongs +=
 	      be32toh(ns->RxLargeFramesDiscards)
 	    + be32toh(ns->TxLargeFrameDiscards);
-	MIBADD(dot3StatsInternalMacReceiveErrors);
 	sc->mibdata.dot3StatsMissedFrames +=
 	      be32toh(ns->RxOverrunDiscards)
 	    + be32toh(ns->RxUnderflowEntryDiscards);
@@ -902,6 +919,7 @@ npe_addstats(struct npe_softc *sc)
 		  be32toh(ns->dot3StatsSingleCollisionFrames)
 		+ be32toh(ns->dot3StatsMultipleCollisionFrames)
 		;
+#undef NPEADD
 #undef MIBADD
 }
 



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