Understanding network adapter-network device design expert decrypts Network Transmission

Source: Internet
Author: User

Author profile: ase, via network R & D Engineer, vnt via networking technologies

AE/Fae. Participated in the design of 100 m/1394 M Nic, 1394 card, card, pcmcia usb and card, motherboard, with management switch, graphics card, etc.
A cold computer, the software gave her flesh and blood, and the network gave her soul!
1. What is a network card?
The NIC is now configured as one of the standard configurations on the current computer. How many secrets does a small Nic contain? Let's take a look.
The most common network device is the network card. The NIC itself is a LAN device. You can connect the LAN to the Internet through gateways, routers, and other devices. The Internet itself is composed of countless such LAN.
Nic has many types, according to the data link layer control to have ethernet card, card ring Nic, ATM Nic, etc.; according to the physical layer to classify wireless Nic, RJ-45 Nic, coaxial cable Nic, light network card and so on. Their Data Link Control, addressing, and frame structure are different. physical connection methods are different, data encoding, signal transmission media, and electrical equality are different. The following describes the most commonly used Ethernet NIC.
Ethernet adopts CSMA/CD (carrier-based multi-channel access/conflict detection) control technology. He mainly defines how the physical layer and data link layer work. The data link layer and the physical layer implement their own functions, so they do not care about how the other party operates. There are standard interfaces (such as MII and gmii) between the two to transmit data and control.
The physical layer of an Ethernet Card can contain many technologies, such as RJ45, light, and wireless. The difference between the physical and media that transmit signals is different. These are all defined in the IEEE 802 protocol family.
The RJ45 network card that we discussed this time belongs to the scope defined by 802.3.
Ii. Network Card Composition
1. Basic Nic Structure
An Ethernet NIC consists of two layers of the OSI (open-party system interconnection) model. Physical Layer and data link layer. The physical layer defines the electrical and optical signals, line statuses, clock baselines, data encoding, and circuits required for data transmission and receiving, and provides standard interfaces to data link layer devices. The data link layer provides addressing mechanisms, data frame construction, data error check, transfer control, and standard data interfaces to the network layer.
The data link layer chip in an Ethernet Card is generally called a Mac controller, while the physical layer chip is called a Phy. Many Nic chips enable Mac and PHY functions as one chip, such as Intel
82559 nic and 3Com
3c905 Nic. However, the Mac and PHY mechanisms still exist independently, but the appearance is in the form of a single chip. Of course there are also a lot of network card Mac and PHY is made separately, such as D-LINK DFE-530TX.
  

Figure 1: Separate Ethernet Card for Mac and PHY
  
