Data Link Layer Technologies

The Data Link layer is divided into two sub-layers — Logical Link Control (LLC) and Media Access Control (MAC). From the Data Link layer down, data packets are addressed using MAC addresses to identify the specific physical devices that are the source and destination of packets, rather than the IP addresses, URLs or domain names used by the higher OSI layers.

Logical Link Control

Logical Link Control (LLC) is the upper sub-layer of the Data Link layer (Figure 1), and is most commonly defined by the IEEE 802.2 standard. It provides an interface that enables the Network layer to work with any type of Media Access Control layer.

A frame produced by the LLC and passed down to the MAC layer is called an LLC Protocol Data Unit (LPDU), and the LLC layer manages the transmission of LPDUs between the Link Layer Service Access Points of the source and destination devices.

A Link Layer Service Access Point (SAP) is a port or logical connection point to a Network layer protocol (Figure 2).

In a network supporting multiple Network layer protocols, each will have specific Source SAP (SSAP) and Destination SAP (DSAP) ports. The LPDU includes the 8-bit DSAP and SSAP addresses to ensure that each LPDU is passed on receipt to the correct Network layer protocol.

The LLC layer defines connectionless (Type 1) and connection oriented (Type 2) communication services and, in the latter case, the receiving LLC layer keeps track of the sequence of received LPDUs. If an LPDU is lost in transit or incorrectly received, the destination LLC requests the source to restart the transmission at the last received LPDU.

The LLC passes LPDUs down to the MAC layer at a logical connection point known as the MAC Service Access Point (MAC SAP). The LPDU is then called a MAC Service Data Unit (MSDU) and becomes the data payload for the MAC layer.

Media Access Control

The second sub-layer of the Data Link layer controls how and when a device is allowed to access the PHY layer to transmit data, this is the Media Access Control or MAC layer. In the following sections, the addressing of data packets at the MAC level is first described. This is followed by a brief look at MAC methods applied in wired networks, which provides an introduction to the more complex solutions required for media access control in wireless networks.

MAC Addressing

A receiving device needs to be able to identify those data packets transmitted on the network medium that are intended for it — this is achieved using MAC addresses. Every network adapter, whether it is an adapter for Ethernet, wireless or some other network technology, is assigned a unique serial number called its MAC address when it is manufactured.

The Ethernet address is the most common form of MAC address and consists of six bytes, usually displayed in hexadecimal, such as 00-D0-59- FE-CD-38. The first three bytes are the manufacturer’s code (00-D0-59 in this case is Intel) and the remaining three are the unique serial number of the adapter.

The MAC address of a network adapter on a Windows PC can be found in Windows 95, 98 or Me by clicking Start, Run, and then typing “winipcfg”, and selecting the adapter, or in Windows NT, 2000, and XP by opening a DOS Window (click Start, Programs, Accessories, Command Prompt) and typing “ipconfig/all”.

When an application such as a web browser sends a request for data onto the network, the Application layer request comes down to the MAC SAP as an MSDU. The MSDU is extended with a MAC header that includes the MAC address of the source device’s network adapter.

When the requested data is transmitted back onto the network, the original source address becomes the new destination address and the network adapter of the original requesting device will detect packets with its MAC address in the header, completing the round trip.

Media Access Control in Wired Networks

If two devices transmit at the same time on a network’s shared medium, whether wired or wireless, the two signals will interfere and the result will be unusable to both devices. Access to the shared medium therefore needs to be actively managed to ensure that the available bandwidth is not wasted through repeated collisions of this type. This is the main task of the MAC layer.

Carrier Sense Multiple Access/Collision Detection (CSMA/CD)

The most commonly used MAC method to control device transmission, and the one specified for Ethernet based networks, is Carrier Sense Multiple Access/Collision Detection (CSMA/CD).

When a device has a data frame to transmit onto a network that uses this method, it first checks the physical medium (carrier sensing) to see if any other device is already transmitting. If the device senses another transmitting device it waits until the transmission has finished.

As soon as the carrier is free it begins to transmit data, while at the same time continuing to listen for other transmissions. If it detects another device transmitting at the same time (collision detection), it stops transmitting and sends a short jam signal to tell other devices that a collision has occurred.

Each of the devices that were trying to transmit then computes a random backoff period within a range 0 to tmax, and tries to transmit again when this period has expired. The device that by chance waits the shortest time will be the next to gain access to the medium, and the other devices will sense this transmission and go back into carrier sensing mode.

A very busy medium may result in a device experiencing repeated collisions. When this happens tmax is doubled for each new attempt, up to a maximum of 10 doublings, and if the transmission is unsuccessful after 16 attempts the frame is dropped and the device reports an “excessive collision error”.

Other Wired Network MAC Methods

Another common form of media access control for wired networks, defined by the IEEE 802.5 standard, involves passing an electronic “token” between devices on the network in a pre-defined sequence. The token is similar to a baton in a relay race in that a device can only transmit when it has captured the token.

If a device does not need control of the media to transmit data it passes the token on immediately to the next device in the sequence, while if it does have data to transmit it can do so once it receives the token. A device can only keep the token and continue to use the media for a specific period of time, after which it has to pass the token on to the next device in the sequence.

Media Access Control in Wireless Networks

The collision detection part of CSMA/CD is only possible if the PHY layer transceiver enables the device to listen to the medium while transmitting. This is possible on a wired network, where invalid voltages resulting from collisions can be detected, but is not possible for a radio transceiver since the transmitted signal would overload any attempt to receive at the same time.

In wireless networks such as 802.11, where collision detection is not possible, a variant of CSMA/CD known as CSMA/CA is used, where the CA stands for Collision Avoidance. Apart from the fact that collisions are not detected by the transmitting device, CSMA/CA has some similarities with CSMA/CD. Devices sense the medium before transmitting and wait if the medium is busy.

The duration field in each transmitted frame enables a waiting device to predict how long the medium will be busy. Once the medium is sensed as being idle, waiting devices compute a random time period, called the contention period, and attempt to transmit after the contention period has expired.

This is a similar mechanism to the back-off in CSMA/CD, except that here it is designed to avoid collisions between stations that are waiting for the end of another station’s transmitted frame rather than being a mechanism to recover after a detected collision.