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

发布于 2024-08-16 05:23:14 字数 41 浏览 4 评论 0原文

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

Is there a way to confirm if a Linux Ethernet driver is using the NAPI interface?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我入戏太深 2024-08-23 05:23:14

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

例如

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

如果这两个问题的结果均为“是”,则您的驱动程序正在使用 NAPI。

注意:以下内容是从此处复制的,

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.

请查看此维基百科文章 及其外部链接以获取更多详细信息。

我希望这有帮助。

I know this sounds like an obvious answer, but check the source to see if the NAPI API is being used.

For example:

  • In your driver's interrupt handler, does it use any of the calls below?
  • Does your driver implement a poll() method for the NAPI? If so, see if it uses
    netif_receive_skb() instead of netif_rx().

If both of those questions lead to 'YES', the your driver is using NAPI.

Note: The following was copied from 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.

Check out this wikipedia article and the external links in it for more detailed information.

I hope that helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文