Core functionality of Data Link Layer

This post gives a brief overview of the main functions of the data link layer.
The data link layer is positioned just above the physical layer in all the layering models. In order for data to travel from a source computer to a remote destination computer, it may have to travel through a variety of  wired/wireless physical layer links in the path. Though identification of an end to end path is done at the network layer, the protocols at the network layer are independent of the different underlying telecommunication links and hence cannot interact directly with the physical layer protocols. It is here that the data link layer comes into picture.
In the context of end to end computer communication, the main functionality of the data link layer is to understand the different physical links in the path and work in accordance with these link protocols to carry the data accordingly. More specifically, the function of the data link layer is to facilitate hop to hop communication through different physical layer links, by carring data packets (IP) inside logical units known as frames. Each frame contains exactly one IP datagram. The diagram given below illustrates the typical role of a data link layer, wherein packets are encapsulated inside data link layer frames and sent to the next hop through a physical link.

Positioning of Physical Layer

Data Link layer packing data into frames and sending it to next hop through a physical link

Frames travel between adjacent hops through the underlying physical links and so the frame structure would vary based on the underlying physical link and physical layer protocol. This is illustrated in an example given below:
A packet encapsulated inside  different Data Link Layer protocols

A packet encapsulated inside different Data Link Layer protocols

In the example given above, the path of the IP datagram from the source computer to the destination computer consists of three hops, with the first and third hops being Ethernet links and the middle hop being an SONET Optical link. Accordingly, you can see that the framing varies in each of these hops. While the IP datagram is encapsulated inside Ethernet protocol specific frame headers and trailers in the first and third hops, it is encapsulated inside  SONET protocol specific frame header and trailer in the second hop. Thus from this example, it must be clear that the framing structure and the data link layer protocol varies based on the underlying physical link.
Apart from the core functionality of facilitating hop-to-hop communication, the data link layer may also optionally provide additional functionalities like error control, flow control etc.

Different functionalities provided by the data link layer are summarized below:

  • It works closely with the physical layers in the path connecting the end nodes, to carry IP datagrams (packets)  between adjacent hops
  • It also offers multiplexing and demultiplexing functionality for carrying multiple Layer 3 protocols (e.g. IP, ARP, RARP etc.)
  • On the sending node machine, the data link layer  is responsible for framing and on the adjacent receiving node machine, the data link layer is responsible for de-framing (removing the IP datagram from the frame)
  • Frame structure and contents vary based on the underlying physical link.
  • Error detection (i.e. detection of bit corruption during transmission) is usually provided as a mandatory service by all data link layer protocols. This is accomplished by the sending node adding extra bits in the form of a CRC (Cyclic Redundancy Checks) or Checksum in the frame trailer and the receiving node, independently verifying the same.
  • For shared links (e.g. bus topologies), data link layer provides the Media Access Control (MAC) functionality, so that multiple end nodes could cooperatively use the link. For half-duplex links, the MAC functionality also makes sure that a node transmits on the link only during its turn.
  • Data link protocols offer either connection oriented service or connectionless service  to the network layer, based on the underlying links. While data link layer protocols in the LAN environment like Ethernet offer a connectionless oriented service, WAN data link layer protocols like PPP, ATM, MPLS etc. offer a connection oriented service.

Optional Features of Data Link Layer Protocols

  • Can optionally provide flow control functionality, so as to dynamically and adaptivelly control the rate of a sender, based on the receiver’s capacity.
  • Error Correction (correction of bit errors introduced during transmission) is also an optional feature and is usually provided by wireless data link layer protocols, as wireless links are usually erroneous.
  • Reliability (i.e. making sure that every frame reaches the other end intact and retransmitting when there is frame loss) is another optional feature that is supported by a few data link layer protocols. But majority of the data link layer protocols do not support reliability and only support best effort next hop delivery. Reliability is left to the higher layers.
  • Can support both point-to-point and multipoint physical layer links. While PPP is an example of a point-to-point data link layer protocol, Ethernet is an example of a multi-point data link layer protocol, where multiple end nodes are connected to the same physical link.
  • Can span single or multiple hops. For single hop links, the adjacent end nodes could be connected directly back to back or via. an intermediate layer 2 device like L2 Switch/bridge. For multiple hop links (e.g. Switched WAN links inside data exchanges like X.25, Frame Relay, ATM, MPLS), the end nodes are connected via. multiple intermediate L2 WAN switches.

There are a wide variety of data link layer protocols based on

  • the different types of telecommunication links (wired/wireless/LAN/WAN)
  • speed of the links
  • features supported by the link like flow control, error correction, reliability, service type (connection/connectionless), MAC etc.
  • Underlying network topology like Bus, Ring, Star etc.

Data link layer functionality is usually implemented using a combination of dedicated hardware and software. While the LLC (logical link layer) functionality of Layer3 protocol multiplexing/demultiplexing and logical link establishment is done in software, the  functionality of framing, checksumming and media access control (MAC) is implemented in dedicated hardware (usually named as MAC sub-block), because computationally intensive tasks like checksum calculation and checksum verification need to be done at this layer. There would be a dedicated piece of MAC hardware  for each physical interface in a node. For e.g. if a computer or a router has two ethernet interfaces, then it would have 2 MAC processors/sub-blocks. In many devices, the MAC and PHY blocks of an interface may  be combined as a single piece of hardware block (e.g. NICs on computers).
Layer 2 Switches or Bridges are intermediate devices used at the data link layer to either connect multiple segments of a single link or to connect multiple hops of a multipoint switched  link (e.g. Switched WAN network). There are a wide variety of both LAN (e.g. Ethernet, Wi-Fi) and WAN (e.g. ATM, MPLS etc.) switches in operation.

Leave a Reply

Your email address will not be published. Required fields are marked *