Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2009 19:04:25 +0000 (UTC)
From:      Andrew Gallatin <gallatin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r194751 - head/sys/dev/mxge
Message-ID:  <200906231904.n5NJ4PrY086983@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gallatin
Date: Tue Jun 23 19:04:25 2009
New Revision: 194751
URL: http://svn.freebsd.org/changeset/base/194751

Log:
  Revert most of 193311 so as to track mxge transmit stats
  on a per-ring basis and avoid racy (and costly) updates
  to the ifp stats via drbr by defining NO_SLOW_STATS
  
  Discussed with: kmacy

Modified:
  head/sys/dev/mxge/if_mxge.c
  head/sys/dev/mxge/if_mxge_var.h

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Tue Jun 23 18:36:42 2009	(r194750)
+++ head/sys/dev/mxge/if_mxge.c	Tue Jun 23 19:04:25 2009	(r194751)
@@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <sys/sx.h>
 
+/* count xmits ourselves, rather than via drbr */
+#define NO_SLOW_STATS
 #include <net/if.h>
 #include <net/if_arp.h>
 #include <net/ethernet.h>
@@ -2200,7 +2202,6 @@ mxge_transmit_locked(struct mxge_slice_s
 		BPF_MTAP(ifp, m);
 		/* give it to the nic */
 		mxge_encap(ss, m);
-		drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags);
 	} else if ((err = drbr_enqueue(ifp, tx->br, m)) != 0) {
 		return (err);
 	}
@@ -2661,6 +2662,9 @@ mxge_tx_done(struct mxge_slice_state *ss
 		/* mbuf and DMA map only attached to the first
 		   segment per-mbuf */
 		if (m != NULL) {
+			ss->obytes += m->m_pkthdr.len;
+			if (m->m_flags & M_MCAST)
+				ss->omcasts++;
 			ss->opackets++;
 			tx->info[idx].m = NULL;
 			map = tx->info[idx].map;
@@ -3787,6 +3791,11 @@ mxge_update_stats(mxge_softc_t *sc)
 	struct mxge_slice_state *ss;
 	u_long ipackets = 0;
 	u_long opackets = 0;
+#ifdef IFNET_BUF_RING
+	u_long obytes = 0;
+	u_long omcasts = 0;
+	u_long odrops = 0;
+#endif
 	u_long oerrors = 0;
 	int slice;
 
@@ -3794,10 +3803,20 @@ mxge_update_stats(mxge_softc_t *sc)
 		ss = &sc->ss[slice];
 		ipackets += ss->ipackets;
 		opackets += ss->opackets;
+#ifdef IFNET_BUF_RING
+		obytes += ss->obytes;
+		omcasts += ss->omcasts;
+		odrops += ss->tx.br->br_drops;
+#endif
 		oerrors += ss->oerrors;
 	}
 	sc->ifp->if_ipackets = ipackets;
 	sc->ifp->if_opackets = opackets;
+#ifdef IFNET_BUF_RING
+	sc->ifp->if_obytes = obytes;
+	sc->ifp->if_omcasts = omcasts;
+	sc->ifp->if_snd.ifq_drops = odrops;
+#endif
 	sc->ifp->if_oerrors = oerrors;
 }
 

Modified: head/sys/dev/mxge/if_mxge_var.h
==============================================================================
--- head/sys/dev/mxge/if_mxge_var.h	Tue Jun 23 18:36:42 2009	(r194750)
+++ head/sys/dev/mxge/if_mxge_var.h	Tue Jun 23 19:04:25 2009	(r194751)
@@ -196,6 +196,8 @@ struct mxge_slice_state {
 	volatile uint32_t *irq_claim;
 	u_long ipackets;
 	u_long opackets;
+	u_long obytes;
+	u_long omcasts;
 	u_long oerrors;
 	int if_drv_flags;
 	struct lro_head lro_active;



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