I see NAPI as a form of interrupt merging. I think your question may arise due to a misunderstanding of NAPI. First of all, interrupts are associated with NAPI. In addition, NAPI polling is not really “in vain”. Remember that for NAPI, the idea is that high bandwidth traffic is explosive. NAPI only "starts" after a "packet interrupt" occurs.
Here's a quick overview of how you intend to use NAPI:
The kernel starts a “packet receive interrupt” that detects a network device driver using NAPI. Then, the network device driver disables interrupts associated with receiving packets and, using NAPI, tells the Linux network subsystem to poll the device driver. The polling function is implemented by the device driver and transferred to the network subsystem and contains the device driver package handler. After a sufficient number of packets has been received or a timeout has been reached, packet interruptions are turned on again and everything starts again.
Thus, NAPI is just a centralized API on the Linux network subsystem to support interrupt collapse in order to reduce obesity. NAPI provides device driver developers with a clean infrastructure for merging with interrupts. NAPI does not work all the time, but only happens when the traffic is actually received, which makes it essentially a scheme for combining interrupts ... At least in my book.
Note All this was in the context of a network device driver using NAPI, but in fact NAPI can be used for any interrupt. This is one of the benefits of NAPI.
If in my understanding there are any errors, do not hesitate to indicate them!
mauzel
source share