Representation of Network Devices

In the kernel, each network device is represented by an instance of the net_device structure. Once a structure instance has been allocated and filled, it must be registered with the kernel using register_netdev from net/core/dev.c. This function performs some initialization tasks and registers the device within the generic device mechanism. This creates a sysfs entry (see Chapter 10.3) /sys/class/net/<device>, which links to the device's directory. A system with one PCI network card and the loopback device has two entries in /sys/class/net:

[email protected] # Is -l /sys/class/net total 0

lrwxrwxrwx 1 root root 0 2008-03-09 09:43 eth0 -> ../../devices/pci0000:00/0000:00:1c.5/ 0000:02:00.0/net/eth0

lrwxrwxrwx 1 root root 0 2008-03-09 09:42 lo -> ../../devices/virtual/net/lo

Continue reading here: Several of these pointers may have a nonnull value because a network device can be used with several network protocols at the same time

Was this article helpful?

0 0