gpt4 book ai didi

linux - 驱动程序是否使用 Linux NAPI 接口(interface)?

转载 作者:太空狗 更新时间:2023-10-29 11:34:53 43 4
gpt4 key购买 nike

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

最佳答案

我知道这听起来像是一个显而易见的答案,但请检查源代码以查看是否正在使用 NAPI API。
例如:

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

如果这两个问题的答案都是"is",则说明您的驱动程序正在使用 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以及其中的外部链接以获得更详细的信息。

希望对您有所帮助。

关于linux - 驱动程序是否使用 Linux NAPI 接口(interface)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1941071/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com