Article directory
- Data Link Layer Functional Overview
- Encapsulation framing & transparent transmission
- Error Control (Error Detection Coding)
- Error Control (Error Correction Coding)
- brain map moment
- Flow Control and Reliable Transport Mechanisms
- brain map moment
- stop-wait protocol
- brain map
- Fallback N Frame Protocol
- brain map
- Choose a retransmission protocol
- brain map
Data Link Layer Functional Overview
The research idea of data link layer
Only for the same level.
Basic Concepts of Data Link Layer
Node: host, router
Link: The physical the transmission medium of the link mainly includes twisted pair, optical fiber and microwave. Divided into wired link, wireless link.
Data link: A logical hardware and software that implements the control data transmission protocol to the link constitutes a data link.
Frame: A protocol data unit at the link layer that encapsulates a network layer datagram.
The data link layer is responsible for transmitting datagrams through a link from a node to an adjacent node directly connected to another physical link .
Data Link Layer Functional Overview
The data link layer provides services to the network layer on the basis of the services provided by the physical layer . Its most basic service is to reliably transmit the data from the network layer to the network layer of the target machine of the adjacent node. Its main function is to strengthen the function of the physical layer to transmit the original bit stream, and transform the physical connection provided by the physical layer into a logically error-free data link, making it appear as an error-free link to the network layer.
Function 1: Provide services for the network layer . Unconfirmed connectionless service, confirmed connectionless service, and confirmed connection-oriented service. There must be confirmation if there is a connection!
Function 2: Link management, that is, connection establishment, maintenance, and release (for connection-oriented services).
Function three: framing.
Function four: flow control.
Function 5: Error control (frame error/bit error).
Encapsulation framing & transparent transmission
encapsulation into framing
Encapsulation into a frame: It is to add a header and a tail before and after a piece of data , which constitutes a frame. After the receiving end receives the bit stream handed over by the physical layer, it can identify the start and end of the frame from the received bit stream according to the markers in the header and the tail .
The header and tail contain a lot of control information, and one of their important functions is frame delimitation (determining the boundaries of the frame).
Frame synchronization: The receiver should be able to distinguish the start and end of a frame from the received binary bit stream.
Four methods of framing: 1. Character counting method, 2. Character (section) filling method, 3. Zero-bit filling method, 4. Violation encoding method.
character counting
The frame header uses a count field (the first byte, eight bits) to indicate the number of characters in the frame.
Pain point: Eggs are packed in one basket.
character padding
zero bit padding
- On the sender side, scan the entire information field and fill in a 0 immediately as long as there are 5 consecutive 1s.
- When the receiver receives a frame, it first finds the flag field to determine the boundary , and then scans the bit stream with hardware. When 5 consecutive 1s are found, the following 0s are deleted.
Code violations
The start and end of the frame can be delimited with "High-High", "Low-Low".
Due to the fragility of the Count field in the byte counting method (the wrong value will lead to catastrophic consequences) and the complexity and incompatibility of character padding implementation, the more commonly used frame synchronization methods are bit padding and illegal encoding. Law.
Transparent transmission
Transparent transmission means that regardless of the bit combination of the transmitted data, it should be able to be transmitted on the link. As a result, the link layer "sees" nothing preventing data transmission.
When the bit combination in the transmitted data happens to be exactly the same as a certain control information, appropriate measures must be taken so that the receiver will not mistake such data as some kind of control information. Only in this way can the transmission of the data link layer be transparent.
Error Control (Error Detection Coding)
Where did the error come from?
In general, errors in transmission are caused by noise .
Global: 1. The random noise (thermal noise) generated by the electrical characteristics of the line itself is inherent to the channel and exists randomly. In general, errors in transmission are caused by noise.
Solution: Increase the signal-to-noise ratio to reduce or avoid interference. (Starting with the sensor)
Locality: 2. The impact noise caused by a specific short-term cause from the outside world is the main cause of errors.
Solution: usually use coding technology to solve.
Error control at the data link layer
Error Detection Coding - Parity Check Code
Error Detection Coding - CRC Cyclic Redundancy Code
Example: The data to be sent is 1101 0110 11, using CRC check, the generator polynomial is 10011, then the final data sent should be?
Generating polynomial problems will give.
Final data sent: data to be sent + frame check sequence FCB
calculation redundancy code:
- If the number of digits of the generator polynomial is 5 by adding 0, that is to add 4 0s after the original data;
- After adding 0 to the data, divide it by a polynomial, and the remainder is a redundant code.
- The redundant code is then used in place of the 0000 position.
- The error checking process at the receiving end
divides each received frame by the same polynomial, and then checks the resulting remainder R.
1. If the remainder is 0, it is judged that there is no error in this frame, and it is accepted.
2. If the remainder is not 0, it is determined that there is an error in this frame (it cannot be determined in place), and it is discarded.
Error Control (Error Correction Coding)
Error Correction Coding - Hamming Code
Hamming distance
The number of bits with different values for the corresponding bits of two legal codes (code words) is called the Hamming distance (code distance) of the two code words. In a valid code set, the Hamming distance of any two legal codes (code words) The minimum value of the distance is called the Hamming distance (code distance) of the code set.
- Determine the number of Hamming codes r
- Determine the location of the checksum and data
n = 0 1 2
- Find the value of the check code
- Error detection and correction
brain map moment
Flow Control and Reliable Transport Mechanisms
The mismatch between the higher sending speed and the lower receiving capacity will cause transmission errors, so flow control is also an important task of the data link layer.
Flow control at the data link layer is point-to-point, while flow control at the transport layer is end-to-end.
Data link layer flow control method: the receiver will not reply to the confirmation if the receiver cannot accept it.
Transport layer flow control means: the receiver sends a window announcement to the sender.
method of flow control
The stop-wait protocol can be regarded as a special sliding window protocol.
Stop-wait protocol: send window size=1, receive window size=1;
back N frame protocol: send window size>1, receive window size=1
; Protocol: send window size > 1, receive window size > 1
Reliable transmission, sliding window, flow control
brain map moment
stop-wait protocol
"Stop-wait" means to stop sending every time a packet is sent, wait for the other party's confirmation, and then send the next packet after receiving the confirmation.
error free
error condition
- Data frame lost or frame error detected
- ACK lost
- ACK late