Chapter 14. Network Drivers
We are now through discussing char and block drivers and are ready to move on to the fascinating world of networking. Network interfaces are the third standard class of Linux devices, and this chapter describes how they interact with the rest of the kernel.
A network interface doesn’t exist in the filesystem the way char and block devices do. Instead, it deals with packet transmission and reception at the kernel level, without being bound to an open file in a process.
The role of a network interface within the system is similar
to that of a mounted block device. A block device registers its
features in the blk_dev
array and other kernel structures,
and it then ``transmits'' and ``receives'' blocks on request, by means
of its request_fn function. Similarly, a network
interface must register itself in specific data structures in order to
be invoked when packets are exchanged with the outside world.
There are a few important differences between mounted
disks and packet-delivery interfaces. To begin with, a disk exists
as a node in the /dev
directory, while a network interface
doesn’t appear in the filesystem. But the most important difference
between the two is that while the disk is asked
to send a buffer towards the kernel, the net device asks to
push incoming packets towards the kernel.
The network subsystem of the Linux kernel is designed to be completely protocol-independent. This applies to both networking protocols (IP vs. IPX or other protocols) ...
Get Linux Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.