The data blocks in the data link layer are often called "frames", and the frame is the transmission unit of the data link layer. In order to retransmit only the limited data with errors after an error occurs during transmission, the data link layer combines the bit stream into Ethernet frames and transmits them in units; in addition to the data to be transmitted, each frame also includes a check code. Enables the receiver to detect errors in transmission.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
Data blocks in the data link layer are often called "frames".
The data link layer is the second layer in the OSI reference model, between the physical layer and the network layer. The data link layer provides services to the network layer based on the services provided by the physical layer. Its most basic service is to reliably transmit data from the physical layer to the target network layer of adjacent nodes.
The data link layer defines how data is transmitted over a single link. These protocols are relevant to the various media in question. Example: ATM, FDDI, etc.The data link layer must have a series of corresponding functions, mainly including: how to combine data into data blocks. This data block is called a frame in the data link layer, and the frame is the transmission unit of the data link layer; How to control the transmission of frames on the physical channel, including how to handle transmission errors, how to adjust the sending rate to match the receiver; and provide the establishment, maintenance and release of data link paths between two network entities management.
The data link layer mainly has two functions: frame coding and error correction control. Frame encoding means defining a data packet that contains information frequency, bit synchronization, source address, destination address, and other control information.
The data link layer protocol is divided into two sub-layers: Logical Link Control (LLC) protocol and Media Access Control (MAC) protocol.
The basic function of the data link layer
The most basic function of the data link layer is to Users are provided with basic services of transparent and reliable data transfer. Transparency means that there are no restrictions on the content, format, and encoding of data transmitted on this layer, and there is no need to explain the meaning of the information structure; reliable transmission eliminates users' worries about lost information, interfering information, and incorrect order. These situations may occur in the physical layer, and error correction codes must be used in the data link layer to detect and correct errors. The data link layer enhances the function of the physical layer to transmit the original bit stream, transforming the possible error-prone physical connections provided by the physical layer into a logically error-free data link, so that it appears as an error-free line to the network layer. .
Frame synchronization
In order to retransmit only the limited data with errors after an error occurs during transmission, the data link layer combines the bit stream into an Ethernet frame. Unit teleportation. In addition to the data to be transmitted, each frame also includes a check code so that the receiver can detect errors in the transmission. The organizational structure of the frame must be designed so that the receiver can clearly identify it from the bit stream received at the physical layer, that is, it can distinguish the start and end of the frame from the bit stream. This is what frame synchronization needs to solve. question.
(1) Byte counting method: This is a frame synchronization method that uses a special character to indicate the start of a frame and a special field to indicate the number of bytes in the frame. The receiver can distinguish the start of the frame from the bit stream by recognizing the special character and know the number of data bytes that follow in the frame from the special field, so as to determine the end position of the frame. A typical representative of byte count-oriented synchronization procedures is DEC's Digital Data Communications Message Protocol DDCMP (Digital Data Communications Message Protocol).
The control character SOH marks the start of the data frame. In actual transmission, two or more synchronization characters are used before SOH to determine the start of a frame. Sometimes the head of this frame is allowed to follow the end of the previous frame. In this case, there is no need to add synchronization characters between the two frames. . The count field has a total of 14 bits, which is used to indicate the number of bytes of data in the data segment in the frame. The maximum value of the 14-bit binary number is 16383, so the maximum length of the data is 131064. The DDCMP protocol relies on this byte count to determine the end position of the frame. The ACK, SEG, ADDR and second bits CRC1 and CRC2 in FLAG in the DDCMP frame format double-check the header part and the data part respectively. The reason why the header part is checked separately is that once the CONUT field in the header part is wrong , that is, the basis for frame boundary division is lost. Since the character count method used to determine the end boundary of the frame does not cause confusion between data and other information, data transparency can be achieved without any measures (that is, any data can be transmitted without restriction).
(2) Head and tail delimiter method using character filling: This method uses some specific characters to delimit the beginning and end of a frame. In order to prevent the data information bits from appearing the same as the specific characters The characters are misjudged as the first and last delimiters of the frame. An escape control character (DLE) can be filled in front of such data characters to show the difference, thereby achieving data transparency. However, this method is more troublesome to use, and the specific characters used are too dependent on the character encoding set used, and the compatibility is relatively poor.
(3) Head and tail marking method using bit filling: This method uses a specific set of bit patterns to mark the start and end of a frame.
(4) Illegal encoding method: This method is used when the physical layer adopts a specific bit encoding method. For example, a method called Manchester encoding encodes data bits "1" into "high-low" level pairs, and data bits "0" into "low-high" level pairs. The "high-high" level pairs and "low-low" level pairs are illegal in data bits. These illegal encoding sequences can be used to delimit the start and end of frames. This method is adopted in the IEEE 802 standard for local area networks. The illegal encoding method does not require any padding technology to achieve data transparency, but it is only applicable to special encoding environments that use redundant encoding. Due to the fragility of the COUNT field in the byte counting method and the complexity and incompatibility in the implementation of the character filling method, the more commonly used frame synchronization methods are bit filling and illegal encoding methods.
Error Control
A practical communication system must have the ability to discover (that is, detect) such errors, and take some measures to correct them so that the errors can be controlled To the smallest extent possible, this is the error control process and one of the main functions of the data link layer. Inspection of error coding (such as parity code, checksum or CRC) can determine whether an error occurred during the transmission of a frame. Once an error is discovered, it can generally be corrected by feedback and retransmission. This requires the receiver to feedback information to the sender after receiving a frame, so that the sender can make a decision that there is no need to resend. That is to say, the sender only needs to receive the message that the receiver has correctly received. Only after the feedback signal can the frame be considered to have been sent correctly, otherwise it needs to be resent until it is correct. Burst noise on the physical channel may completely "swamp" a frame, that is, the entire data frame or feedback information frame is lost. This will cause the sender to never receive the feedback information from the receiver, thus stalling the transmission process. In order to avoid When this happens, a timer is usually introduced to limit the time interval for the receiver to send back feedback information. When the sender sends a frame, it also starts the timer. If the receiver's response is not received within the limited time interval, If the feedback information, that is, the timer times out (Timeout), it can be considered that the transmitted frame has been errored or lost, and then needs to be resent. Because the same frame of data may be sent multiple times. In order to prevent this danger, you can use the method of numbering the sent frames, that is, giving each frame a signal, so that the receiver can distinguish from the sequence number whether it is a newly sent frame or a frame that has been received but resent. , to determine whether to submit the received frame to the network layer. The data link layer uses counters and sequence numbers to ensure that each frame is ultimately delivered to the target network layer correctly once.
Flow control
Flow control is not a function unique to the data link layer. Many high-level protocols also provide flow timing control functions, but the objects of flow control are Just different. For example, for the data link layer, it controls the traffic on the data link between two adjacent nodes, while for the transport layer, it controls the traffic from the source to the final destination. Due to the difference in the working rate of the equipment used by the sender and the receiver and the buffer storage space, the sender's sending capability may be greater than the receiver's receiving capability. If the sender's sending rate (that is, the information flow on the link) is not adjusted at this time, With appropriate restrictions, frames that are not received in time will be "flooded" by frames that are continuously sent later, resulting in frame loss and errors. It can be seen that flow control is actually the control of the sender's data flow so that the sending rate does not exceed the capacity of the receiver. This process requires some kind of feedback mechanism to let the sender know whether the receiver can keep up with the sender. That is, there need to be some rules so that the sender knows under what circumstances it can continue to send the next frame, and under what circumstances it must pause sending. to continue sending after receiving some kind of feedback information.
Link management
The link management function is mainly used for connection-oriented services. When the nodes at both ends of the link want to communicate, they must first confirm that the other party is in a ready state and exchange some necessary information to initialize the frame sequence number. Then the connection can be established, and the connection must be maintained during the transmission process. If an error occurs, it needs to be reinitialized and the connection automatically established again. After the transmission is completed, the connection must be released. The establishment, maintenance and release of data link layer connections is called link management. In the case where multiple sites share the same physical channel (such as in a LAN), how to allocate and manage channels among sites requiring communication also belongs to the scope of data link layer management.
Frame type
HDLC has three types: information frame (I frame), monitoring frame (S frame) and unnumbered frame (U frame) different types of frames.
(1) Information frame (I frame):
Information frames are used to transmit valid information or data, usually referred to as I frames. The I frame is marked by the first bit of the control word being "0". The N (S) in the control field of the information frame is used to store the sending frame sequence number, so that the sender does not have to wait for confirmation and continuously sends multiple frames. N(R) is used to store the sequence number of the next frame that the receiver is expected to receive. N(R) = 5, which means that the receiver will receive frame No. 5 in the next frame. In other words, each frame before frame No. 5 is received. .
(2) Monitoring frame (S frame):
Monitoring frame is used for error control and flow control, usually referred to as S frame. S frames are marked with "10" in the first and second bits of the control field. The S frame has an information field, which is only 6 bytes or 48 bits. The third and fourth bits of the control field of the S frame are S frame type codes. There are four different codes, respectively:
00 - Ready to receive (RR), determined by the master station Or sent from the station. The master station can use the RR type S frame to poll the slave station. The slave station transmits the I frame numbered N (R). If such a frame exists, it will be transmitted; the slave station can also use the RR type S frame to respond, indicating The number of the next I frame that the slave station expects to receive from the master station is N(R).
01——Reject (REJ), sent by the master station or slave station to require the sender to reject the frames starting from N (R) and all subsequent frames. A retransmission is performed, which also implies that N(R) previous I frames have been received correctly.
10 - Receive Not Ready (RNR), indicating that an I frame numbered less than N (R) has been received, but is in a busy state and is not ready to receive an I frame numbered N (R) I frame, which can be used to control link traffic.
11 - Selective rejection (SREJ), which requires the sender to send a single I frame numbered N (R) and implies that its numbered I frames have all been acknowledged
(3) Unnumbered frame (U frame):
The unnumbered frame is named because it does not contain the numbers N (S) and N (R) in the control field, referred to as U frame. U frames are used to provide link establishment, teardown and various control functions. These control functions are defined by 5 M bits (M1, M2, M3, M4, M5, also called correction bits). The 5 M bits can define 32 additional command functions or 32 response functions, but many are vacant.
For more related knowledge, please visit theFAQcolumn!
The above is the detailed content of What are data blocks in the data link layer often called?. For more information, please follow other related articles on the PHP Chinese website!