5.10. Tuning via /proc Filesystem
Figure 5-5 shows the files that can be used either to tune or to view the status of configuration parameters related to the topics covered in this chapter.
In /proc/sys/kernel are the files modprobe and hotplug that can change the pathnames of the two programs introduced earlier in the section "User-Space Helpers."
A few files in /proc export the values within internal data structures and configuration parameters, which are useful to track what resources were allocated by device drivers, shown earlier in the section "Basic Goals of NIC Initialization." For some of these data structures, a user-space command is provided to print their contents in a more user-friendly format. For example, lsmod lists the modules currently loaded, using /proc/modules as its source of information.
In /proc/net, you can find the files created by net_dev_init, via dev_proc_init and dev_mcast_init (see the earlier section "Initializing the Device Handling Layer: net_dev_init"):
-
Displays, for each network device registered with the kernel, a few statistics about reception and transmission, such as bytes received or transmitted, number of packets, errors, etc.
-
Displays, for each network device registered with the kernel, the values of a few parameters used by IP multicast.
-
Similarly to dev, for each wireless device, prints the values of a few parameters from the wireless block returned by the dev->get_wireless_stats virtual function. Note that dev->get_wireless_stats returns something only for wireless devices, because those allocate a data structure to keep those statistics (and so /proc/net/wireless will include only wireless devices).
-
Exports statistics about the software interrupts used by the networking code. See Chapter 12.
dev
dev_mcast
wireless
softnet_stat
Figure 5-5. /proc files related to the routing subsystem
There are other interesting directories, including /proc/drivers, /proc/bus, and /proc/irq, for which I refer you to Linux Device Drivers. In addition, kernel parameters are gradually being moved out of /proc and into a directory called /sys, but I won't describe the new system for lack of space.
5.11. Functions and Variables Featured in This Chapter
Table 5-1 summarizes the functions, macros, variables, and data structures introduced in this chapter.
Name | Description |
---|---|
Functions and macros | |
request_irq free_irq | Registers and releases, respectively, a callback handler for an IRQ line. The registration can be exclusive or shared. |
request_region release_region | Allocates and releases I/O ports and I/O memory. |
call_usermodehelper | Invokes a user-space helper application. |
module_param | Macro used to define configuration parameters for modules. |
net_dev_init | Initializes a piece of the networking code at boot time. |
Global variables | |
dev_boot_phase | Boolean flag used by legacy code to enforce the execution of net_dev_init before NIC device drivers register themselves. |
irq_desc | Pointer to the vector of IRQ descriptors. |
Data structure | |
struct irq_action | Each IRQ line is defined by an instance of this structure. Among other fields, it includes a callback function. |
net_device | Describes a network device. |
5.12. Files and Directories Featured in This Chapter
Figure 5-6 lists the files and directories referred to in this chapter.