Implementation of Ethernet receiving and sending function of FPGA learning (OSI network layering) (1)

Implementation of Ethernet receiving and sending function of FPGA learning (OSI network layering) (1)

1. OSI proposed by ISO

Before learning the realization of the Ethernet function of FPGA, we must first understand what is a network?

At present, there is a network model that is widely accepted internationally and can describe the current and future network models in an abstract manner. This is the OSI model proposed by the ISO organization.

The ISO organization believes that it is necessary to establish a model that can be used when designing network protocols. From this sentence, the OSI model proposed by ISO is for protocol design. This is a large model framework. The OSI model includes various basic network functions, which will produce their own when applied to each protocol design. The network model of the protocol, such as the TCP/IP protocol model.

1.1 7-layer OSI model

Insert picture description here

The above figure explains: each layer cannot exist in a vacuum. For example, the transmission layer must have an understanding of the upper and lower layers and be able to communicate with these layers.

In the detailed description of the OSI model, ISO has not set any specific network standards for the model. This is the OSI mentioned above is a large model framework.

The OSI reference model makes a rough definition of the role of each layer. Many communication protocols correspond to one of the seven layers of the OSI reference model.

Because of this, the OSI model is open and robust, and can be used for existing network specifications and design standards for future networks. This is the original intention of the ISO organization.

1.2 The role of each layer of the OSI model

Insert picture description here

Insert picture description here

Term explanation:

Node: A node is any device connected to the network. Normally, a node refers to a computer.

First look at the physical layer at the bottom:

1.2.1 Physical layer

From the above picture, this layer is responsible for the exchange between 0, 1 bit stream (0, 1 sequence) and voltage level, and light flashing off.

This is the bottom layer of the network model and the foundation for the subsequent layers. The physical layer can also be called the hardware layer. The hardware refers to the computer, network cable, or any physical device that you choose to use when connecting two or more computers.

1.2.2 Data Link Layer

This layer is responsible for dividing the 0, 1 sequence converted by the physical layer into meaningful data frames and sending them to the opposite end. (That is, the generation and reception of data frames.)

The purpose of establishing a physical connection on the physical layer is to send data to this link, and the data link layer plays this role.

Assuming that there is a set of data to be transmitted above the physical layer, the data link layer must establish a data packet that can contain this information, identify the destination of the node responsible for receiving the data, and provide low-level error checking functions.

1.2.3 Network layer

This layer is responsible for addressing and routing, that is, how to transmit data to the destination address, where the destination address can be a certain address connected by multiple networks through routers.

After the data link layer is installed, it must have the corresponding logic to transmit information to different nodes on the network, but the network is composed of many different nodes, which use different physical layers and data link layers.

1.2.4 Transport layer

This layer plays the role of reliable transmission. For example, if there is data loss in the example in the figure, it is processed on the two nodes of the communication, not on the router.

The main problem solved by the transport layer is to determine that the received data is indeed the data we should accept.

Because in network transmission, the amount of data transmitted at the same time is limited, so the transmission layer will split the data to be sent into independent data packets, and then combine these data packets into complete information at the transmission layer of the receiving node .

1.2.5 Session layer

This layer is responsible for establishing and disconnecting communication connections (logical paths for data flow), as well as data transmission related management such as data segmentation. That is, when the connection is established, when the connection is disconnected, and how long the connection is maintained.

1.2.6 Presentation layer

This layer is mainly responsible for the conversion of data types and formats. Specifically, it can convert the processing information of the application layer into a format suitable for network transmission, or convert the data from the next layer into a format that can be processed by the upper layer.

1.2.7 Application layer

Provide services for the application and specify the relevant details of the communication in the application, including file transfer, email, remote login (virtual terminal and other protocols)

1.3 OSI model communication process

Based on the OSI model, we can use the network to transfer data from one place to another. The following figure shows the data transmission based on the OSI model. The processing of data transmission in the network is explained through examples.

Insert picture description here

It can be seen from the above figure that when the sender host A transfers data from the application layer, the presentation layer to the physical layer from top to bottom, and the receiving layer from the physical layer, the data link layer to the application layer from bottom to top. The upper level transmits data hierarchically.