Figure 2: Ethernet Card Integrated with Mac and PHY on a Chip
① RJ-45 interface ② Transformer (isolating transformer) ③ PHY Chip
④ Mac chip ⑤ EEPROM ⑥ bootrom slot
7. WOL connector ⑧ ⑨ voltage conversion chip
LEDs
2. What is Mac?
First, let's talk about the functions of the Mac chip of the Ethernet Card. The Ethernet data link layer actually contains the MAC (Media Access Control) Sub-layer and the LLC (Logical Link Control) Sub-layer. An Ethernet Card Mac chip not only implements MAC Sub-layer and LLC sub-layer functions, but also provides a compliant PCI interface for data exchange with the host.
After Mac receives an IP packet (or a packet from other network layer protocols) from the PCI bus, it splits the packet and repacks it into a frame with a maximum of 1518 bytes and a minimum of 64 bytes. This frame includes the target MAC address, the source MAC address, and the protocol type in the packet (for example, the IP packet type is expressed as 80 ). There is also a DWORD (4 byte) CRC code.
But where does the target MAC address come from? This involves an ARP Protocol (a protocol between the network layer and the data link layer ). When transmitting data from a destination IP address for the first time, an ARP packet is first sent, and the target MAC address of the packet is the broadcast address, which says, "Who is XXX. xxx. xxx. the host of the IP address XXX? "Because it is a broadcast package, all hosts on this LAN have received this ARP request. The host that receives the request compares the IP address with its own IP address. If the IP address is different, the host rejects the request. If the IP address is the same, the host sends an ARP response packet. The host with this IP address replies to the ARP response after receiving this ARP request packet and says, "I am the master of this IP address ". This package contains his MAC address. The target MAC address of the frame for this IP address will be determined later. (Other protocols, such as IPX and SPX, also have corresponding protocols to complete these operations .)
The relationship between the IP address and the MAC address is stored in the host system, which is called the ARP table, which is completed by the driver and the operating system. In Microsoft, you can run the ARP-a command to view the ARP table. The same is true when data frames are received. After CRC is completed, if there is no CRC verification error, the frame header will be removed and the data packets will be transmitted to the driver and the upper-layer protocol inn through a standard excuse, in the end, our application will be correctly implemented.
There are also some control frames. For example, the traffic control frame also needs to be recognized and executed by the Mac directly.
One end of the Ethernet MAC chip is connected to the computer PCI bus, and the other end is connected to the PHY chip. The Ethernet physical layer also includes the MII/gmii (Media independent interface) Sub-layer, PCs (physical encoding sub-layer), PMA (physical media attached) Sub-layer, and PMD (physical media related) child layer and MDI child layer. The PHY chip is one of the important functional devices for implementing the physical layer. It implements all the features of the front physical layer.
3. network transmission process
When sending data, phy receives data from MAC (for phy, there is no frame concept, and for it, it is data regardless of the address, data or CRC ), an Error Code of 1 bit is added for every 4 bits. Then, parallel data is converted into serial stream data, and the data is encoded according to the physical layer encoding rules (NRZ encoding of 10based-t or Manchester encoding of 100based-t, then the analog signal is used to send the data. (Note: it is hard to understand whether the data on the network cable is numeric or analog. I will talk about it later)
Otherwise.
Another important feature of PHY is to implement some CSMA/CD functions. It can detect whether data is being transmitted on the network. If data is being transmitted, it waits. Once it detects that the network is idle, it waits for a random time and sends the data out. If the two Enis send data at the same time, the conflict will occur. At this time, the conflict detection organization can detect the conflict and wait for a random time to resend the data.
This random time is very exquisite. It is not a constant. The random time calculated at different times is different, there are multiple algorithms to cope with the second conflict between the two hosts with low probability.
When internt broadband is connected, many netizens like to use a network card with a strong "leeching" because different methods for calculating random time after the PHY collision are designed differently, make some NICs "take advantage ". However, leeching is only for the broadcast domain network, and it does not make sense for the point-to-point connection method between the exchange network and ADSL to the local device. In addition, there will be no qualitative changes in the "leeching" field.
4. Network conflicts
Now, the popularity of switches has made exchange networks more popular, reducing the number of conflicting domain networks and greatly increasing the network bandwidth. However, if you use a hub or shared bandwidth to access the Internet, it is still in a conflicting domain network, with a conflict or collision. The biggest difference between a vswitch and a hub is that one is a LAN exchange device that builds a point-to-point network, and the other is a LAN interconnection device that builds a conflicting domain network.
Our PHY also provides important functions for connecting to the peer device and shows the current connection status and working status through the LED lights. When we connect the network card to the network card, phy continuously sends pulse signals to detect that there are devices on the peer end. They communicate through the standard "language, negotiate with each other and determine the connection speed, duplex mode, and whether to use flow control.
Generally, the negotiation result is the maximum speed and the best duplex mode supported by both devices. This technology is called auto
Negotiation or Nway, which means automatic negotiation.
5. Output part of phy
Now let's take a look at the following part of the output of Phy. When a CMOS chip is working, the signal level is always greater than 0 V (depending on the chip's process and design requirements ), however, if such a signal is sent to a location of 100 meters or longer, there will be a great loss of DC components. In addition, if the external network is directly connected to the chip, electromagnetic induction (Thunder) and static electricity can easily cause damage to the chip.
In addition, if the grounding method of the device is different, the power grid environment may cause the 0 V levels of both parties to be inconsistent. In this way, the signal is transmitted from A to B because the 0 V level of the device is different from the 0 V level of the B point, this will lead to a large amount of current flowing from devices with high potential to devices with low potential. How can we solve this problem?
The transformer (isolating transformer) device appears. It filters the differential signals sent by PHY with the difference mode coupled coil to enhance the signal, and is coupled to the other end of the connected network cable through the electromagnetic field conversion. In this way, not only does the network cable and the PHY have no physical connection, but the signal is transferred instead, the DC component in the signal is cut off, and data can be transmitted in devices of different 0 V levels.
The isolating transformer is designed to withstand 2kv ~ 3kv voltage. It also plays a role in Lightning Protection (I personally think it is inappropriate to use lightning protection. Some of my friends' network devices are easily burned out during thunderstorms. Most of them are caused by unreasonable PCB design, and most of them burn down the interfaces of the devices, with few chips burned out, isolation transformer plays a protective role.
6. About transmission media
The isolating transformer itself is a passive component. It only coupling the PHY signal to the network cable and does not play the role of power amplification. Who determines the maximum distance for a NIC signal transmission?
The maximum transmission distance of a network adapter and its compatibility with the peer device are determined by Phy. However, the output power of the PHY that can send signals more than 100 meters is also relatively large, making EMI more likely. At this time, a suitable transformer should be used with it. The former company, Marvell, is often able to send 180 ~ The distance of 200 meters far exceeds the IEEE Standard of 100 meters.
The connector of the RJ-45 realizes the connection between the nic and the network cable. It has eight copper clips that can be connected to four pairs of twisted-pair (8) wires in the network cable. In the M network, 1 and 2 send data, and 3 and 6 receive data. 1 and 2 are a pair of differential signals, that is to say, their waveforms are the same, but the phase difference is 180 degrees, and the voltage ranges at the same time are positive and negative. Such signals can be transmitted further and provide strong anti-interference capabilities. Similarly, 3 and 6 are also differential signals.
The eight cables in the network cable are twisted together to form a pair. When we create a network cable, we must make sure that 1 and 2 are in one pair, and 3 and 6 are in one. Otherwise, the connection may fail or be unstable when the network cable is used for long distances.
Now the new PHY supports auto
MDI-X functionality (also requiring transformer support ). It can realize the transfer signal line on 1 and 2 of RJ-45 interface and the function of receiving signal line on 3 and 6 automatically exchange with each other. Some PHY even supports automatic switching of positive and negative signals in a pair of lines. In this way, we don't have to worry about using a straight-through network cable or a crossover network cable to connect to a device. This technology has been widely used in vswitches and SoHo routers.
In the 1000basd-t network, the most common transmission mode is to use all four pairs of twisted pair wires in the network cable, with 4, 5, 7, and 8 added to send and receive data together. Because the 1000based-t network Specification includes auto
MDI-X functions, so they cannot strictly determine the relationship between outgoing or received, depending on the specific negotiation results of both parties.
7. Communication between PHY and Mac
Next, let's take a look at how data is transmitted and communicated between PHY and Mac. Standard MII/gigamii (media) defined by IEEE
Independed
Interfade, independent media interface. This interface is defined by IEEE. The MII interface controls all the data and data on the network.
Mac determines the operating status of the PHY and controls the PHY by using SMI (Serial Management
Interface. Some registers in the PHY are also defined by IEEE. In this way, the PHY reflects its current status to the Register, mac constantly reads the Status Register of the PHY through the SMI bus to get the current PHY status, such as connection speed and duplex capability. Of course, you can also set the register of the PHY through SMI to achieve the purpose of control. For example, if the throttling is enabled or disabled, the self-negotiation mode or the forced mode can be used.
We can see that both the MII interface of physical connection and the status registers and control registers of SMI bus and PHY have IEEE specifications. Therefore, Mac and PHY of different companies can coordinate their work. Of course, in order to match the features specific to PHY of different companies, the driver needs to be modified accordingly.
The implementation of the main functions of a NIC is basically the above.
In addition, there is an EEPROM chip, usually a 93c46 chip. It records the NIC chip supplier ID, subsystem supplier ID, Nic MAC address, Nic configurations, such as the PHY address on the SMI bus and bootrom capacity, whether to enable the bootrom boot system.
Many NICs also have bootrom. It is used to boot the operating system with a diskless workstation. Since there is no disk, some of the programs and protocol stacks necessary for boot are put in it, such as RPL and PXE. In fact, it is a standard PCI
Rom. Therefore, some hard disk write protection cards can be implemented by burning the bootrom of the NIC. In fact, the ROM of the PCI device can be placed in the BIOS of the motherboard. The ROM can be detected and correctly identified when the computer is started. The configuration of AGP is the same as that of PCI in many places. Therefore, the BIOS of many graphics cards can also be placed in the BIOS of the motherboard. This is why we have never seen bootrom for onboard NICs.
8. Nic Power Supply
The final part is the power supply. Most NICs now use 3.3v or a lower voltage. Some are dual-voltage. Therefore, the power conversion circuit is required.
In addition, to achieve the wake on
Line function, must ensure that a small part of all the PHY and Mac are always in the active state, which requires the 5 V
Standby voltage is a circuit used to convert the operating voltage of the phy. After the host is started on, the operating voltage of PHY should be replaced by the voltage transferred from 5 V to save 5 V
Standby consumption. (Many poor network cards do not do this ).
Wake on
The line Nic generally has a Wol interface. That is because pci2.1 previously did not have the PCI device to wake up the host, so a thread needs to be connected to the nanqiao through the wol interface on the motherboard to implement the wol function.
The new motherboard adapter generally supports pci2.2/2.3, and extends the PME # signal function. You can use the PCI bus to enable the wake-up function without that interface.
Conclusion
An Ethernet Card is composed of these parts. They work closely together and coordinate with each other to provide us with a stable and informed network access. The popularization of networks not only greatly increases work efficiency, but also enables us to freely ride in the ocean of the internet!
Note:
Is the analog signal or digital signal on the network cable?
The answer is analog signal. Because it uses analog technology for outgoing and receiving. Although the information it sends is digital, rather than digital, the signal can be called a digital signal.
A simple example: we know that the phone is a simulated signal, but when we dial the Internet, the telephone line transmits digital information, but the signal itself is still simulated. However, ADSL also transmits digital signals over telephone lines. This depends on the technology it uses for outgoing and acceptable use.

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.