Joke Collection Website - Public benefit messages - The principle and structure of network card

The principle and structure of network card

1. Understand the network card, one of the necessary components for us to access the Internet.

The network card works in the last two layers of osi, the physical layer and the data link layer. The physical layer defines the electrical and optical signals, line status, clock reference, data encoding and circuitry required for data transmission and reception. etc., and provides standard interfaces to data link layer devices. The physical layer chip is called PHY. The data link layer provides functions such as addressing mechanism, data frame construction, data error checking, transmission control, and standard data interfaces to the network layer. The chip in the data link layer of the Ethernet card is called the MAC controller. These two parts of many network cards are integrated together. The relationship between them is that the PCI bus is connected to the Mac bus, the Mac is connected to the PHY, and the PHY is connected to the network cable (of course it is not directly connected, there is also a transformer device).

Next, let us continue to care about how PHY and MAC transmit data and communicate with each other. The MAC and PHY are connected through the standard MII/GigaMII (Media Independent Interfade) interface defined by IEEE. This interface is defined by IEEE. The MII interface delivers all data and data control of the network.

The MAC determines the working status of the PHY and controls the PHY by reading and writing the PHY register using the SMI (Serial Management Interface) interface. Some registers in the PHY are also defined by IEEE, so that the PHY reflects its current status into the registers. The MAC continuously reads the status register of the PHY through the SMI bus to learn the current status of the PHY, such as connection speed and duplex. Ability etc. Of course, you can also set the PHY register through SMI to achieve control purposes, such as turning on and off flow control, auto-negotiation mode or forced mode, etc.

We have seen that whether it is the physically connected MII interface and SMI bus or the PHY status register and control register, there are IEEE specifications, so MACs and PHYs from different companies can work in harmony. Of course, in order to match the unique functions of PHYs from different companies, the driver needs to be modified accordingly.

The realization of the main functions of a network card is basically the above devices. In addition, there is an EEPROM chip, usually a 93C46. It records the supplier ID of the network card chip, the subsystem supplier ID, the MAC address of the network card, and some configurations of the network card, such as the address of the PHY on the SMI bus, the capacity of the BOOTROM, whether to enable the BOOTROM boot system, etc.

Many network cards also have BOOTROM. It is used for booting operating systems on diskless workstations. Since there is no disk, some programs and protocol stacks necessary for booting are placed inside, such as RPL, PXE, etc. In fact, it is a standard PCI ROM. That's why there are some hard disk write protection cards that can be implemented by burning the BootRom of the network card. In fact, the ROM of PCI devices can be placed in the motherboard BIOS. When you start the computer, you can still detect this ROM and correctly identify what device it is. AGP is the same as PCI in many aspects of configuration, so the BIOS of many graphics cards can also be placed in the motherboard BIOS. This is why we have never seen a BOOTROM for the onboard network card.

2. Working process

When the PHY sends data, it receives the data from the MAC (for the PHY, there is no concept of frames, for it, it is all data No matter what address, data or CRC), 1 bit of error detection code is added for every 4 bits, and then the parallel data is converted into serial stream data, and then according to the encoding rules of the physical layer (10Based-T NRZ encoding or 100based-T Manchester encoding) encodes the data, then converts it into an analog signal and sends the data out.

