A network adapter is a piece of computer hardware designed to allow a computer to communicate over a computer network. Because it has a MAC address, it falls between layers 1 and 2 of the OSI model. It allows users to connect to each other via cable or wirelessly.
What is a Network Adapter? Network Adapter Features You Must Know
Every network adapter has a unique 48-bit serial number called a MAC address, which is written in a piece of ROM on the card. Every computer on the network must have a unique MAC address.
No two network adapters are manufactured with the same address. This is because the Institute of Electrical and Electronics Engineers (IEEE) is responsible for assigning unique MAC addresses to network interface controller (network adapter) vendors.
1. Introduction to network adapters
A network adapter houses a processor and memory (including RAM and ROM). Communication between the network adapter and the LAN is done serially over a cable or twisted pair. The communication between the network adapter and the computer is carried out in parallel transmission through the I/O bus on the computer motherboard. Therefore, an important function of a network adapter is to perform serial/parallel conversion. Because the data rate on the network is not the same as the data rate on the computer bus, a memory chip that caches the data must be installed in the network adapter.
Network adapters used to plug into the computer bus as expansion cards, but because of their low cost and the ubiquity of the Ethernet standard, most new computers have network interfaces integrated on the motherboard. These motherboards either have Ethernet integrated into the motherboard chip, or use an inexpensive network adapter connected to the motherboard via PCI (or the newer PCI-Express bus). A separate network adapter is no longer required unless multiple interfaces are required or other kinds of networking are used. Even newer motherboards may contain built-in dual network (Ethernet) ports.
The device driver that manages the network adapter must be installed in the computer's operating system when the network adapter is installed. This driver will tell the network adapter in the future, where in the memory should the data blocks transmitted by the LAN be stored. The network adapter must also be able to implement the Ethernet protocol.
A network adapter is not a self-contained, autonomous unit because it does not carry its own power source but must draw power from, and be controlled by, the computer it is plugged into. The network adapter can thus be viewed as a semi-autonomous unit. When a network adapter receives an errored frame, it discards the frame. When the network adapter receives a correct frame, it notifies the computer using an interrupt and delivers it to the network layer in the protocol stack. When the computer wants to send an IP data packet, it is handed down from the protocol stack to the network adapter to be assembled into a frame and sent to the LAN.
With the continuous improvement of integration, the number of chips on the network adapter is continuously reduced. Although there are various types of network adapters produced by various manufacturers, their functions are similar.
2. The main function of the network adapter
2.1 Encapsulation and decapsulation of data
When sending, add the header and tail to the data delivered by the upper layer to become an Ethernet frame. When receiving, strip the header and tail of the Ethernet frame, and then send it to the upper layer.
2.2 Link Management
It is mainly realized through the CSMA/CD (Carrier Sense Multiple Access with Collision Detection, Carrier Sense Multiple Access with Collision Detection) protocol.
2.3 Data Encoding and Decoding
That is, Manchester encoding and decoding. Among them, Manchester code, also known as digital two-way code and phase encoding (PE), is one of the commonly used binary code line encoding methods, which is used by the physical layer to encode the clock and data of a synchronous bit stream. In communication technology, it is used to represent the combination of data and timing signals in the bit stream to be transmitted. Commonly used in Ethernet communication, train bus control, industrial bus and other fields.
3. Property settings of the network adapter
Network performance can be improved with advanced network adapter options:
3.1 Efficient CPU utilization: jumbo frames vs. offload functions
If server performance is slow, it may be due to heavy network load. The standard Ethernet packet size is 1518 bytes, and most files are split into hundreds, thousands, or even millions of packets or frames. These small data packets are transmitted through the network and share the network bandwidth with many nodes, but the sending and receiving of data frames will bring CPU overhead.
Most network adapters support jumbo frames, meaning they can handle packets or frames up to 9000 bytes. Jumbo frames include more data in each packet, so fewer packets need to be transmitted on the network. Increased throughput means less overhead—packet headers and other packet content—as well as less CPU overhead.
There are definitely downsides to jumbo frames. Administrators must configure all nodes in the network to support the transmission of jumbo frames. Jumbo frames are not part of the IEEE standard, so different network adapter configurations have different jumbo frame sizes. To efficiently transfer jumbo frames between nodes do some experimentation. Larger packets can increase latency for some workloads because other nodes wait longer to use bandwidth, and it takes longer to request and send dropped or corrupted packets.
IT professionals may forego jumbo frames and use network adapters with LSO and LRO capabilities. LSO and LRO allow the CPU to transmit a higher amount of data through the network adapter, and basically provide the same CPU performance as jumbo frames.
3.2 Throughput: adjustable frame spacing vs. Ethernet upgrade
Ethernet waits for a period of time after each packet is sent, which is called the interframe interval. This provides an opportunity for other network nodes to hog bandwidth and send packets. The frame spacing is equal to the time to send 96 data bits. For example, 1Gb Ethernet uses a standard frame spacing of 0.096ms, and 10Gb Ethernet uses a frame spacing of 0.0096ms.
Utilizing this fixed spacing between packet transmissions is not always effective and may degrade network performance under heavy network load. Network adapters that support adaptive interframe spacing can dynamically adjust interframe spacing based on network load, potentially improving network performance. Adjusting the frame spacing usually does not improve network performance unless it is close to the network bandwidth.
Comprehensive network performance benchmarks reveal network usage patterns. If your Ethernet connection hits its bandwidth cap frequently, upgrading to a faster Ethernet speed or using network adapter bonding instead of interframe adjustments can improve network performance.
3.3 Limit CPU interrupts and improve CPU performance
Network adapters generate CPU interrupts as packets travel across the network. The faster the Ethernet speed, the more frequently the CPU interrupts, and the more the CPU must pay attention to the network drivers and other software processing packets. If traffic fluctuates, CPU performance may become choppy. A network adapter that supports artificial interrupt throttling can reduce the CPU interrupt frequency, freeing the CPU from the network adapter, and is likely to improve CPU performance.
More interrupt limits are not necessarily better. An interrupt limit that is too high may reduce the responsiveness of the CPU; the CPU will take longer to process all interrupts that are being generated. Limiting interrupts will degrade performance when small packets of high-speed data arrive in near real time. Test network and CPU performance in various modes until sufficient system responsiveness can be established, generating smooth CPU interrupts.
Also consider network adapters that support TCP/IP offload. These network adapters are able to handle many CPU-intensive workloads online while reducing interrupt requests to the CPU.
3.4 Prioritizing Time-Sensitive Data Types: Enabling Packet Marking
Event-sensitive data types such as VoIP or video are usually treated as high-priority traffic, but the network treats all packets equally. With packet marking, the marked data packets can be assigned to the traffic queue set by the operating system, and the high-priority VoIP and video data packets are processed before other low-priority data packets are processed. Packet marking helps with QoS strategies and is an integral part of many VLAN deployments.
If the network performance is below the defined baseline, the network adapter can be tuned, be sure to benchmark the server and the network adapter before making any configuration changes. These recommended network adapter tweaks do not provide significant performance gains, but are not limited by budget. Evaluate and observe network performance over time, checking for any unintended consequences, such as improving performance of one workload while degrading performance of others.
4. The network adapter driver for the network adapter
Due to the existence of the driver function layer, the protocol driver and the network adapter driver are independent of each other, which greatly simplifies the complexity of adding network devices and expanding network components. The network protocol stack mainly supports enhanced network device drivers (Enhanced Network Driver).
4.1 Loading of END device driver
The loading of the END device driver is mainly to complete the connection between the END device driver and the driver function abstraction layer, so that the network protocol stack can realize the control of the END device. The specific process includes: Initializing the network adapter and PHY device, configuring the communication parameters of the network adapter and PHY device, etc.; allocating space for the network adapter control structure and initializing the END_OBJ structure. The END_OBJ structure mainly includes the network adapter control structure and parameters related to the network protocol stack Information; analyze and process the parameter string corresponding to the network adapter driver; allocate space for the received data to ensure the storage of the received data; realize the connection between the network adapter driver and the network protocol stack by configuring the NET_FUNCS parameter in the END_OBJ structure.
4.2 Start END device
The startup process of the END device mainly includes hooking up the interrupt handler and enabling the network adapter interrupt. For the network adapter device, its data processing method can be divided into two working modes: interrupt and polling. During the startup process of the END device, both the receiving data and the sending data are set to the interrupt mode, and the receiving and sending data are hooked up. The interrupt handler, and finally enable the network adapter interrupt, receive and send interrupt, then the startup of the END device can be completed.
4.3 Reception of network data packets
For the reception of network data packets, the network protocol stack of the operating system does not need a network adapter driver to realize the processing of network data packets. When the network adapter device receives the data, it will generate a receiving interrupt. In the receiving interrupt processing program, the program will call the netJobAdd function to start a task program to transfer the data received by the network adapter device to the driver function abstraction layer, network protocol stack The network data packet is obtained through the receiving function of the driving function abstraction layer and corresponding data processing is performed. Using the netJobAdd function here can reduce the processing time of receiving interrupts and improve the ability to receive network data.
4.4 Sending of network data packets
For the sending of network data packets, when the network protocol stack sends data, it will place the data in the buffer, and send the data in the buffer to the network adapter device by calling the sending function of the driver function abstraction layer. After the adapter device receives the data, it puts it in the sending buffer and waits for the data to be sent.
5. Classification of network adapters
According to different physical layer standards and host interfaces supported by network adapters, network adapters can be divided into different types, such as Ethernet network adapters and token ring network adapters. According to the connection method between the network adapter and the bus on the motherboard, the transmission rate of the network adapter, and the interface connected between the network adapter and the transmission medium, the network adapter is divided into different types.
5.1 According to the types of computers supported by network adapters, it is mainly divided into standard Ethernet network adapters and PCMCIA network adapters:
Standard Ethernet network adapters are used for desktop computer networking, while PCMCIA network adapters are used for notebook computers.
5.2 According to the classification of the transmission rate supported by the network adapter, it is mainly divided into four categories: 10Mbps network adapter, 100Mbps network adapter, 10/100Mbps adaptive network adapter and 1000Mbps network adapter:
According to the transmission rate requirements, 10Mbps and 100Mbps network adapters only support 10Mbps and 100Mbps transmission rates. When using unshielded twisted pair UTP as the transmission medium, usually 10Mbps network adapters are used with Type 3 UTP, while 100Mbps network adapters are used with 5 UTP-like connection. The 10/100Mbps adaptive network adapter is a network adapter that automatically detects the transmission rate of the network to ensure the compatibility of two different transmission rates in the network. With the continuous improvement of LAN transmission rate, 1000Mbps network adapters are mostly used in high-speed servers.
5.3 According to the type of bus supported by the network adapter, it can be mainly divided into ISA, EISA, PCI, etc.:
Due to the rapid development of computer technology, the use of network adapters with ISA bus interfaces is becoming less and less. The network adapter of the EISA bus interface can transmit 32-bit data in parallel, and the data transmission speed is fast, but the price is relatively expensive. The CPU occupancy rate of the PCI bus interface network adapter is low, and the theoretical transmission rate of the commonly used 32-bit PCI network adapter is 133 Mbps, so the supported data transmission rate can reach 100 Mbps.