Chapter 12: Networks
void (*tx_timeout) (struct net_device *dev);
int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
/* Network namespace this network device is inside */
struct net *nd_net;
/ class/net/name entry /
struct device dev;
...
The abbreviationsRxandTxthat appear in the structure are often also used in function names, variable
names, and comments. They stand forReceiveandTransmit, respectively, and crop up a few times in the
following sections.
The name of the network device is stored inname. It consists of a string followed by a number to differen-
tiate between multiple adapters of the same type (if, e.g., the system has two Ethernet cards). Table 12-2
lists the most common device classes.
Table 12-2: Designations for Network Devices
Name Device class
ethX Ethernet adapter, regardless of cable type and transmission speed
pppX PPP connection via modem
isdnX ISDN cards
atmX Asynchronous transfer mode, interface to high-speed network cards
lo Loopbackdevice for communication with the local computer
Symbolic names for network cards are used, for example, when parameters are set using theifconfig
tool.
In the kernel, network cards have a unique index number that is assigned dynamically when they are
registered and is held in theifindexelement. Recall that the kernel provides thedev_get_by_nameand
dev_get_by_indexfunctions to find thenet_deviceinstance of a network card by reference to its name
or index number.
Some structure elements define device properties that are relevant for the network layer and the network
access layer:
❑ mtu(maximum transfer unit) specifies the maximum length of a transfer frame. Protocols of the
network layer must observe this value and may need to split packets into smaller units.
❑ typeholds the hardware type of the device and uses constants from<if_arp.h>. For example,
ARPHRD_ETHERandARPHDR_IEEE802stand for 10 Mbit and 802.2 Ethernet,ARPHRD_APPLETLKfor
AppleTalk, andARPHRD_LOOPBACKfor the loopback device.