从驱动程序禁用NIC卡中的中断是否会停止数据包接收 [英] Disabling interrupt in NIC card from driver does it stop packet reception

查看:126
本文介绍了从驱动程序禁用NIC卡中的中断是否会停止数据包接收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在rtl驱动程序中,我试图研究在哪个init函数(pci_driver探测函数相同)中禁用irq.

所以我的问题是:如果我禁用中断,那么NAPI(新API)是否起作用,或者它也基本停止运行,以至于我注意到intel以太网设备驱动程序中的作用.

所以问题是为什么禁用中断很有用.

Interrut与新API不同.如果不同,则如何启用NAPI(新API)数据包接收.

是否有任何内核函数,或者我只是从内核调用netif_napi_add函数并将其写入设备,例如enable napi mask.我到底要用writeb写入设备还是将设备家族写入设备.

我正在谈论Realtek以太网设备的r8169设备驱动程序

解决方案

首先,NIC中断不仅用于数据包接收.例如,考虑链接状态改变中断,错误中断(当网络适配器需要向主机通知硬件错误时)和其他内务处理"中断.那些.中断服务的机制的完整列表可能在很大程度上是特定于供应商的.我的观点是,可能不一定要禁用 all 中断.这样做可能会导致不良后果.

关于 Rx中断,通常是中断 mitigation .这个想法是让NIC为数据包的 batch 而不是单个接收到的数据包(或与较小的 比较大的)生成Rx中断.这样,减少了在给定时间间隔内生成的中断数量,从而减少了内核在中断服务例程( ISR )中花费的CPU时间.

另一方面,禁用 Rx中断是一种完全不同的方法,这意味着内核本身会定期轮询驱动程序以检查是否有新数据包.在该方案中,不是网络适配器唤醒"网络适配器.内核通过请求处理新数据包的中断来实现;它是内核自己认为必要时决定检查新数据包的内核.这样,数据包接收变得更加高效,这是 NAPI (新API )背后的主要思想.

您正在研究的特定驱动程序有什么用,可能不一定精通它的所有复杂性.最好针对特定的设备驱动程序提出单独的问题.

in rtl driver I am trying to study in which inside init function (pci_driver probe function same) its disabling irq.

So my question is: if I disable interrupt then does NAPI (New API) works or it also stops so basiccally that same I have noticed in Ethernet device driver from intel.

So question is why disabling interrupt is useful.

Is Interrut different from New API. if it is different then how in NAPI (New API) packet reception be enabled.

is there any kernel function or I just call netif_napi_add function from kernel and write to device something like enable napi mask. What exactly I have to write to device with writeb or family to device.

I am talking about r8169 device driver for realtek Ethernet device

解决方案

To begin with, NIC interrupts are not just for packet reception. In example, think of link status change interrupts, error interrupts (when the network adapter needs to notify the host of a HW error) and other "housekeeping" ones. A complete list of mechanisms served by interrupts might be largely vendor-specific. My point is that one may not necessarily want to disable all interrupts; doing so may cause unwanted consequences.

With respect to Rx interrupts, it's interrupt mitigation which is commonly used. The idea is to let the NIC generate an Rx interrupt for a batch of packets rather than for a single received one (or, for larger batches compared to smaller ones). This way, the number of interrupts generated in a given time interval is reduced, which leads to lesser CPU time spent by the kernel in interrupt service routines (ISR).

On the other hand, disabling Rx interrupts is a completely different approach which implies that the kernel itself periodically polls the driver to check for new packets. In this scheme, it's not the network adapter which "awakens" the kernel by means of interrupts asking to process new packets; it's the kernel which on its own decides to check for new packets when it deems that necessary. This way, packet reception becomes even more efficient, and this is the main idea behind NAPI (New API).

What's for the specific driver which you're studying, one may not necessarily be well-versed in all the intricacies of it. It's better to file separate questions for specific device drivers.

这篇关于从驱动程序禁用NIC卡中的中断是否会停止数据包接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