The difference between Mac and PHY

Source: Internet
Author: User

1. Basic structure of NIC

Ethernet card in the data link layer of the chip is generally referred to as a Mac controller, the physical layer of the chip we simply call PHY. Many network cards chip the MAC and PHY functions into a chip, such as the Intel 82559 network card and 3COM 3c905 network card. But the mechanisms of MAC and PHY exist separately, but the appearance is a single chip. Of course, there are a lot of network cards Mac and PHY are done separately, such as D-Link dfe-530tx and so on.

Figure one: Mac and PHY separate Ethernet card (click to enlarge)

Figure two: Mac and PHY integrated on one chip Ethernet card (click to enlarge)

①rj-45 interface ②transformer (isolating transformer) ③phy chip

④MAC Chip ⑤eeprom⑥bootrom Socket
⑦wol connector ⑧ crystal oscillator ⑨ voltage conversion chip
⑩led indicator

2 . What is a MAC?

First of all, let's talk about the function of the Ethernet card's Mac chip. The Ethernet Data Link layer actually contains the MAC (media access control) Sublayer and the LLC (Logical Link Control) sub-layer. The function of the MAC chip of the Ethernet card not only realizes the function of the Mac Sublayer and the LLC Sublayer, but also provides the standard PCI interface to realize the data exchange with the host.

After the MAC receives the IP packet (or packets from other network layer protocols) from the PCI bus, it splits and repackaged it into a maximum of 1518Byte and a minimum of 64Byte frames. This frame includes the destination MAC address, its own source MAC address, and the protocol type within the packet (for example, the type of IP packet is represented by 80). Finally there is a DWORD (4Byte) 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). The first time the data of a destination IP address is transmitted, an ARP packet is issued, and its Mac target address is the broadcast address, which says: "Who is the owner of this IP address xxx.xxx.xxx.xxx?" "Because it is a broadcast packet, all hosts on this LAN have received this ARP request. The host receiving the request compares this IP address to its own and, if it is not the same, issues an ARP response packet if it is the same. The host of this IP address received the ARP Request packet reply after the ARP response said: "I am the owner of this IP address." This package includes his MAC address. The destination MAC address of the frame that is given to this IP address is determined. (Other protocols such as Ipx/spx also have a corresponding protocol to complete these operations.) )

The association between the IP address and the MAC address is stored in the host system, called the ARP table, and is completed by the driver and the operating system. In Microsoft's system, you can view the ARP table with ARP-A commands. When you receive the data frame is the same, after the CRC, if there is no CRC validation error, the frame head is removed, the packet out through the standard pretext passed to the driver and the upper level of the Protocol Inn, and finally the right to reach our application.

There are also control frames, such as flow-control frames, that require the Mac to recognize and perform the corresponding behavior 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 physical layer of Ethernet also includes MII/GMII (media Independent interface) sub-layer, PCS (physical coding sub-layer), PMA (physical media attached) sub-layer, PMD (physical medium dependent) child layer, MDI child layer. The PHY chip is one of the important functional devices to realize the physical layer, which realizes the function of all the sub-layers of the front physical layer.

3 . The process of network transmission

PHY when sending data, received MAC data (for PHY, no frame concept, for it, is the data regardless of address, data or CRC), every 4bit to increase the number of 1bit error detection code, and then the parallel data into the serial stream data, The data is encoded by the physical layer coding rules (10based-t NRZ encoding or 100based-t Manchester code) and then the data is sent out by the analog signal. (Note: It is not easy to understand whether the data on the cable is digital or analog.) In the end I say)

The process in which data is collected is reverse.

One important function of PHY is to implement some of the functions of CSMA/CD. It can detect whether there is data on the network in the transmission, if there is data in the transmission of the wait, once the network is detected idle, and then wait for a random time to send data out. If two network cards happen to send the data at the same time, that will cause conflict, when the conflict detection mechanism can detect the conflict, and then wait for a random time to resend the data.

This random time is very fastidious, not a constant, the random time calculated at different times are different, and there are multiple algorithms to cope with the probability of a very low occurrence of the second collision between the two hosts.

