Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Mar 2009 08:55:51 -0700
From:      Sam Leffler <sam@freebsd.org>
To:        Andrew Brampton <brampton+freebsd-net@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Interrupts + Polling mode (similar to Linux's NAPI)
Message-ID:  <49CCF707.40101@freebsd.org>
In-Reply-To: <d41814900903261747v28d3de29t10bb1b8128de635c@mail.gmail.com>
References:  <d41814900903261747v28d3de29t10bb1b8128de635c@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Brampton wrote:
> Hi,
> Linux has a feature called NAPI, which amongst other things has this
> Interrupt initiated polling mode. Whilst the network traffic is quiet
> the network interfaces use interrupts, however as soon as the load
> becomes higher polling kicks in and stays like that until the load
> drops again.
>
> I know that FreeBSD can do interrupts or polling, but not together. I
> think that that NAPI pretty neat as it provides the benefits of both
> interrupts and polling, namely low CPU load (when the network is not
> busy), and high performance. I was wondering if anyone has considered
> this approach in FreeBSD? If not why not? Is there some reason why the
> binary FreeBSD approach is better? Or is it just that no one has
> dedicated the time and effort to implement this feature?
>   

NAPI is essentially interrupt moderation in s/w.  As Luigi noted 
elsewhere polling in freebsd is rather different with livelock avoidance 
being just one of the goals.  I've had several projects where people 
coming from linux felt is was critical to implement NAPI or something 
similar on a bsd system.  In the end they found it was not a significant 
win if the hardware is reasonably designed and the driver properly 
tuned.  Some of this relates to how the network stacks differ in 
design.  I think a NAPI-like facility would mostly be used for legacy 
devices which is not to say it's a bad idea or that you shouldn't work 
on it.  Whether or not it's incorporated into the system would depend on 
how much of a win it turns out to be and how intrusive it is as you'd 
need to mod all the drivers.

    Sam




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