In the OSI (Open System Interconnections) Model, each layer uses the services of the layer below it and provides services to the layer above it. The primary function of the data link layer is to provide a well-defined service interface to the network layer above it.
The main service provided is to transfer data packets from the network layer on the sending machine to the network layer on the receiving machine. Data link layer of the sending machine transmits accepts data from the network layer and sends them to the data link layer of the destination machine which hands them to the network layer there.
In actual communication, the data link layer transmits bits via the physical layers and physical medium. However virtually, this can be visualized as the two data link layers communicating with each other using a data link protocol.
The processes are depicted in the following diagram −
The data link layer offers three types of services.
Unacknowledged connectionless service − Here, the data link layer of the sending machine sends independent frames to the data link layer of the receiving machine. The receiving machine does not acknowledge receiving the frame. No logical connection is set up between the host machines. Error and data loss is not handled in this service. This is applicable in Ethernet services and voice communications.
Acknowledged connectionless service − Here, no logical connection is set up between the host machines, but each frame sent by the source machine is acknowledged by the destination machine on receiving. If the source does not receive the acknowledgment within a stipulated time, then it resends the frame. This is used in Wifi (IEEE 802.11) services.
Acknowledged connection-oriented service − This is the best service that the data link layer can offer to the network layer. A logical connection is set up between the two machines and the data is transmitted along this logical path. The frames are numbered, that keeps track of loss of frames and also ensures that frames are received in correct order. The service has three distinct phases −
Set up of connection – A logical path is set up between the source and the destination machines. Buffers and counters are initialised to keep track of frames.
Sending frames – The frames are transmitted.
Release connection – The connection is released, buffers and other resources are released.
It is appropriate for satellite communications and long-distance telephone circuits.