Following functions are performed by data link layer:
(i) Framing: It converts the data units (Packets) received from the network layer to frames.
(ii) Addressing: Headers and trailers are added, containing the physical addresses of the adjacent nodes and removed upon a successful delivery.
(iii) Flow Control: It provides a flow control mechanism to avoid overwriting on the receiver's buffer by regulating the amount of data that can be sent.
(iv) Synchronization: Headers have bits, which tell the receiver when a frame is arriving. It also contains bits to synchronize its timing to know the bit interval to recognize the bit correctly. Trailers mark the end of a frame, apart from containing the error control bits.
(v) Error Control: It checks the CRC to ensure the correctness of the frame. If incorrect, it asks for retransmission. It also uses a mechanism to prevent duplication of frames.
(vi) Node-to-node delivery: Finally, it is responsible for error-free delivery of the entire frame to the next adjacent node.
(vii) Access control: The data link layer protocol determines which of the devices has control over the link at any given time, when two or more devices are connected to the same link. The IEEE felt the need to define data link layer in more details, so they split it into two sub-layers.
(a) Logical Link Control (LLC): It establishes and maintains links between the communicating devices.
(b) Media Access Control (MAC): It controls the way multiple devices share the same media channel. The logical link control sub-layer provides Service Access Points (SAPs) that the other computers can refer to and use to transfer information from LLC to the network layer. The MAC sub-layer provides for shared access to the network adapter and communicates directly with the network interface cards. Network interface cards (NIC) have a unique 12-digit hexadecimal MAC address assigned before they leave the factory where they are manufactured.
The MAC addresses are used to establish logical link between two computers on the same LAN. Bridges, intelligent hubs and network interface cards are devices associated with the data link layer.
Services provided for the network layer include:
(i) Transmission of data in data link service data units.
(ii) Provision of a data link connection end-point identifier.
(iii) Sequence control.
(iv) Notification of transmission errors.
(v) Flow control.
(vi) An indication of quality of service.