From: Oliver Neukum <oliver@xxxxxxxxxx> Date: Wed, 11 May 2011 19:37:47 +0200 > How is the frequency NAPI uses to poll determined? We could abuse > this and resubmit the rx URBs only at poll time, but this feels dirty, > because we would still leave interrupts enabled. It's not a frequency determined internally by the networking. It is purely event based (meaning triggered by the device's interrupt). Control flow is: IRQ --> irq_handler() my_netdevice_disable_device_irq(); napi_schedule(); --> schedule POLL soft irq SOFTIRQ --> net_rx_action() budget = netdev_budget; for_each_net_device_needing_polling() { ... weight = napi_state->weight; ... work = n->poll(n, weight); ... budget -= work; ... } That's the general idea. Basically once you take you interrupt, and disable device interrupts, the generic net device layer calls your ->poll() routing with a "weight" You should not process more RX packets than this value. If you have less than "weight" work to do, you should do a napi_complete(), which takes you out of the polling group, and re-enable device interrupts. So the idea is that you keep getting ->poll()'d until there is no more RX work to do. The "weight" argument implements fairness amongst competing, actively polling, devices on the same CPU. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html