Each layer can attach the "header" information necessary for the protocol of the current layer when processing the data from the upper layer, and then the receiving end separates the data "header" from the content of the received data, and then Forward it to the upper layer, and finally restore the data of the sender 1 to its original state.

If user A wants to send a "good morning" email to user B, what will the network do? Understand the meaning of the header information attached to the data at each layer? Understanding the first information is actually the information processing responsibility that each layer should do.

1.3.1 Application layer

Insert picture description here

User A will edit the email content on host A as "good morning", and designate the recipient as user B;

That is, "the user enters the mail content and sends it to the destination address", which is equivalent to the application layer.

The moment you click the "Send" button, you enter the application layer protocol processing.

This layer of protocol will attach a header message to the front end of "Good morning". After receiving the data sent by host A, the application layer of host B will analyze the data header and data body, and save the email.

1.3.2 Presentation layer

Insert picture description here

The sending end presentation layer will convert the text "good morning" transmitted from the application layer into a "unified network data format" according to its encoding format, and the receiving end will restore the converted "unified network data format" Into the "host B specific data format", and then deal with it accordingly, otherwise the content of the mail received at the receiving end will be garbled.

Moreover, in order to identify the encoding format between the presentation layer and the presentation layer, header information is also added, so that the actual transmitted data is transferred to the next layer for processing.

1.3.3 Session layer

Insert picture description here

The session layer is also like the application layer or the presentation layer, after it receives the additional header information from the front end of the "good morning" data, it forwards it to the next layer.

The header information of the session layer records related information such as the data transmission sequence.

So far, the above example illustrates the general process that data written in the application layer will be formatted and coded by the presentation layer, and then sent out after the session layer marks the sending order. It is known that the session layer only establishes a connection when and how It does not actually have the function of actual data transmission. It is the layer below the session layer that is really responsible for the network transmission of specific data.

1.3.4 Transport layer

Insert picture description here

This layer will ensure that the transmitted data can reach the target address.

For example, host A sends "good morning" to host B. During this period, there may be some reasons for data corruption, or only part of the data arrives at host B.

Assuming that host B only received the "morning" part of the data, it will inform host A that it has not received the complete data after receiving the data, and host A will send the following "good" data after receiving the data Resend to host B and confirm whether host B has received it.

Therefore, an important role of the transport layer is to ensure the reliability of data transmission.

In order to ensure this reliability, header information is also added to the transmitted data to identify this layered data. In fact, the processing of transmitting data to the opposite end is done by the network layer.

1.3.5 Network layer

Insert picture description here

The sending end network layer is to find the target address of host B among many network nodes, and send data from the sending end host to the receiving end host B.
The network layer will send the data received from the upper layer and target address information to the lower data link layer for subsequent processing.

Insert picture description here

The above figure shows the biggest difference between the network layer and the data link layer, because both the network layer and the data link layer send data to the receiving end based on the target address.

However, the network layer is responsible for the final address of data reception, that is, the target address of host B, while the data link layer is only responsible for sending data within a segment. For example, there are multiple layers of routers or switches between host A and host B.

1.3.6 Data link layer and physical layer

Insert picture description here

First of all, we must make it clear that communication transmission is actually realized through physical transmission media, and the role of the data link layer is to process data between these devices connected through the transmission media.

In the physical layer, the 0, 1 of the data is converted into voltage and pulsed light and transmitted to the physical transmission medium. The corresponding directly connected devices use addresses for transmission. This type of address is called a MAC address.

The purpose of using the MAC address is to identify devices connected to the same transmission medium. Therefore, in this layer, the header containing the MAC address information is attached to the data forwarded from the network layer and sent to the network.

1.3.7 Processing of host B

The above picture shows that the processing flow on the receiving end host B is just the opposite of that of host A. It starts from the physical layer and sends the received data layer by layer to the previous layer for processing, so that user B will finally be on host B Use the mail application to receive the mail sent by user A, and read the content of the mail "good morning".

Guess you like

Origin blog.csdn.net/sinat_41653350/article/details/106524588