Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jun 2009 23:49:15 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r193670 - in user/kmacy/releng_7_2_fcs/sys: net sys
Message-ID:  <200906072349.n57NnF8c009605@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Sun Jun  7 23:49:15 2009
New Revision: 193670
URL: http://svn.freebsd.org/changeset/base/193670

Log:
  track bytes and buffers enqueued in buf_ring

Modified:
  user/kmacy/releng_7_2_fcs/sys/net/if_var.h
  user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h

Modified: user/kmacy/releng_7_2_fcs/sys/net/if_var.h
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/net/if_var.h	Sun Jun  7 23:47:06 2009	(r193669)
+++ user/kmacy/releng_7_2_fcs/sys/net/if_var.h	Sun Jun  7 23:49:15 2009	(r193670)
@@ -559,8 +559,9 @@ do {									\
 static __inline void
 drbr_stats_update(struct ifnet *ifp, int len, int mflags)
 {
-
+#ifndef NO_SLOW_STATS
 	ifp->if_obytes += len;
+#endif	
 	if (mflags & M_MCAST)
 		ifp->if_omcasts++;
 }
@@ -578,13 +579,12 @@ drbr_enqueue(struct ifnet *ifp, struct b
 		return (error);
 	}
 #endif
-	if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) {
+	if ((error = buf_ring_enqueue(br, m, m->m_pkthdr.len)) == ENOBUFS) {
 		br->br_drops++;
-		_IF_DROP(&ifp->if_snd);
 		m_freem(m);
 	} else
 		drbr_stats_update(ifp, len, mflags);
-	
+
 	return (error);
 }
 

Modified: user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h
==============================================================================
--- user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h	Sun Jun  7 23:47:06 2009	(r193669)
+++ user/kmacy/releng_7_2_fcs/sys/sys/buf_ring.h	Sun Jun  7 23:49:15 2009	(r193670)
@@ -49,10 +49,12 @@ struct buf_ring {
 	int              	br_prod_size;
 	int              	br_prod_mask;
 	uint64_t		br_drops;
+	uint64_t		br_prod_bufs;
+	uint64_t		br_prod_bytes;
 	/*
 	 * Pad out to next L2 cache line
 	 */
-	uint64_t	  	_pad0[13];
+	uint64_t	  	_pad0[11];
 
 	volatile uint32_t	br_cons_head;
 	volatile uint32_t	br_cons_tail;
@@ -74,7 +76,7 @@ struct buf_ring {
  *
  */
 static __inline int
-buf_ring_enqueue(struct buf_ring *br, void *buf)
+buf_ring_enqueue(struct buf_ring *br, void *buf, int nbytes)
 {
 	uint32_t prod_head, prod_next;
 	uint32_t cons_tail;
@@ -116,6 +118,8 @@ buf_ring_enqueue(struct buf_ring *br, vo
 	 */   
 	while (br->br_prod_tail != prod_head)
 		cpu_spinwait();
+	br->br_prod_bufs++;
+	br->br_prod_bytes += nbytes;
 	br->br_prod_tail = prod_next;
 	critical_exit();
 	return (0);



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