kern/182828: [patch] [igb] Revision 247430 broke outgoing interface stats for stable/8

Eugene Grosbein eugen at grosbein.net
Tue Oct 8 12:40:01 UTC 2013


>Number:         182828
>Category:       kern
>Synopsis:       [patch] [igb] Revision 247430 broke outgoing interface stats for stable/8
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 08 12:40:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Eugene Grosbein
>Release:        FreeBSD 8.4-STABLE amd64
>Organization:
RDTC JSC
>Environment:
System: FreeBSD eg.sd.rdtc.ru 8.4-STABLE FreeBSD 8.4-STABLE #3 r251830M: Mon Sep 30 18:01:03 NOVT 2013 root at eg.sd.rdtc.ru:/usr/local/obj/usr/local/src/sys/EG amd64

>Description:
	There was r241037 commit by glebius@ to head fixing
	"inaccurate overrated if_obytes accounting" in the HEAD:
	http://svnweb.freebsd.org/base?view=revision&revision=241037

	And there was _incomplete_ MFC to stable/8 r247430:
	http://svnweb.freebsd.org/base?view=revision&revision=247430

	r247430 contained some parts of r241037 but missed others vital
	parts, so it introduced "inaccurate overrated if_obytes accounting"
	to stable/8. For example, igb(4) now suffers from same problem.

>How-To-Repeat:
	Run recent 8.4-STABLE with igb(4), make lots of outgoing traffic
	and see that interface statistics is overrated.

>Fix:

	Make mentioned MFC more complete. At least, merge
	changes to sys/net/if_var.h to delete extra increase of if_obytes
	and to sys/dev/oce/oce_if.c to fix last consumer
	of drbr_stats_update() in stable/8:

--- sys/net/if_var.h	2012/09/28 17:36:00	241036
+++ sys/net/if_var.h	2012/09/28 18:28:27	241037
@@ -590,22 +590,10 @@
 } while (0)
 
 #ifdef _KERNEL
-static __inline void
-drbr_stats_update(struct ifnet *ifp, int len, int mflags)
-{
-#ifndef NO_SLOW_STATS
-	ifp->if_obytes += len;
-	if (mflags & M_MCAST)
-		ifp->if_omcasts++;
-#endif
-}
-
 static __inline int
 drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m)
 {	
 	int error = 0;
-	int len = m->m_pkthdr.len;
-	int mflags = m->m_flags;
 
 #ifdef ALTQ
 	if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
@@ -613,12 +601,10 @@
 		return (error);
 	}
 #endif
-	if ((error = buf_ring_enqueue_bytes(br, m, len)) == ENOBUFS) {
-		br->br_drops++;
+	error = buf_ring_enqueue(br, m);
+	if (error)
 		m_freem(m);
-	} else
-		drbr_stats_update(ifp, len, mflags);
-	
+
 	return (error);
 }
 
--- sys/dev/oce/oce_if.c	2012/09/28 17:36:00	241036
+++ sys/dev/oce/oce_if.c	2012/09/28 18:28:27	241037
@@ -1183,7 +1183,9 @@
 			}  
 			break;
 		}
-		drbr_stats_update(ifp, next->m_pkthdr.len, next->m_flags);
+		ifp->if_obytes += next->m_pkthdr.len;
+		if (next->m_flags & M_MCAST)
+			ifp->if_omcasts++;
 		ETHER_BPF_MTAP(ifp, next);
 		next = drbr_dequeue(ifp, br);
 	}

Eugene Grosbein
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list