Network Device Drivers in Linux Sub1
Network Device Drivers in Linux Sub1
Aapo Kalliola
Aalto University School of Science
Otakaari 1
Espoo, Finland
[email protected]
3. DRIVERS IN PRACTISE
In this section we look into network device drivers in the real
world. First we look into the minimal functionality a net-
Connectivity 3.2 e1000
TODO: Continue to do a more thorough and comprehen-
System call interface
sive overview of the e1000 code and walkthroughs of key
functions.
Kernel
Networking
subsystem
3.2.1 struct e1000_adapter
The structure struct e1000 adapter in e1000.h is the board-
Network specific private data structure. It contains many interesting
subsystem fields for features related to VLANs, link speed and duplex
Software management, packet counters, interrupt throttle rate, TX
support and RX buffers, and also the operating system defined struc-
Interface tures net device and pci dev. An adapter may have multiple
driver
RX and TX queues active at the same time.
The transmission and receiving mechanisms on hardware Table 1: Adapter private structure comparison
are device-dependent and can be discovered either through
manufacturer documentation such as [4] or by reverse engi- One comparison that can be done to get some insight about
neering. Usual areas of interest are the transmit and receive the feature differences between the simple driver and the
memory buffers. These buffers can be implemented on hard- e1000 driver is to look into their private data structure and
ware as, for instance, ring buffers. see what fields they contain. These names are shown, if
applicable, and grouped into categories with descriptions in
TODO: more details about the receive and transmit control Table 1.
4. FEATURES and polling vs. interrupt driven mode selection depending
In this section we look into specific feature implementations on traffic profile. This effectively places a significant amount
in the e1000 driver. of burden on the network interface hardware and driver as
weak implementation in them might well hamper the per-
4.1 Interrupt throttling formance of the whole system.
When the network interface receives a series of packet it
can send an interrupt, buffer the packet and wait for a poll Overall our still incomplete analysis of a minimal network
later on, or buffer the packet and send an interrupt when device driver and the state-of-the-art e1000 driver our pa-
the allocated buffer size hits a given threshold. This set of per shows that the current real-life drivers are thoroughly
different behaviours is an area that has plenty of opportuni- optimized and feature-rich.
ties for optimization for different traffic profiles. Polling is
typically less resource-consuming with heavy traffic, whereas 6. REMAINING WORK...
interrupt-driven operation is better for low latencies when This paper is still very much a work in progress, apologies to
the traffic is not very heavy. the reviewers for this. I’ll expand on at least simple driver
vs e1000 and features analysis, but in general more details
The e1000 driver has an internal interrupt throtte rate (ITR) and verification of content currentness (most sources are >5
control mechanism that seeks to dynamically adjust the in- years old) will be forthcoming.
terrupt frequency depending on the current traffic pattern.
This functionality is controlled using the InterruptThrot- 7. REFERENCES
tleRate parameter in e1000 param.c. Functions relevant to [1] J. Corbet, A. Rubini, and G. Kroah-Hartman. Linux
ITR are: Device Drivers, Third Edition. 2005.
• e1000 update itr [2]
• e1000 set itr http://lxr.linux.no/#linux+v3.6.7/drivers/net/ethernet,
November 2012.
• e1000 clean (NAPI related)
[3] M. L. Jangir. Writing network device drivers for linux.
It seems that the driver is capable of adjusting not only Linux Gazette, (156), November 2008.
the interrupt frequency but also whether it works in polling [4] Realtek. RTL8139(A/B) Programming guide: (V0.1).
or interrupt-driven mode (e1000 clean). Investigate fur- 1999.
ther.
5. CONCLUSION
Modern network device driver and hardware handles func-
tionality that has originally been the responsibility of the
operating system and the CPU, such as packet fragmenta-
tion and checksum computation. This leads to significant
complexity in the driver compared to a more feature-limited
approach.