Subject: Re: NAPI, e100, and system performance problem

From: Stephen Hemminger <[email-masked]>
Date: Sat, 23 Apr 2005 12:51:53 +1000

On Fri, 22 Apr 2005 16:43:01 -0700
"David S. Miller" <[email-masked]> wrote:

> On Sat, 23 Apr 2005 09:40:38 +1000
> Stephen Hemminger <[email-masked]> wrote:
> 
> > My experience is that NAPI adds latency and that can cause worse performance.
> > I haven't seen a good analysis of the problem and/or simple tests to reproduce
> > the problem
> 
> Right, and it's cpu and bus speed dependant as to when you hit
> this bad case.  If your packet rate is perfectly such that
> only 1 or 2 packets get processed per interrupt then NAPI loses
> badly due to the extra PIO overhead entailed from enabling and
> disabling interrupts.
> 
> This is essential and well understood, and I personally don't need
> to see "numbers" to acknowledge this flaw.
> 
> I hope that minimal mitigation settings alleviate this problem for
> the most part.
> 
> When I moved tg3 over to NAPI, the happiest part of that was deleting
> the dynamic hw mitigation setting code the tg3 driver had.  If ever
> that kind of thing goes back into the drivers, it should be based
> upon a common feedback variable (something based upon dev->weight
> perhaps), not reimplemented N times, once in every driver.
> 
> With the dynamic schemes comes a new issue, how quickly to respond
> to changes in traffic patterns.

One of the problem with the dynamic schemes, is there is no generic infrastructure
to support it. There are some drivers that have tried dynamic schemes
but each seems to reinvent some adhoc scheme. Seems like a good area
for future research.

Another related problem is some drivers use NAPI for both TX and RX and
this can cause asymmetric behavior and scheduling issues. The whole
dev->weight limit stuff assumes RX not TX usage of NAPI