svn commit: r271803 - head/sys/dev/tl

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 18 20:51:00 UTC 2014


  Navdeep,

On Thu, Sep 18, 2014 at 01:09:05PM -0700, Navdeep Parhar wrote:
N> Consider changing if_inc_counter to be inline and have it take const 
N> ints for the counter and increment.  The compiler will optimize away all 
N> the unneeded code in if_inc_counter.

Yep, constifying is a good idea.

Regarding the contents of if_inc_counter(). The plan is to remove racy
counters, make array of counter(9), then if_inc_counter() will get rid
of switch(), instead it will do:

	counter_u64_add(ifp->counters[cnt]);

We can't make it inline, since we want drivers to be not aware of
struct ifnet entirely.

Anyway, high performance drivers do accounting in hardware, and will
not execute if_inc_counter() on fast path.

-- 
Totus tuus, Glebius.


More information about the svn-src-head mailing list