Where Is Link Layer Implemented

Where Is Link Layer Implemented

For the most part, the link layer is implemented in a network adapter, also sometimes known as a Network Interface Card (NIC).

At the heart of the network adapter is the link layer controller, usually a single, special purpose chip that implements many of the link layer services (framing, link access, error detection etc.). Thus, much of a link layer controller’s functionality is implemented in hardware.

For example, Intel’s 8254x controller implements the Ethernet protocols, the Atheros AR5006 controller implements the 802.11 WiFi protocols.

Until the late 1990s most network adapters were physically separate cards (such as PCMCIA card or a plug-in card fitting into a PC’s PCI card slot) but increasingly, network adapters are being integrated onto the host’s motherboard – a so called LAN-on-motherboard configuration.

On the sending side, the controller takes a datagram that has been created and stored in host memory by the higher layers of the protocol stack, encapsulates the datagram in a link layer frame (filling in the frame’s various fields), and then transmits the fame into the communication link, following the link access protocol. On the receiving side, a controller receivers the entire frame, and extracts the network layer datagram. If the link layer performs error detection , then it is the sending controller that sets the error detection bits in the frame header and it is the receiving controller that performs the error detection.

The figure below show a network adapter attaching to a host’s bus (e.g. a PCI or PCI-X bus), where it looks much like any other I/O device to the other host components.

Where Is Link Layer Implemented

The above figure also shows that while most of the link layer is implemented in hardware, part of the link layer is implemented in software that runs on the host’s CPU.

The software components of the link layer implement higher-level link layer functionality such as assembling link layer addressing information and activating the controller hardware.

On the receiving side, link layer software responds to controller interrupts (e.g. due to the receipt of one or more frames), handling error conditions and passing a datagram up to the network layer. Thus, the link layer is a combination of hardware and software – the place in the protocol stack where software meets hardware.