New API

New API

New API (also referred to as NAPI) is an interface to use interrupt mitigation techniques for networking devices in the Linux kernel. Such an approach is intended to reduce the overhead of packet receiving. The idea is to defer incoming message handling until there is a sufficient amount of them so that it is worth handling them all at once.

Contents

Motivations for using NAPI

A straightforward method of implementing a network driver is to interrupt the kernel by issuing an interrupt request (IRQ) for each and every incoming packet. However, servicing IRQs is costly in terms of processor resources and time. Therefore the straightforward implementation can be very inefficient in high-speed networks, constantly interrupting the kernel with the thousands of packets per second. Overall performance of the system as well as network throughput can suffer as a result.

Polling is an alternative to interrupt-based processing. The kernel can periodically check for the arrival of incoming network packets without being interrupted, which eliminates the overhead of interrupt processing. Establishing an optimal polling frequency is important, however. Too frequent polling wastes CPU resources by repeatedly checking for incoming packets that have not yet arrived. On the other hand, polling too infrequently introduces latency by reducing system reactivity to incoming packets, and it may result in the loss of packets if the incoming packet buffer fills up before being processed.

As a compromise, the Linux kernel uses the interrupt-driven mode by default and only switches to polling mode when the flow of incoming packets exceeds a certain threshold, known as the "weight" of the network interface.

NAPI compliant drivers

A driver using the NAPI interface will work as follow :

  • Packet receive interrupts are disabled.
  • The driver provides a poll method to the kernel. That method will fetch all incoming packets available, on the network card or a DMA ring, so that they will then be handled by the kernel.
  • When allowed to, the kernel calls the device poll method to possibly handle many packets at once.

Advantages of using NAPI

  • The load induced by interrupts is reduced even though the kernel has to poll.
  • Packets are less likely to be re-ordered, while out of order packet handling might be a bottleneck otherwise.
  • In case the kernel is unable to handle all incoming packets, the kernel does not have to do any work in order to drop them: they are simply overwritten in the network card's incoming ring buffer. Without NAPI, the kernel has to handle every incoming packet regardless of whether there is time to service it, which leads to thrashing.

History of NAPI

NAPI was an over three year effort by Alexey Kuznetsov, Jamal Hadi Salim and Robert Olsson. Initial effort to include NAPI was met with resistance by some members of the community, however David Miller worked hard to ensure NAPI's inclusion.

A lot of real world testing was done in the Uppsala university network before inclusion. In fact, www.slu.se was the first production NAPI-based OS and is still powered to this day by NAPI-based Bifrost/Linux routers. The pktgen traffic generator was also born around this time. Pktgen was extensively used to test NAPI scenarios not induced by real world traffic.

Further reading

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • New Centre — Nouveau Centre Leader Hervé Morin Founded 29 May 2007 …   Wikipedia

  • New Pole for Italy — Nuovo Polo per l Italia Leader Pier Ferdinando Casini (UDC), Gianfranco Fini (FLI), Francesco Rutelli (API), Raffaele Lombardo (MPA) Founded 15 December 2010 …   Wikipedia

  • New Zealand general election, 1999 — 1996 ← members November 27, 1999 (1999 11 27) …   Wikipedia

  • New Point Comfort Light — New Point Comfort Light, Virginia (NPS) Location New Point Comfort at the entrance to MobJack Bay in the Chesapeake Bay Coordinates …   Wikipedia

  • New I/O — New I/O, usually called NIO, is a collection of Java programming language APIs that offer features for intensive I/O operations. It was introduced with the J2SE 1.4 release of Java by Sun Microsystems to complement an existing standard I/O. NIO… …   Wikipedia

  • New Energy for America — See also: Climate change in the United States New Energy for America is the Barack Obama Joe Biden plan to invest in renewable energy, reduce reliance on foreign oil, address the global climate crisis, and create jobs. Contents 1 History …   Wikipedia

  • New Union (Social Liberals) — Naujoji sąjunga (socialliberalai) Leader Artūras Paulauskas Founded 1998 (1 …   Wikipedia

  • New Alliance Party (Mexico) — New Alliance Party Partido Nueva Alianza Leader Jorge Kahwagi Founded January 30 …   Wikipedia

  • API well number — An API well number or API number is a unique, permanent, numeric identifier assigned to each well drilled for oil and gas in the United StatesAmerican Petroleum Institute, 1979, The API well number and standard state and county numeric codes… …   Wikipedia

  • New York Times Company — The New York Times Beschreibung Überregionale Tageszeitung Verlag The New York Times Company …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”