From 64c44e5db80c7aa1e8568878068210c6a508f116 Mon Sep 17 00:00:00 2001 From: Kip Macy Date: Wed, 17 Dec 2008 08:12:50 +0000 Subject: [PATCH] Keep stats in drbr_enqueue Discussed with: ps --- sys/net/if_var.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 6e6d2db08b8a..250bed95cc22 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -550,16 +550,29 @@ do { \ } while (0) #ifdef _KERNEL +static __inline void +drbr_stats_update(struct ifnet *ifp, int len, int mflags) +{ + + ifp->if_obytes += len; + if (mflags & M_MCAST) + ifp->if_omcasts++; +} + static __inline int -drbr_enqueue(struct buf_ring *br, struct mbuf *m) +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; if ((error = buf_ring_enqueue(br, m)) == ENOBUFS) { br->br_drops++; + _IF_DROP(&ifp->if_snd); m_freem(m); - } - + } else + drbr_stats_update(ifp, len, mflags); + return (error); }