The process when receiving data is reversed. Now let’s understand the latter part of the PHY output. The signal level generated by a CMOS process chip when working is always greater than 0V (this depends on the chip's process and design requirements), but if such a signal is sent to a place 100 meters or even longer, there will be a large direct current. Loss of weight. And if the external network is directly connected to the chip, electromagnetic induction (thunder) and static electricity can easily cause damage to the chip.

Furthermore, different grounding methods of equipment and different power grid environments will lead to inconsistent 0V levels on both sides. In this way, when the signal is transmitted from A to B, since the 0V level of equipment A is different from the 0V level of point B, This causes a large amount of current to flow from a device with a higher potential to a device with a lower potential. How do we solve this problem?

At this time, the Transformer (isolation transformer) device appeared. It filters the differential signal sent out by the PHY with differential mode coupling coil coupling to enhance the signal, and couples it to the other end of the connecting network cable through electromagnetic field conversion. This not only allows the signal to be transmitted without a physical connection between the network cable and the PHY, but also blocks the DC component in the signal. It can also transmit data in devices with different 0V levels.

The isolation transformer itself is designed to withstand voltages of 2KV~3KV. It also plays the role of lightning protection (I personally think it is inappropriate to use lightning protection here). Some friends' network equipment is easily burned out during thunderstorms. Most of them are caused by unreasonable PCB design, and most of the interfaces of the equipment are burned out. Few chips are burned out because the isolation transformer plays a protective role.

When sending data, the network card first listens to see if there is a carrier on the medium (the carrier is indicated by the voltage). If there is, it thinks that other stations are transmitting information and continues to listen to the medium. Once the communication medium is quiet for a certain period of time (called the inter-frame gap IFG = 9.6 microseconds), that is, not occupied by other stations, frame data transmission begins while continuing to listen to the communication medium to detect conflicts. During the transmission of data, if a conflict is detected, the transmission is immediately stopped and a "blocking" signal is sent to the medium to inform other stations that a conflict has occurred, thus discarding the damaged frame data that may have been receiving and waiting. A random period of time (the algorithm used by CSMA/CD to determine the waiting time is a binary exponential backoff algorithm). Wait for a random amount of time before sending a new one. If a conflict still occurs after retransmitting multiple times (more than 16 times), the transmission will be abandoned.

When receiving, the network card browses each frame transmitted on the medium, and if its length is less than 64 bytes, it is considered a conflict fragment. If the received frame is not a collision fragment and the destination address is a local address, an integrity check is performed on the frame, if the frame length is greater than 1518 bytes (called a jumbo frame, which may be caused by a faulty LAN driver or interference) or If the CRC check fails, the frame is considered to be distorted. The principle and testing technology of the verified frame network card

The network card acts as a physical interface or connection between the computer and the network cable to convert digital signals in the computer into electrical or optical signals, called nic ( network interface card). Data is transmitted in a parallel manner on the computer bus, that is, data is transmitted side by side, while in the physical cables of the network, data is transmitted in a serial bit stream, and the network card is responsible for the conversion between serial data and parallel data. Before sending data, the network card must have a conversation with the receiving network card to determine the maximum size of data that can be sent, the amount of data sent, the interval between sending data twice, the time to wait for confirmation, and what each network card can withstand before overflowing. Maximum amount of data, speed of data transfer.

1. Basic structure of the network card

The network card includes hardware and firmware programs (software routines in read-only memory). The firmware program implements logical link control and media access control. The functional network card includes hardware and firmware programs (software routines in read-only memory). The firmware program implements the functions of logical link control and media access control. It also records the unique hardware address, which is the mac address. There is generally a cache on the network card.

The network card must be assigned interrupt irq and basic I/O port address, and must also set the base memory address and transceiver (transceiver)

The control chip of the network card

Yes The most important component of the network card is the control center of the network card, which is like the CPU of a computer. It controls the work of the entire network card and is responsible for data transmission and signal detection during connection. Early 10/100m dual-speed network cards used two control chips (units) to control operations in two different speed environments. However, current more advanced products usually only have one chip to control two speeds.

The crystal oscillator

is responsible for generating the operation clock of all chips of the network card. Its principle is the same as the crystal oscillator on the motherboard. Usually the network card uses a 20 or 25hz crystal oscillator.

Boot rom slot

If there are no special requirements, this slot in the network card will be vacant. It is generally used in conjunction with the boot rom chip. Its main function is to guide the computer to enter win9x through the server.

Boot rom

It is the boot chip that allows the computer to boot directly through the server without a hard disk, floppy drive and optical drive, becoming a workstation without a hard disk or floppy drive. Without a floppy drive, the data cannot be output, so the data confidentiality function can also be achieved. At the same time, you can also save the cost of purchasing these computer parts. When using boot rom, you should pay attention to which network operating system you use. Usually there are boot rom for nt, boot rom for unix, boot rom for netware, etc. You have to buy the boot rom startup chip by yourself.

eprom

In the past, old-fashioned network cards relied on setting jumpers or dip switches to set values ??such as irq, dma, and i/o port. However, today’s network cards all use Software settings, the presence of jumpers is almost invisible. Various network card status and network card information and other data are stored in this small eeprom, and can be automatically set through it.

Internal converter

Any network card with a bnc connector will have this chip, and it is located next to the bnc connector. Its function is to transfer data between the network card and the bnc connector. Conversion, allowing the network card to send or receive data from the bnc connector through it.

rj-45 and bnc connector

Rj-45 is a network card interface that uses twisted pair as the transmission medium, and is most commonly used in 100mbps networks. bnc uses thin coaxial cables as the transmission medium

Signal indicator lights

There will be two to three signal lights behind the network card, which are used to display the current network connections. Status usually has two pieces of information: tx and rx. tx means sending data, rx means receiving data. If you see two lights on at the same time, it means it is currently in full-duplex operation. You can also use this to identify whether the full-duplex network card is in a full-duplex network environment. middle (see the middle part of the two interfaces in the figure above). There are also some low-speed network cards that only use one light to represent the signal, and use different light changes to indicate whether the network is connected.

2. Classification of network cards

Distinguish network card types based on bandwidth

The current Ethernet cards are divided into three bandwidths: 10mbps, 100mbps and 1000mbps. The three common architectures are 10baset, 100basetx and base2. The first two use rj-45 twisted pair as the transmission medium, with bandwidths of 10mbps and 100mbps respectively. The twisted pair is divided into five specifications from category 1 to category 5, each with different uses and bandwidths. Category is usually referred to as cat. As long as the twisted pair of cat5 specification is used, it can be used on a network card with a bandwidth of 10/100mbps. The 10base2 architecture uses thin coaxial cables as the transmission medium, and the bandwidth is only 10mbps.

The bandwidth 10 or 100mbps mentioned here refers to the maximum transmission bandwidth on the network card, and the bandwidth is not equal to the actual transmission speed on the network. The actual speed should take into account the transmission distance, line quality, and whether the network is crowded. and other factors, the bps discussed here refers to the bits transmitted per second (1 byte = 8 bits). The 100mbps is called a high-speed Ethernet card (fast ethernet), mostly a PCI interface. Because of its high speed, most of the newly built local area networks have adopted the transmission bandwidth of 100mbps, and there is a trend of gradually replacing the 10mbps network card. Most of the PCI network cards currently on the market have the function of automatic switching between 10/100mbps and will automatically adjust the network speed according to the network connection environment. 1000 mbps Ethernet cards are mostly used for high-speed links or backbones between switches or switches and servers.

Divide the types of network cards based on the interface type

Based on the interface type, the most commonly used network cards are the isa interface, pci interface, usb interface and the pcmcia interface dedicated to laptops. The current isa interface network cards all use a 16-bit bus width. Its characteristic is that it uses programmed I/O mode to transmit data. When transmitting data, a small window must be opened on the I/O through the CPU as a link between the network card and the PC. Communication pipelines require high CPU usage and are less efficient when transmitting large amounts of data. The network card of the pci interface uses a 32-bit bus bandwidth and uses the bus master's data transmission method. The data transmission is controlled by the control chip on the network card. It does not need to go through the I/O port and the CPU, which can significantly reduce the CPU occupancy rate. At present, Most of the products are 10/100mbps dual-speed automatic detection and switching network cards.

Distinguish network card types by full-duplex/half-duplex

Network is divided into half duplex and full duplex. Half-duplex network cards It is impossible to complete the actions of receiving and transmitting data at the same time. For example, the network architecture of 10base2 using thin coaxial cable is a half-duplex network. It can only transmit or receive data at the same time, and the efficiency is low. To use a full-duplex network, you must use twisted pairs as transmission lines, and you must also use a full-duplex hub. You must use a 10base or 100basetx network architecture. The network card must of course be a full-duplex product

Distinguish network cards based on network physical cable connectors

At present, there are two types of network cable connectors commonly used in network cards: rj-45 and bnc. Some network cards have both connectors at the same time, which can be applied to both networks. line, but both connectors cannot be used at the same time. There are also network cards with optical fiber interfaces, usually with a bandwidth of 1000 mbps.

Other functions wol

Some network cards have the function of wol, the function of wol network startup (wake on lan). It can be sent from another computer using software to create special format information packets to a computer equipped with a WOL-enabled network card. After receiving these special format information packets, the network card will command the computer to turn on the power. Currently, it has There are more and more network cards that support the network boot function.

Other network cards

There are also wireless network cards on the physical media transmitted from the network, which use 2.4ghz radio waves to transmit data. Currently, IEEE has two specifications: 802.11 and 802.11b. The maximum transmission rates are 2m and 11m respectively. The interfaces include PCI, USB and PCMcia.

3. Network card testing technology

Operating system-based testing

An important performance of a network card is whether it supports multiple network operating systems. The more popular Network operating systems include windowsnt, unix (linux, freebsd, sco, solaris, hp?}), novell, dec, etc.

