Data link layer is the second lowest layer in the OSI reference model, which is responsible for node-to-node error free data delivery. To achieve this data link layer is divided into two sub layers Logical Link Control (LLC) and Media Access Control (MAC).
Following are functions and tasks performed by the data link layer :
Data framing - Encapsulation of the packet or message received from the network layer to form frames.
Logical Link Control (LLC) sub layer - Defines the functions to be needed for establishment and control of logical links between local devices in the network.
Flow control - Imposes a flow control to prevent overwhelming of the receiver.
Error control - Adds a method to detect and retransmit damaged or lost frames and also method to prevent duplication of frames.
Media Access Control (MAC) sub layer - It is related to procedures used by network devices to control access of network medium. As number of devices and networks shares a medium for communication, it is essential to specify rules for managing the medium that who has access at particular time to avoid conflicts.
Physical addressing - To distribute frames in its own network of device it adds header to the frame which contains MAC address of sender and receiver.
And to forward the frame to other network of device then the receiver address is the address of the device that connects to adjacent network.
Access control - Uses multiple access protocol to specify, who has control over the link at any given time.