svn commit: r277112 - projects/ifnet/sys/net
Gleb Smirnoff
glebius at FreeBSD.org
Tue Jan 13 07:41:01 UTC 2015
Author: glebius
Date: Tue Jan 13 07:40:59 2015
New Revision: 277112
URL: https://svnweb.freebsd.org/changeset/base/277112
Log:
Provide function if_inc_txcounters(), that accounts successful transmission
of an mbuf, to be used in NIC TX interrupt completion routines.
Sponsored by: Nginx, Inc.
Modified:
projects/ifnet/sys/net/if.c
projects/ifnet/sys/net/if.h
Modified: projects/ifnet/sys/net/if.c
==============================================================================
--- projects/ifnet/sys/net/if.c Tue Jan 13 07:38:29 2015 (r277111)
+++ projects/ifnet/sys/net/if.c Tue Jan 13 07:40:59 2015 (r277112)
@@ -1670,6 +1670,19 @@ if_inc_counter(struct ifnet *ifp, ift_co
}
/*
+ * Account successful transmission of an mbuf.
+ */
+void
+if_inc_txcounters(struct ifnet *ifp, struct mbuf *m)
+{
+
+ counter_u64_add(ifp->if_counters[IFCOUNTER_OBYTES], m->m_pkthdr.len);
+ counter_u64_add(ifp->if_counters[IFCOUNTER_OPACKETS], 1);
+ if (m->m_flags & M_MCAST)
+ counter_u64_add(ifp->if_counters[IFCOUNTER_OMCASTS], 1);
+}
+
+/*
* Copy data from ifnet to userland API structure if_data.
*/
void
Modified: projects/ifnet/sys/net/if.h
==============================================================================
--- projects/ifnet/sys/net/if.h Tue Jan 13 07:38:29 2015 (r277111)
+++ projects/ifnet/sys/net/if.h Tue Jan 13 07:40:59 2015 (r277112)
@@ -706,6 +706,7 @@ void if_detach(if_t);
void if_input(if_t, struct mbuf *);
void if_mtap(if_t, struct mbuf *, void *, u_int);
void if_inc_counter(if_t, ift_counter, int64_t);
+void if_inc_txcounters(if_t, struct mbuf *);
void if_link_state_change(if_t, int);
void if_set(if_t, ift_feature, uint64_t);
void * if_getsoftc(if_t, ift_feature);
More information about the svn-src-projects
mailing list