At the same time, the network card should be able to support a variety of network protocols, such as tcp/ip, ipx/spx, apple, netbeui, etc.

Host-based compatibility testing

Hardware compatibility is also a very important aspect, especially on laptops. According to my actual experience, even Some famous brand network cards also have serious compatibility issues on some laptops. These problems don't happen often with servers or desktop computers.

Network card transmission rate test (data throughput)

Testing the transmission rate of a network card generally has two methods: hardware and software. The hardware uses some special instruments such as network analyzers and smartbits. Some other devices, such as smartcards, use icmp echo requests and udp packets to detect data traffic. The usual test items include the following aspects:

autonegotiation test

Test the network card speed, full duplex/half duplex and flow control negotiation. Negotiation determines whether to allow flow control through "pause frame".

arp test

Test whether the network card can respond correctly to the arp request and whether it responds within the specified time. This time is set by the tester.

error test

Tests the ability of the network card to handle error frames. This test is usually performed at a lower transmission rate (0.5 transmission rate). There are several tests in the following aspects:

The network card receives the correct frame and processes it.

The network card receives a frame with a CRC check error and discards it.

The network card receives a frame with the wrong transmission sequence and discards it.

The network card receives a frame containing a small number of error bits, and the network card should receive and process all of them.

The network card received an ultra-small frame and the network card should discard it.

