Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 2014 00:50:55 +0400
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        Navdeep Parhar <np@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r271803 - head/sys/dev/tl
Message-ID:  <20140918205055.GE884@FreeBSD.org>
In-Reply-To: <541B3BE1.7080005@FreeBSD.org>
References:  <201409182003.s8IK3kr8033068@svn.freebsd.org> <541B3BE1.7080005@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140918205055.GE884>