Some technical information about NICs in Linux (3)

Source: Internet
Author: User
Article Title: some technical information about NICs in Linux (3 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Some technical information about NICs in Linux (continued)
  
All the information that is not suitable for storing elsewhere is piled up here. It may be irrelevant, or you may not be interested, but it is still here.
  
1. transmit Ethernet parameters to the kernel
  
There are two general kernel commands that can pass Ethernet parameters (ether and reserve) to the kernel at startup ). You can use LILO, loadlin, or other startup tools that accept optional parameters to complete this operation.
  
For example, if the command is "blah" and you want to receive three parameters (assumed to be 123, 456, and 789), you should use LILO as follows:
  
LILO: linux blah = 123,456,789
  
For more information about the parameters at startup (and a complete list), see BootPrompt-HOWTO
  
Ether command
  
The ether = parameter is used together with the driver directly built in the kernel. The ether = parameter does not work at all for a modular driver. Its most common form is as follows:
  
Ether = IRQ, BASE_ADDR, PARAM_1, PARAM_2, NAME
All parameters are optional. The first non-numeric parameter is used as NAME.
  
IRQ: obviously. An IRQ value of "0" (usually the default value) means autoIRQ. Setting IRQ instead of base_addr is a historical coincidence-this can be corrected no matter what you change.
  
BASE_ADDR: It is also obvious. If the value is "0" (usually the default value), it indicates the list of network card types of the Ethernet card.
  
PARAM_1: this is used to overwrite the starting memory value of the shared memory Nic such as WD80 * 3. Some drivers use the lower 4 bits of this value to set the diagnostic information level. 0 -- default value, 1-7 -- Level 1 .. 7, (7 is the most complete information) 8 -- Level 0 (no information ). In addition, the LANCE driver uses the lower 4 bits of this value to select the DMA channel. Otherwise, auto-DMA is used.
  
PARAM_2: the 3c503 driver uses it to select the internal or external transceiver. 0 -- default/internal, 1 -- external AUI. Cabletron's E21XX Nic also uses the low 4-bit PARAM_2 to select the output media. Otherwise, it will be automatically detected.
  
NAME: Select the network device specified by this value. The standard kernel uses the names "eth0", "eth1", "eth2", and "eth3" for the Ethernet adapter attached to the bus, and uses "atp0" for the "pocket" Ethernet adapter of the parallel port ". The arcnet driver uses the name "arc0 ". You can use these LILO parameters to explicitly set the base address to enable multiple NICs. 1.0 the kernel processes the LANCE-based Ethernet card as a special case: the LILO parameter is ignored, and the LANCE Nic is always allocated with the name "eth" starting from "eth0 ". The attached non-LANCE Nic must be explicitly specified as "eth" and the usual "eth0" detection is prohibited by means of "ether = 0,-1, eth0. (Yes, this is a Bug .)
  
Reserve Command
  
The subsequent LILO command is used in the same way as the preceding "ether =", that is, it is appended to the startup selection name specified in lilo. conf.
  
Reserve = IO-base, extent {, IO-base, extent ...}
On some machines, you may need to prevent device drivers from checking devices (automatic detection) in a specific area ). This may be caused by poor hardware design that causes startup condensation (such as some Ethernet cards) hardware that is incorrectly identified, hardware whose status is changed during earlier detection, or hardware that does not want the kernel to initialize.
  
The reserve parameter at startup solves this problem by specifying the I/O port area that does not require detection. This region is retained in the port registry of the kernel, just as a device has been found in this region. Note that this mechanism is unnecessary on most machines. It is necessary only when there is a problem or a specific situation.
  
The I/O ports in the specified region are protected and are not affected by device detection. This method is used when some drivers are suspended by NE2000 or other devices are incorrectly identified as NE2000. The correct device driver should not detect a reserved region unless it is explicitly specified by another startup parameter. This implies that reserve is often used with other startup parameters. Therefore, if you specify a reserve region to protect a specific device, you must specify the device detection. Most drivers ignore the port registry after a specific address is specified.
  
For example
  
LILO: linux reserve = 0x300, 32 ether = x, eth0
So that drivers of all devices other than the Ethernet card driver do not detect 0x300-0x31f.
  
Generally, the maximum number of parameters at startup is 11. Therefore, each reserve keyword can only specify five reserved regions. If the request is complex, you can use multiple reserve commands.
  
2. use the Ethernet driver as a module
  
Currently, most Linux distributions only contain a few built-in drivers. Drivers are provided in the form of independent dynamic and rewritable modules. These modular drivers are usually loaded by the administrator using the modprobe (8) command, or in some cases by the kernel through "kerneld" (in version 2.0) or "kmod" (in version 2.1) load automatically, and then call modprobe.
  
Your release may provide a good graphical configuration tool to set the Ethernet module. If possible, use them first. The following describes the information under these fancy configuration programs and what these programs have changed.
  
Control which modules are used and the options provided by each module are generally stored in the/etc/conf. modules file. The two main options used in this file (for the Ethernet card) are alias and options. Modprobe command to view the file for module information.
  
The actual module itself is generally stored in the/lib/modules/'uname-r'/net directory, where the uname-r command gives the kernel version (for example, 2.0.34 ). Here you can check which module matches your Nic.
  
In your conf. modules file, the first thing you need is to tell modprobe which driver is used for the eth0 (and eth1 and...) network interfaces. To do this, use the alias command. For example, if there is an isa smc EtherEZ Nic that uses a smc-ultra.o driver module, you need to add the following line to alias the driver to eth0:
  
Alias eth0 smc-ultra
  
Next, you may need an options line to indicate which options are used with a specific module (or module alias. In the above example, if there is only one line of alias without the options line, the kernel will warn (see dmesg) that it is not good to automatically detect the ISA Nic. To eliminate this warning, add another line to indicate the I/O base address on which the module Nic is configured. for example, the hexadecimal address is 0x280.
  
Options smc-ultra io = 0x280
  
Most ISA modules accept parameters such as io = 0x340 and irq = 12 in the insmod command line. These parameters are provided to prevent detection of this Nic from being required or at least strongly recommended. Unlike PCI and EISA devices, most ISA devices do not have a truly secure automatic probe method. Therefore, automatic probe should be avoided when the driver is used as a module.
  
The list of all options accepted by each module can be found in the following file:
  
/Usr/src/linux/Documentation/networking/net-modules.txt
  
We recommend that you read this file to see which options can be used for your specific Nic. Note: for a single module that can process multiple devices, some support comma-separated value lists, such as all 8390-based drivers and PLIP drivers. For example:
Options 3c503 io = 0x280,0x350 ,0x330,0 x xcvr =
The above is a module that controls four 3c503 NICs, where Nic 2 and 4 use external transceiver. Do not use spaces around "=" or commas.
  
Note that a busy module cannot be deleted. This means you need to use ifconfig eth0 down (disable the Ethernet card) before deleting the module ).
  
The command lsmod can display which modules are loaded and whether they are in use. rmmod can delete these modules.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.