Functions of LLC and MAC sub-layers of Data Link Layer

This post gives a brief overview of the two sub-layers of the data link layer, namely LLC (Logical Link Control) and MAC (Media Access Control).

The data link layer functionality is usually split it into logical sub-layers, the upper sub-layer, termed as LLC, that interacts with the network layer above and the lower sub-layer, termed as MAC, that interacts with the physical layer below, as shown in the diagram given below:

Upper and Lower sub-layers of Data Link Layer

Upper and Lower sub-layers of Data Link Layer

 

While LLC is responsible for handling multiple Layer3 protocols (multiplexing/de-multiplexing) and link services like reliability and flow control, the MAC is responsible for framing and media access control for broadcast media. The functional overview of LLC and MAC sub-layers are given in the diagram below :

Role of LLC and MAC

Role of LLC and MAC

LLC

The primary responsibilities of LLC are:

Network Layer protocol Multiplexing/De-Multiplexing

Interfacing with the Network (Layer3) above by doing L3 protocol multiplexing/de-multiplexing. On receiving a frame from the physical layer below, the LLC is responsible for looking at the L3 Protocol type and handing over the datagram to the correct L3 protocol (de-multiplexing) at the network layer above. On the sending side, LLC takes packets from different L3 protocols like IP, IPX, ARP etc., and hands it over to the MAC layer after filling the L3 protocol type in the LLC header portion of the frame (multiplexing).

Logical Link Services

LLC can optionally provide reliable frame transmission by the sending node numbering each transmitted frame (sequence number), the receiving node acknowledging each received frame ( acknowledgment number) and the sending node retransmitting lost frames.  It can also optionally provide flow control by allowing the receivers to control the sender’s rate through control frames like RECEIVE READY and RECEIVE NOT READY etc.

Based on whether a logical connection is established betweeen the layer 2 peers and based on whether frames are acknowledged by the peer, LLC can be classified to provide the following types of service modes:

a) Connectionless  Unacknowledged Service : This is a best effort service like IP datagram service, with no connection establishment between L2 peers and also no acknowledgment for data frames from the peer. Whenever there is data to be transferred to the peer, it is sent directly, without any connection establishment. Flow control may be optionally provided in this service. In Internet, since reliability, flow control and error control are provided at the transport layer by TCP, a simple connectionless unacknowledged service is enough at the data link layer, provided the link is of good quality with low error rates. Hence, this service mode is the most widely used mode in the Internet, where TCP/IP is the basic protocol stack. This mode  is used on almost all high quality wired links like Ethernet and Optical.

b) Connectionless Acknowledged Service: In this mode, data is directly sent between Layer2 peers without any logical link establishment. But each frame is numbered using sequence numbers and the peer acknowledges each frame received using an Acknowledgment number field. This service mode is used in scenarios where the overhead of a connection establishment is costly due to the extra delay involved, but where data reliability is needed. The sender can track lost or damaged frames and retransmit such frames to achieve reliability. This type of service is used in wireless links, where the quality of link is not as good as wired links and so frequent link establishment and teardown are unnecessary overheads, as these control frames may themselves be corrupted or lost.

c) Connection Oriented Service: In this mode, procedures are laid out for logical link establishment and disconnection. Before data transfer, a logical connection is established between peers, before data transfer starts, through the exchange of control frames, known as Supervisory Frames. The logical connection is closed after the data exchange phase is over. Actual data transfer starts  after the connection establishment phase and frames carrying higher layer data are known as Information Frames. A third category of frames, known as Unumbered Acknowledgment frames are used to acknowledge received Supervisory frames.

In this mode too, there are two variants that are used, namely one without acknowledgement and another with acknowledgement.

Connection oriented service Without Acknowledgment

Here, though a logical link is established before actual data transfer happens, there is no concept of frames being numbered and acknowledged through Sequence number and acknowledgment number fields. It is just a best effort service, with reliability left to the higher layer protocol. Many WAN protocols like HDLC, PPP, LAPB, LAPD etc. use this mode of service.

Connection oriented service with Acknowledgment

Here, apart from a logical link being established before data transfer happens, reliability and flow control services are also provided by the LLC. Reliability is provided through the use of sequence number, acknowledgment number and retransmission of lost frames using strategies like Go Back N or Selective Repeat. Flow control is provided by using a sliding window mechanism. This service mode is rarely used in the Internet, because Internet uses TCP, that supports reliability and flow control at the transport layer. This service mode is used in properietary protocols like Microsoft’s NetBIOS.

Note that though connection establishment, reliability and flow control are optional services at the data link layer, error detection is still a basic service provided by the data link layer, through the use of CRC/checksums in the frame trailer, that is added by the MAC sub-layer framing functionality.

MAC

The MAC sub-layer interacts with the physical layer and is primarily responsible for framing/de-framing and collision resolution.

 Framing/De-Framing and interaction with PHY: On the sending side, the MAC sub-layer is responsible for creation of frames from network layer packets, by adding the frame header and the frame trailer. While the frame header consists of layer2 addresses (known as MAC address) and a few other fields for control purposes, the frame trailer consists of the CRC/checksum of the whole frame. After creating a frame, the MAC layer is responsible for interacting with the physical layer processor (PHY) to transmit the frame.

On the receiving side, the MAC sub-layer receives frames from the PHY and is responsible for accepting each frame, by examining the frame header. It is  also responsible for verifying the checksum to conclude whether the frame has come uncorrupted through the link without bit errors. Since checksum computation and verification are compute intensive tasks, the framing/de-framing functionality is done by dedicated piece of hardware (e.g. NIC card on PCs).

Collision Resolution : On shared or broadcast links, where multiple end nodes are connected to the same link, there has to be a collision resolution protocol running on each node, so that the link is used cooperatively. The MAC sub-layer is responsible for this task and it is the MAC sub-block that implements standard collision resolution protocols like CSMA/CD, CSMA etc. For half-duplex links, it is the MAC sub-layer that makes sure that a node sends data on the link only during its turn. For full-duplex point-to-point links, the collision resolution functionality of MAC sub-layer is not required.

In end nodes and in intermediate devices like L2 switches and Routers, the LLC functionality is implemented in network device driver software that is part of the Operating System and the MAC functionality is implemented in dedicated piece of hardware.

3 comments for “Functions of LLC and MAC sub-layers of Data Link Layer

  1. ibrahim hasan
    June 30, 2015 at 13:56

    thanks

    • hassan
      June 30, 2015 at 15:19

      ok some how i got

  2. Aimelo
    July 2, 2015 at 10:16

    Thanks for the info. It helps me a lot

Leave a Reply

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

Current ye@r *