Many netizens in the access internt broadband, like the use of "grab line" strong network card, is because different PHY collision after the calculation of random time method design, making some network cards compare "take advantage". However, the line is only for the broadcast domain of the network, for the Exchange network and ADSL so point-to-point connection to the local device access mode is meaningless. and "Rob Line" is only relative, there will be no qualitative changes.

4 . About the conflicts between networks


Nowadays, the popularization of the switch makes the network of the network much less, which greatly improves the bandwidth of the network. However, if the hub, or shared bandwidth access to the Internet is still a conflict domain network, conflict collision. The biggest difference between the switch and hub is that one is a LAN switching device that constructs a point-to-dot network, and one is a LAN interconnect device that constructs a conflict domain network.

Our PHY also provides important functions for connecting to end devices and shows the status and working status of their current connections through LED lights to let us know. When we give the network card access to the network cable, PHY constantly send pulse signal detected to the end of the device, they through the standard "language" communication, mutual negotiation and the connection speed, duplex mode, whether the use of flow control.

Typically, the result of negotiation is the maximum speed and the best duplex mode that can be supported in both devices. This technique is called auto negotiation or nway, and they are a meaning – auto-negotiation.

5.PHY the output part


Now let's look at the back part of the PHY output. When a CMOS process chip is working, the signal level is always greater than 0V (depending on the chip's process and design requirements), but such signals can be sent to a distance of 100 meters or more to a large amount of DC loss. And if the external network is directly connected with the chip, electromagnetic induction (thunder) and static electricity, it is easy to cause chip damage.

Then the device grounding method is different, the power grid environment will cause the two sides of the 0V level inconsistency, so that the signal from A to B, because a device 0V and B point 0V level is not the same, this will lead to a large current from high potential equipment to low potential equipment. How do we solve this problem?

A transformer (isolating transformer) is present. It takes the PHY out of the differential signal with a differential-mode coupled coil-coupled filter to enhance the signal and is coupled to the other end of the connection cable by the conversion of the electromagnetic field. This not only makes the network cable and PHY no physical connection between the transmission signal, the signal is cut off the DC components, but also in different 0V levels of the device to transmit data.

The isolation transformer itself is designed to withstand the 2kv~3kv voltage. Also played a lightning-proof (I personally think this is not appropriate to use lightning protection) role. Some friends of the network equipment in the thunderstorm weather is easy to burn, most of the PCB design is unreasonable, and most of the equipment burned down the interface, very few chips were burned, is the isolation transformer played a protective role.

6. about Transfer Media

The isolation transformer itself is a passive element, but the PHY signal is coupled to the network cable, and does not play a role in power amplification. So who decides the longest distance of the transmission of a network card signal?

The maximum transmission distance of a net card and the compatibility with the connection of the peer device are primarily PHY-determined. However, the signal can be sent more than 100 meters of PHY its output power is also relatively large, more prone to EMI problems. This is when the right transformer is needed to cooperate with it. The PHY of the eldest company of PHY, Marvell, can often teleport 180~200 meters far beyond the IEEE's 100-metre standard.

The RJ-45 connector realizes the connection between the network card and the network cable. It has 8 pieces of copper which can be connected with 4 pairs of twisted pair (8) wires in the network cable. 100M of the network in which 1, 2 is the transmission of data, 3, 6 is to receive data. 1, 2 is a pair of differential signals, that is, their waveform, but the phase difference of 180 degrees, the same time voltage amplitude of each other positive and negative. Such signals can be transmitted farther, strong anti-jamming ability. Similarly, 3, 6 is also the same as the differential signal.

8 lines in the network cable, every two twisted together to become a pair. When we make the network cable, we must pay attention to let 1, 2 in one of the pair, 3, 6 in a pair. Otherwise, the use of this cable in the long-distance situation will cause the connection is not connected or unstable.

The new PHY now supports the Auto Mdi-x feature (also requires transformer support). It can realize the function of transmitting signal line on 1, 2 of the RJ-45 interface and receiving signal line on 3 and 6 to exchange automatically with each other. Some PHY even supports automatic switching of the function of positive and negative signals in a pair of lines. So we don't have to worry about connecting a device with a straight-through cable or a crossover cable. This technology has been widely used in switches and SOHO routers.

