Network card Working principle detailed

Source: Internet
Author: User

This article has collated and supplemented the existing information on the Internet, extracted the useful parts, and carried on the archival study.

first, recognize the network cardNIC (Network Interface card, referred to as NIC), also known as LAN adapter, is a computer connected to the local area network device. Whether it's a normal computer oris a high-end server, as long as the connection to the LAN, you need to install a network card. If necessary, a single computer can also install two or more network cards at the same time. A NIC includes two layers of the OSI model,Physical layer and Data link layer:1 The physical layer defines the electrical and optical signals, line status, clock Reference, data encoding, and circuitry required for data transmission and reception ,and provides a standard interface to data-link-layer devices. 2 "Data link layer provides addressing mechanism, data frame construction, data error checking, Transmission control, to the network layerprovide the standard data interface and other functions. Second: The network card Group to function        There are two main functions of network card:The first is to encapsulate the data of the computer into frames, and send the data to the network through the cable (the electromagnetic wave to the wireless network).The second is to receive the frames transmitted by other devices on the network, and the frames are re-assembled into data and sent to the computer where they are located. The network card can receive all thesignal, but normally only the frames and broadcast frames sent to the computer are accepted, and the remaining frames are discarded. Then, it is transferred to the system CPU for further processing. When the electricwhen the brain sends data, the NIC waits for the right time to insert the packet into the data stream. The receiving system notifies the computer that the message is fully reachable, and if there is a problem,the other person will be asked to resend. Three: The composition and working principle of network cardtake the most common PCI interface NIC as an example: The composition of the network card: (1) Main chip:the main control chip of the network card is the core component of the network card, the performance of a network card and the strength of the function, mainly to see the quality of the chip. As shown in the following: (2) bootrom slot:bootrom socket is often said to be diskless boot ROM interface, which is used to build a diskless workstation via remote boot service. As shown in the following: (3) Data pump: The role of one is the transmission of data, the second is to isolate the different network cable connection between different levels of equipment, but also to the equipment to play a certain role in lightning protection. As shown in the following:(4) Crystal oscillator, which provides the reference frequency as shown in:(5) LED indicator: Used to identify the different working states of the network card, for example, link/act indicates the connection activity status, full indicates whether it is fully duplex, and power is the power supply indication. (6) Cable interface: There is a BNC interface and RJ-45 interface, the main use of 8-wire RJ-45 interface. (7) Bus interface: used for network card and computer connection, built-in network card needs to be commonly known as "golden Finger" bus interface inserted in the expansion slot of the computer motherboard. The main Isa,pci,pcmcia and USB and other common is the PCI Bus interface network card. four: How the NIC works
    • A network card acts as a physical interface or connection between a computer and a network cable, and is responsible for converting digital signals from the computer into electrical or optical signals.
    • The network card is responsible for the conversion between serial data or parallel data, and the data is transmitted in parallel in the computer bus, while the serial bit stream is transmitted in the physical cable of the network.
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 simplyto PHY. Many network cards chip the MAC and PHY functions into a chip, such as the Intel 82559 network cardand a 3COM 3c905 NIC. But the mechanisms of Mac and PHY exist alone, just the appearance of the formis a single chip. Of course, there are a lot of Nic Mac and PHY are made separately, such as D-Link dfe-530txand so on. 1 Data Link Layer Mac controllerFirst of all, let's talk about the function of the Ethernet card's MAC chip. The Ethernet Data Link layer actually contains the Mac (interfacequality access Control) Sublayer and the LLC (Logical Link Control) child layer. A piece of Ethernet card the role of the MAC chip is not only realnow the functions of the Mac Sublayer and the LLC sublayer, as well as providing a compliant PCI interface for data exchange with the host. after a MAC receives an IP packet (or packets from another network layer protocol) from the PCI bus, it splits andthe newly packaged frame with a maximum of 1518Byte and a minimum of 64Byte. This frame includes the target MAC address, its own sourcethe type of protocol in the MAC address and packet (for example, the type of IP packet is represented by 80). Finally, there's athe CRC code for the DWORD (4Byte). But where does the target MAC address come from? This involves an ARP protocol (between the network layer and the dataa protocol for the link layer). The first time the data of a destination IP address is transmitted, an ARP packet is emitted first .The target address of its MAC 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 receive this ARP request. The host receiving the request will have this IPThe address is compared to its own, and if it is not the same, the ARP response packet is issued if the same. This IP addressthe host receives this ARP request packet and replies to the ARP response saying: "I am the owner of this IP address." ThisHis MAC address is included in the package. 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, by the driverand the operating system is complete. In Microsoft's system, you can view the ARP table with ARP-A commands. Received Data framethe same time, after the CRC is done, if there is no CRC validation error, the frame head is removed, the packet is taken outto pass the standard excuses to the driver and the upper level of the Protocol Inn, the final 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. Ethernet MacOne end of the chip is connected to the computer PCI bus, and the other end is connected to the PHY chip. The physical layer of Ethernet also includesmii/gmii (Media Independent interface) sub-layer, PCS (physically encoded sub-layer), PMA (physical media attached) sub-layer, PMD(physical medium dependent) child layer, MDI child layer. And the PHY chip is one of the important functional devices to realize the physical layer.The functionality of all the child layers of the front physical layer. 2 physical Layer PHYPHY receives data from a MAC when it sends data (no frame concept for PHY,, all data, regardless of address, data or CRC, adds 1bit of error-checking code per 4bit, andline data into serial stream data, followed by the physical Layer encoding Rules (10based-t NRZ encoding or 100based-tManchester Code) encode the data and turn it into an analog signal to send the data out. (Note: The number of data on the network cableThe comparison of the word or the simulation is not easy to understand clearly. In the end I say)the process in which data is collected is reverse. when sending data, the PHY also has an important function is to implement CSMA/CD part of the function, it can detectwhether there is data on the network is being transmitted. The NIC first listens for carrier on the media (carrier is indicated by voltage), if there is,It is assumed that other sites are transmitting information and continue to listen for media. Once the communication medium is within a certain period of time (called Inter-frame seamifg= 9.6 microseconds) is quiet, that is, it is not occupied by other sites, it begins to send frame data and continueslistens for communication media to detect conflicts. If a conflict is detected during the sending of data, the send is stopped immediately andsends a "blocking" signal to the media, informing other sites that a conflict has occurred, discarding those that may have been receivingcorrupted frame data and wait for a random time (CSMA/CD the algorithm that determines the wait time is the binary exponential fallbackavoidance algorithm). After waiting for a random amount of time, a new send is made. If the retransmission is repeated (greater than 16 times), it still occursconflict, the send is discarded. upon receipt, the network card browses each frame transmitted on the media and is considered a conflict fragment if its length is less than 64 bytes. if the received frame is not a conflict fragment and the destination address is a local address, the frame is checked for integrity if the frame lengthgreater than 1518 bytes (called super-long frames, may be caused by incorrect LAN driver or interference), or failure to pass the CRCcalibration, it is considered that the frame has been distorted. By verifying that the frame is considered valid, the NIC takes it down for localprocessingmany netizens in the access internt broadband, like to use "grab line" strong network card, is because of different PHY collisionthe method of calculating random time is different in design, which makes some network cards more "advantage". However, the line is only for the broadcast domainnetwork, for the switching network and ADSL so point-to-side connection to the local device access method is meaningless. and "Rob Line" is only relative, there will be no qualitative changes. 3 about inter-network conflictsNow the popularization of the switch makes the popularization of the Exchange network, makes the conflict domain network much less, greatly improves the netthe bandwidth of the network. However, if the hub, or shared bandwidth, is still part of the conflict domain network, there is asudden collisions. The biggest difference between the switch and hub is that a LAN switching device is built tois a network interconnection device that constructs the conflict domain networks. Our PHY also provides important functions for connecting to the end device and displays its currentthe state of the connection and the working state let us know. When we give the NIC access to the network cable, the PHY constantly sends the pulse signaldevices are detected on the peer, they negotiate with each other through standard "language", but connect speed, duplex mode,whether to use flow control and so on. Typically, the result of negotiation is the maximum speed and the best duplex mode that can be supported in both devices. Ita technique called auto negotiation or Nway, which is a meaning-auto-negotiation. output section of 4 PHYNow let's look at the back part of the PHY output. When a CMOS process chip works, the resulting signalThe flat is always greater than 0V (depending on the chip's process and design requirements), but such signals are sent to 100 meters or even moreThe long place will have a great loss of DC component. And if the external network is directly connected to the chip, electromagnetic induction (PlayingThunder) and electrostatic, it is easy to cause damage to the chip. then the device grounding method is different, the grid environment will cause the two sides of the 0V level inconsistency, so that the signal from aTo B, because a device of 0V and B point 0V level is not the same, this will lead to a large current from the electric potential highDevice to a low potential. How do we solve this problem? a Transformer (isolating transformer) is present. It sends the PHY out of the differential signal with the differencemode-coupled coil-coupled filtering to enhance the signal and to be coupled to the other end of the connection cable by the conversion of the electromagnetic field. Itnot only the network cable and PHY no physical connection between the transmission of the signal, cut off the signal in the DC component,data can also be transferred at different 0V levels of the device. The isolation transformer itself is designed to withstand the 2kv~3kv voltage. Also played a lightning-proof (I personally thinkthe role of protection against lightning strikes is not appropriate here. Some friends of the network equipment in the thunderstorm weather is easy to burn, mostlyPCB design unreasonable caused, and most of the equipment to burn the interface, very few chips are burned, is the isolation of the changeThe pressure device protects the function. 5 About Transfer MediaThe isolation transformer itself is a passive element, only the PHY signal is coupled to the network cable, and does not play the powermagnify the effect. 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, you can addThe signal is sent more than 100 meters of PHY its output power is also relatively large, more prone to EMI problems. This time, we needthe right transformer to cooperate with it. The PHY of the eldest company Marvell, often capable of transmitting 180~200meters away, far exceeding the IEEE's standard of 100 meters. The RJ-45 Connector realizes the connection between the network card and the network cable. It has 8 pieces of copper in it and 4 pairs of twisted pair in the cable (8The root) line corresponds to the connection. 100M of the network in which 1, 2 is the transmission of data, 3, 6 is to receive data. Between 1 and 2is a pair of differential signals, that is, they have the same waveform, but phase difference 180 degrees, the same time voltage amplitude mutualis positive or 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 pair, 3, 6 in a pair. Otherwise, the use of this cable during long distances can result in the inability to connect or evenThe connection is not stable. the new PHY now supports the Auto Mdi-x feature (also requires transformer support). It can achieve RJ-45The function of transmitting signal line on 1, 2 of the interface and the receiving signal line on 3 and 6 are exchanged automatically with each other. Some PHY evensupports automatic switching of the function of positive and negative signals in a pair of lines. So we don't need to connect a deviceyou have to worry about using a straight-through cable or a crossover cable. This technology has been widely used in switches and Soho Roadon the device. in the 1000BASD-T network, one of the most common modes of transmission is the use of all 4 pairs of twisted-pair wires in the cable,4, 5 and 7 were added, and the 8来 were transmitted together to receive data. Since the specification of the 1000BASED-T network includes the autoThe mdi-x function, therefore cannot strictly determine their outgoing or receive relations, depends on the two sides of the specific negotiation results. 6 How to communicate between PHY and MacLet's take a look at how PHY and Mac transfer data and communicate with each other. PassIEEE-defined standard mii/gigamii (media independed interfade, Media-independent interface) interface for Mac connectionand PHY. 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 using the SMI (Serial ManagementInterface) interface is done by reading and writing PHY registers. Some of the registers in the PHY are also defined by IEEE,In this way, PHY reflects its current state into the register, and the MAC continuously reads the PHY through the SMI bus .Status register to know the current PHY state, such as the connection speed, the ability to duplex, and so on. Of course, you can also pass SMIsets the register of the PHY for control purposes, such as opening and closing of the flow control, self-negotiation mode or forced mode, etc. we have seen both the physical connection of the MII interface and the SMI bus or the status register and control of the PHYregisters are regulated by the IEEE, so the Mac and PHY of different companies can work in harmony. Of course towith some of the features of the different company's PHY, the driver needs to be modified accordingly. 7 The power of the network cardThe 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 part of all PHY and Mac startsIs 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. In the mainwhen the machine is powered on, the operating voltage of the PHY should be replaced by a voltage from 5V to save 5V of Standby consumption. (Xumany inferior NICs do not do so.) there is a Wake on the line function of the NIC generally also has a WOL interface. That's because PCI2.1 didn't have a PCI before .the device wakes up the function of the host, so a wire is connected to the South Bridge via the Wol interface on the motherboard to achieveWOL functionality. the new motherboard-to-board adapter generally supports pci2.2/2.3, expands the pme# signal function, and does not require that interface to passThe PCI bus can realize the wake-up function.


Network card Working principle detailed

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.