驱动程序是否使用Linux NAPI接口?

时间:2009-12-21 16:24:17

标签: linux networking driver

有没有办法确认Linux以太网驱动程序是否正在使用NAPI接口?

1 个答案:

答案 0 :(得分:6)

我知道这听起来很明显,但请查看源代码以了解是否正在使用NAPI API。
例如

  • 在你的驱动程序的中断处理程序中,它是否使用下面的任何调用?
  • 您的驱动程序是否为NAPI实现了poll()方法?如果是,请查看它是否使用 netif_receive_skb()而不是 netif_rx()

如果这两个问题都导致“是”,那么您的驱动程序正在使用NAPI。

注意:以下内容是从here

复制的
NAPI API

netif_rx_schedule(dev) 
    Called by an IRQ handler to schedule a poll for device
netif_rx_schedule_prep(dev) 
    puts the device in a state ready to be added to the CPU polling list if it is up and running. You can look at this as the first half of netif_rx_schedule(dev).
__netif_rx_schedule(dev) 
    Add device to the poll list for this CPU; assuming that netif_schedule_prep(dev) has already been called and returned 1
__netif_rx_schedule_prep(dev) 
    similar to netif_rx_schedule_prep(dev) but no check if device is up, usually not used
netif_rx_reschedule(dev, undo) 
    Called to reschedule polling for device specifically for some deficient hardware.
netif_rx_complete(dev) 
    Remove interface from the CPU poll list: it must be in the poll list on current cpu. This primitive is called by dev->poll(), when it completes its work. The device cannot be out of poll list at this call, if it is then clearly it is a BUG().
__netif_rx_complete(dev) 
    same as netif_rx_complete but called when local interrupts are already disabled.

查看此wikipedia article及其中的外部链接以获取更多详细信息。

我希望有所帮助。