Product SiteDocumentation Site

22.5. Setting Module Parameters

Like the kernel itself, modules can also take parameters that change their behavior. Most of the time, the default ones work well, but occasionally it is necessary or desirable to set custom parameters for a module. Because parameters cannot be dynamically set for a module that is already loaded into a running kernel, there are two different methods for setting them.
  1. You can unload all dependencies of the module you want to set parameters for, unload the module using modprobe -r, and then load it with modprobe along with a list of customized parameters. This method is often used when the module does not have many dependencies, or to test different combinations of parameters without making them persistent, and is the method covered in this section.
  2. Alternatively, you can list the new parameters in an existing or newly-created file in the /etc/modprobe.d/ directory. This method makes the module parameters persistent by ensuring that they are set each time the module is loaded, such as after every reboot or modprobe command. This method is covered in Section 22.6, “Persistent Module Loading”, though the following information is a prerequisite.
You can use modprobe to load a kernel module with custom parameters using the following command line format:
Example 22.3. Supplying optional parameters when loading a kernel module
~]# modprobe <module_name> [parameter=value] 

Here are some things to be aware of when loading a module with custom parameters on the command line:
Here are the recommended steps for setting custom parameters and then loading a kernel module. This procedure illustrates the steps using the e1000e module, which is the network driver for Intel PRO/1000 network adapters, as an example:
Procedure 22.1. Loading a Kernel Module with Custom Parameters
  1. First, ensure the module is not already loaded into the kernel:
    ~]# lsmod |grep e1000e
    ~]# 
    Output indicates that the module is already loaded into the kernel, in which case you must first unload it before proceeding. Refer to Section 22.4, “Unloading a Module” for instructions on safely unloading it.
  2. Load the module and list all custom parameters after the module name. For example, if you wanted to load the Intel PRO/1000 network driver with the interrupt throttle rate set to 3000 interrupts per second for the first, second and third instances of the driver, and Energy Efficient Ethernet (EEE) turned on[4] , you would run, as root:
    ~]# modprobe e1000e InterruptThrottleRate=3000,3000,3000 EEE=1
    This example illustrates passing multiple valued to a single parameter by separating them with commas and omitting any spaces between them.


[4] Despite what the example might imply, Energy Efficient Ethernet is turned on by default in the e1000e driver.