Date: Tue, 13 Jan 2015 07:41:00 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r277112 - projects/ifnet/sys/net Message-ID: <201501130741.t0D7f0s3038444@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501130741.t0D7f0s3038444>