On Mon, 21 Nov 2005 21:56:32 +0100
Aritz Bastida <[EMAIL PROTECTED]> wrote

The network developers don't always read lkml, please move this
thread to netdev@vger.kernel.org

> Hello everybody.
> 
> What I need is to turn off and on the polling done to a network device
> which works with NAPI. I'll explain: the network driver issues
> netif_rx_schedule() and inserts itself in that cpu's poll_list. But,
> transparently, in higher-layer kernel code, that device could be
> extracted from that poll_list (if the machine is in congestion, that's
> the research i'm doing) and added again later.

Unless that higher-level code is on the same CPU, you will have introduced
a race.

> To do that, I guess I could just remove the device from the poll_list
> and add it again when needed, but then the cpu in which I'm doing this
> could be different from the previous (if in SMP context), right?
> Anyway, if this is what I have to do, I could just access
> per_cpu(softnet_data, cpu), but I guess a lock is required for that
> (because I am accessing the info for another cpu). In that case, what
> lock?

You want to change something down inside and not get your hands dirty?


> I've looking if there is any function for that purpose, and found
> netif_poll_enable/disable, but I couln't find any information that
> explains what it is for and the purpose of the bit
> __LINK_STATE_RX_SCHED. Anyone can tell?

Did you read Documentation/networking/NAPI_HOWTO.txt?
It is long winded, but you can understand the basic flow. 
The bit is to make sure not to insert a device in the poll list
if it is already in one.

-- 
Stephen Hemminger <[EMAIL PROTECTED]>
OSDL http://developer.osdl.org/~shemminger
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to