Subject: Re: RFC: possible NAPI improvements to reduce interrupt rates for low traffic rates

From: James Chapman <[email-masked]>
Date: Wed, 12 Sep 2007 17:39:26 +0100

David Miller wrote:
> From: James Chapman <[email-masked]>
> Date: Thu, 6 Sep 2007 15:16:00 +0100
> 
>> First, do we need to encourage consistency in NAPI poll drivers? A
>> survey of current NAPI drivers shows different strategies being used
>> in their poll(). Some such as r8169 do the napi_complete() if poll()
>> does less work than their allowed budget. Others such as e100 and
>> tg3 do napi_complete() only if they do no work at all.
> 
> Actually, I want to clarify this situation.  In reality these
> drivers are more consistent than different.
> 
> For some chips the cheapest way to figure out if there is more
> RX work is simply to see if the amount of work processed is
> less than "budget".  It's too expensive to recheck the hardware.
> 
> On some chips like tg3, it's extremely cheap to see if new work
> arrived between the completion of processing the RX queue and
> the NAPI completion check, so they do it.

The inconsistencies I see are to do with the conditions that the driver 
chooses to exit polled mode, i.e. doing no work in the poll() versus 
doing less than budget, and whether txdone processing is done in the 
poll or in the interrupt handler. I didn't mean to suggest that 
rechecking for more work just before doing the napi_complete() was an 
example of inconsistency.

The rest of the RFC talks about polling the device while it might be 
idle. The overhead of checking for work varies for each system / device 
as you say. Where it is expensive, the driver could optimize that case.

-- 
James Chapman
Katalix Systems Ltd
http://www.katalix.com
Catalysts for your Embedded Linux software development