In the 1000BASD-T network, one of the most common modes of transmission is the use of all 4 pairs of twisted-pair cables, which add 4, 5 and 7, 8来 co-transmit received data. Since the specification of the 1000BASED-T network contains the auto Mdi-x function, it is not possible to strictly determine their outgoing or received relationships, depending on the specific negotiation results of both parties.

7 . How to communicate between PHY and MAC


Let's take a look at how PHY and Mac transfer data and communicate with each other. Connect Mac and PHY via the standard mii/gigamii (media independed interfade, Media-independent interface) interface defined by IEEE. This interface is defined by IEEE. The Mii interface transmits the control of all data and data in the network.

The Mac's determination of the working state of the PHY and the control of the PHY are done using the SMI (Serial Management Interface) interface by reading and writing the PHY registers. Some registers in the PHY are also defined by the IEEE, so that PHY reflects its current state into the register, and the Mac continuously reads the state register of the PHY via the SMI bus to know the current PHY state, such as the connection speed, the ability to duplex, etc. Of course, you can also set the PHY register through the SMI to achieve control purposes, such as the open shutdown of the flow control, self-negotiation mode or mandatory mode.

We have seen that both the physical connection of the Mii interface and the SMI bus or PHY state registers and control registers are regulated by the IEEE, so the Mac and PHY of different companies can work in a coordinated way. Of course, in order to match the different company's PHY's own certain function, the driver needs to make the corresponding modification.

The main function of a network card is basically the implementation of the above devices.

Other, there is an EEPROM chip, usually a 93c46. It records the NIC chip vendor ID, subsystem vendor ID, the MAC address of the network card, some configuration of the NIC, such as the address of the PHY on the SMI bus, the capacity of the bootrom, whether the Bootrom boot system is enabled, and so on.

Many network cards also have bootrom this thing. It is used to boot the operating system for diskless workstations. Since there is no disk, some of the necessary programs and protocol stacks are put inside, such as RPL, PXE, etc. In fact, it is a standard PCI ROM. So there will be some hard disk write protection card can be bootrom by burning the network card to achieve. In fact, the PCI device ROM can be placed inside the motherboard BIOS. When you start your computer, you can detect this ROM and correctly identify what device it is. AGP is configured in many places like PCI, so many video card bios can also be placed in the motherboard BIOS. That's why we never saw the bootrom on the onboard NIC.

8 . Power to the network card

The last part is the power supply. Most network cards now use voltages of 3.3V or less. There are double voltages. Therefore, a power conversion circuit is required.

Moreover, in order to implement the wake on line function, the NIC must ensure that a very small portion of all PHY and Mac is always in a state of power, which requires the conversion of the 5V standby voltage on the motherboard to the circuit of the PHY operating voltage. After the host is powered on, the operating voltage of the PHY should be replaced by a voltage from 5V to save 5V of standby consumption. (many inferior NICs do not).

There is a wake on the line function of the NIC generally also has a WOL interface. That is because PCI2.1 previously did not have the function of the PCI device to wake the host, so a cable is required to connect to the South Bridge via the Wol interface on the motherboard to realize the WOL function.

The new motherboard-to-board adapter generally supports pci2.2/2.3, expands the pme# signal function, does not need that interface and through the PCI bus can realize the wake-up function.

Conclusion
A piece of Ethernet card is part of these components. They work closely together and coordinate with each other, providing us with a stable and informed network access. The popularization of the network not only greatly increases the efficiency, but also allows us to roam freely in the ocean of the internet!

Notes :
is the analog or digital signal on the cable?

The answer is an analog signal. Because it is outgoing and received is the analog technique used. Although the information it transmits is digital, it is not the transmitted information that is digital, and the signal can be called a digital signal.

Simple example: We know that the phone is an analog signal, but when we dial the Internet, the telephone line transmits digital information, but the signal itself is still analog. However, ADSL is also transmitted by telephone line, but it is a digital signal. It depends on the technology that it spreads and accepts.

The difference between Mac and PHY

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.