Some technical information about NICs in Linux (2)

Source: Internet
Author: User
Article Title: some technical information about NICs in Linux (2 ). 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.
6 Broadcast and hybrid mode
  
Another thing Donald does is to implement the hook of broadcast and mixed mode. All published (not ALPHA) ISA drivers now support the hybrid mode.
  
Donald wrote: "I'm going to start with discussing mixed patterns, and it's very easy to implement in terms of concept. For most hardware, you only need to set a register bit to receive each packet on the line. Yes, it's almost that simple. for some hardware, you must first turn off the board (may lose several packets), reconfigure it, and then re-enable the Ethernet card. Right, that's simple. what we will discuss below is not so obvious: broadcast mode. It can be implemented in two ways:
  
Use the mixed mode and a packet filter such as the Berkeley Packet Filter (BPF. BPF is a pattern matching instruction language. you can write a program to pick out the address you are interested in. Its advantage is that it is common and programmable. The disadvantage is that there is no general method for the kernel to avoid opening the mixed mode and running packets on each line through each registered package filter. For more information, see Berkeley package filters.
Most Ethernet chips are used with built-in broadcast packet filters.
I would like to list several broadcast package filters provided by the Ethernet card/chip:
  
Chip/Nic mixed-mode broadcast package filter
Seeq8001/3c501 Yes Binary filter (1)
3Com/3c509 Yes Binary filter (1)
8390 Yes Autodin II six bit hash (2) (3)
LANCE Yes Autodin II six bit hash (2) (3)
I82586 Yes Hidden Autodin II six bit hash (2) (4)
  
These NICs claim to have a filter, but simply Reply yes/no to "accept all multicast packets" or "accept no multicast packets.
Autodin ii is a standard Ethernet CRC checksum polynomial. In this way, the broadcast address is hashed and then searched in the hash table. If the corresponding bit is enabled, the data packet is received. The design of Ethernet data packets makes the hardware overhead very small for such processing-(generally) locking the CRC circuit (used for error checks) after the first six octal numbers (destination addresses) as the index of the hash table (6 bits -- a 64-bit table ).
These chips use a 6-bit hash, which must be calculated by the host and loaded into the hash table. This means that the kernel must contain the CRC code.
82586 the six-bit hash is used internally, but the hash table is calculated from the list of accepted broadcast addresses.
Note: These chips have poor filtering performance, and an intermediate layer module is required to complete the final filtering. At the same time, you must maintain a complete list of accepted broadcast addresses in each case and re-calculate the hash table when there is a change.
  
7 Berkeley package filter (BPF)
  
Developers generally believe that BPF functions should not be provided by the kernel, but should be placed in a (hopefully seldom used) compatible library.
  
For those who do not know, BPF (Berkeley package filter) is a mechanism that shows to the kernel network layer which packets are interested. It is implemented using a special instruction language interpreter established in the underlying network code. The application passes a program written in this language to the kernel, and then the kernel executes the program for each received packet. If the kernel has multiple BPF applications, run these programs for each packet.
  
The problem is that it is difficult to infer from the data packet filter program which data packets the application is actually interested in, so the general solution is to always run the filter. Assume that the BPF program registered by an application is to obtain the low-speed data stream sent to a broadcast address. The vast majority of Ethernet cards have a 64-entry hash table hardware-implemented broadcast address filter to ignore most unwanted broadcast packets, therefore, this operation may be completed at a very low cost. However, with BPF, the kernel must set the interface to the mixed mode to receive all data packets and run filters on them. In any case, this can indeed work, but considering the processing of the required data packets, it has become too troublesome.
  
  

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.