The network card received an extremely long frame and the network card should discard it.

packets loss test

rfc specifies the test of the network card's ability to process frames under various transmission bandwidth utilizations, from initial data transmission to continuous changes in transmission rate until the end of transmission. Check the frame loss.

throughput test

The data throughput test is also a test content specified by rfc. The test results reflect the utilization of the maximum bandwidth of the transmission, the frames processed per second and the number of frames processed per second. The number of bits processed per second.

back-to-back test

This test is also specified by rfc-2544 and tests the number of concurrent frames that the network card can handle at a set maximum transmission rate. . It ultimately reflects the maximum number of frames that can be transmitted concurrently without losing data packets.

Software testing usually uses zd’s netbench for testing, and generally only uses it to test the maximum transmission rate of the network card. During the test, a network structure must be formed, a windowsnt server, and several windows9x or windowsnt station clients to transmit large-capacity files such as 100mbps. The test results will reflect the maximum transmission rate of the network card. Another test project is to test the network card's ability to respond to smaller packet requests. Here it is necessary to discuss the mechanism of the ping command of tcp/ip. Ping uses sending and receiving icmp echo messages to detect link status and protocol settings. The data link layer encapsulates frames, with sizes ranging from 64k to 1518k. When sending a frame, the network card must first read the mac address of the frame header and frame tail when receiving the frame. When the mac addresses match, the encapsulated read is then Get the ip address.

When the network card receives frames continuously, it must process each frame. When the network card or the system cannot process these data packets, these data packets will be discarded. This situation often occurs when very small frames are sent continuously. The mechanism of ping is to send an icmp message, and then send the next icmp message after receiving an icmp echo. Therefore, smaller continuous frames will put greater pressure on the network card and the system. In netbench, there is a test that tests the ability of the network card or system to process continuous small data packets.

Stability test

A good network card should have good stability. Specifically, it should have stable performance in different working environments and different working conditions. Usually the tests are mainly high temperature and large file transfer tests.

High temperature testing generally involves running the test program of the network card continuously at 30~35 degrees Celsius for a certain period of time, such as more than 2 hours, to test the stability of the network card under high temperature. There are generally two types of network cards for the pcmcia interface: 32-bit and 16-bit. The former is also called a cardbus network card. The data bandwidth increases from 16 bits to 32 bits, making the heat generated by the pcmcia network card a significant problem.

Another test is to transfer large files. Some poor-quality network cards are prone to errors when transferring large-capacity files, such as files above 2gbps.

To sum up, when testing a network card, comprehensive software, hardware and compatibility testing must be carried out. Test items can be selected organically according to specific applications and different requirements to correctly reflect the performance of the network card. index.

It is considered valid, and the network card receives it for local processing.