Data link layer is the second layer in OSI reference model and lies above the physical layer. The data link layer performs the following functions.
1. Data link layer receives the data from the network layer & divide it into manageable units called frames.
2. It then provides the addressing information by adding header to each frame. Physical addresses of source & destination machines are added to each frame.
3. It provides flow control mechanism to ensure that sender is not sending the data at the speed that the receiver cannot process.
4. It also provide error control mechanism to detect & retransmit damaged, duplicate, or lost frame, thus adding reliability to physical layer.
5. Another function of data link layer is access control. When two or more devices are attached to the same link, data link layer protocols determine which device has control over the link at any given time.
In LAN data link layer is divided in the 2 layers:
- Logical Lick Control Sub-layer
- Medium Access Layer
Logical Link Control Sublayer: The uppermost sublayer is Logical Link Control (LLC). This sublayer multiplexes protocols running atop the data link layer, and optionally provides flow control, acknowledgment, and error recovery. The LLC provides addressing and control of the data link. It specifies which mechanisms are to be used for addressing stations over the transmission medium and for controlling the data exchanged between the originator and recipient machines.
Media Access Control Sublayer: The sublayer below it is Media Access Control (MAC). Sometimes this refers to the sublayer that determines who is allowed to access the media at any one time. Other times it refers to a frame structure with MAC addresses inside. There are generally two forms of media access control: distributed and centralized. Both of these may be compared to communication between people: The Media Access Control sublayer also determines where one frame of data ends and the next one starts. There are four means of doing that: a time based, character counting, byte stuffing and bit stuffing.
Services Provided To Network Layer
• Network layer is the layer 3 of OSI model and lies above the data link layer. Data link layer provides several services to the network layer.
• The one of the major service provided is the transferring the data from network layer on the source machine to the network layer on destination machine.
• On source machine data link layer receives the data from network layer and on destination machine pass on this data to the network layer as shown in Fig.
• The path shown in fig (a) is the virtual path. But the actual path is Network layer -> Data link layer -> Physical layer on source machine, then to physical media and thereafter physical layer -> Data link layer -> Network layer on destination machine
The three major types of services offered by data link layer are:
1. Unacknowledged connectionless service.
2. Acknowledged connectionless service.
3. Acknowledged connection oriented service.
1. Unacknowledged Connectionless Service
(a) In this type of service source machine sends frames to destination machine but the destination machine does not send any acknowledgement of these frames back to the source. Hence it is called unacknowledged service.
(b) There is no connection establishment between source and destination machine before data transfer or release after data transfer. Therefore it is known as connectionless service.
(c) There is no error control i.e. if any frame is lost due to noise on the line, no attempt is made to recover it.
(d) This type of service is used when error rate is low.
(e) It is suitable for real time traffic such as speech.
2. Acknowledged Connectionless Service
(a) In this service, neither the connection is established before the data transfer nor is it released after the data transfer between source and destination.
(b) When the sender sends the data frames to destination, destination machine sends back the acknowledgement of these frames.
(c) This type of service provides additional reliability because source machine retransmit the frames if it does not receive the acknowledgement of these frames within the specified time.
(d) This service is useful over unreliable channels, such as wireless systems.
3. Acknowledged Connection - Oriented Service
(a) This service is the most sophisticated service provided by data link layer to network layer.
(b) It is connection-oriented. It means that connection is establishment between source & destination before any data is transferred.
(c) In this service, data transfer has three distinct phases:-
(i) Connection establishment
(ii) Actual data transfer
(iii) Connection release
(d) Here, each frame being transmitted from source to destination is given a specific number and is acknowledged by the destination machine.
(e) All the frames are received by destination in the same order in which they are send by the source.