Datalink is a layer in the Open System Interconnections. It is the second layer in between the physical layer and the network layer. It manages the connection between the two nodes. Data links integrate certain methods like error control, flow control, and associated link management functions.
Some of the main functions of the data link layer include providing a straightforward service interface to the network layer, framing flow control and error recognition, and frame formatting.
Data Link layer is mainly of two types −
Logical Link Control Sub-Layer (LLC)
Media Access Control Sub-layer (MAC)
It gives logic for the data link. Therefore, it manages the synchronization, flow control, and error recognition features of the data link. LLC is used for Error Recovery and User Addressing. It executes the Control flow functioning.
MAC is the sub-layer of the data link. It manages the flow and is multitudinous for the transmission medium. This layer manages the channeling of data packages. MAC is used for sending the data over the network interface card.
MAC is used in recognition of errors. It accomplishes the special labeling to stations directly linked to LAN.
The main aim of this service is to give services to the network layer. The concept of this layer is to transfer the data from the network layer on the source machine to the layer on the destination machine. Communication between the two data layers is done via Data Link Control Protocol.
Here are the important services given by the Data Link layer to the Network layer −
Unacknowledged connectionless services
Acknowledged connectionless service
Service given to the network layer data link uses the services given to the physical layer. The source machine sends the data in the form of frames to the destination machine. Starting point and the endpoint of the frame should point out so that the destination machine can easily identify the frame.
The data link layer breaks the bitstream and calculates the checksum for each layer. At the destination layer, the checksum is enumerated. Therefore, breaking the bitstream by placing spaces and time gaps is known as framing.
It is quite difficult and dangerous to count on timing and mark the starting and endpoints of each frame. Simple techniques used for framing are −
Starting and ending character with character filling
Starting and ending flags with little fillings.
Flow control is done to stop the data flow at the receiver's end. The transmitter will transfer the frames very quickly to the receiver. However, the receiver will not accept them as quickly as the sender sends because the sender runs on a lightly loaded machine while the receiver runs on a heavily loaded machine.
It doesn't matter if the transmission is error-free at some point. The receiver will not be able to control the frames as they will arrive.
For stopping the transmission, a mechanism is there which requests the transmitter to block the incorrect messages.
It is done so that there is no copying of the frames for the safe delivery of the frames at the destination. In addition, Positive and negative acceptance is sent about the incoming frames.
Therefore, if the sender gets positive acceptance, that means the frame appears safely, while negative appearance means that something is wrong with the frame and the frame will be retransferred.
The timer is put at the receiver's and sender's end. Besides, the sequence number is given to the outgoing transmission. So that receiver will easily identify that it is a retransmitted frame. It is one of the main parts of the data link layer responsibilities.
The data link layer adds a header to the frame to describe the sender or receiver's physical address.