On Mon, 21 Nov 2005 22:58:10 +0100 Aritz Bastida <[EMAIL PROTECTED]> wrote:
> Hello everybody > > I need to turn off and on the polling done to a network device > which works with NAPI. I'll explain: whenever it arrives a > packet-receive interrupt the network driver issues > netif_rx_schedule(), to insert itself in that cpu's poll_list. If too > many packets arrive, I would want to turn off polling and turn it on > again later on. This would be done in driver-independent kernel code. > The purpose is that if there is a congestion (meaning that packet > processing can't be done as fast as capturing), then the capture > itself shouldn't be done (and thus, the skb_alloc and packet copy > either). > > Is there any standard way to do that in the kernel? If there isn't > I'll tell what I thought I could do. I guessed I could call > netif_rx_complete() in my higher-layer driver-independent code to > remove the device from the poll list, and > activate it later on calling netif_rx_schedule(). Would it work? Of > course, this would be in atomic context, and the scheduled softirq > could run in a different cpu from the one it was executing before > deactivating it. But, in this case, there wouldn't be a race > condition, and all would work properly right? > > Now, if I want the scheduled softirq run in the same cpu as the > previous, I would probably need to access another processor's > softnet_data struct, which would be racy. Is there any lock or any > secure way I can access that struct? Why not use existing mechanism (netfilter) instead of inventing your own? -- 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