In the layered network model, the (data) link layer is responsible for transferring datagrams between physically adjacent nodes in the network over a link
- We define a link as a communication channel that directly connects physically adjacent nodes. This can be wired (Ethernet), wireless (WiFi), or via a LAN. In general, a datagram can take many different link types on the way to its destination.
- A packet in the link layer is called a frame, and it functions to encapsulate a datagram.
A few key services are done in the link layer:
- Framing will encapsulate a datagram into a frame, adding a header and trailer.
- Link access will access the channel, which can be complicated (regulation, coordination) especially if many nodes share the channel. MAC addresses in the frame headers identify the source and destination (but are not used network-wide, like IP addresses).
- Reliable delivery between adjacent nodes is seldom used on low bit-error links. They are used in wireless links, which are high-error because of EMI and noise.
- Flow control matches the pacing between adjacent sending and receiving nodes, so that buffers aren’t overflowed.
- Error detection finds errors caused by signal attenuation or noise. The receiver will detect errors and possibly drop the frame.
- Error correction will be done after errors are identified. This avoids re-transmission!
- Some links allow for half-duplex (one-way at a time) and full-duplex (2-ways at the same time).
Part of the link layer is implemented in software, and some in hardware.
- Each host has a network interface card that implements the link or physical layer.
- Like an Ethernet or WiFi card/chip.
- This attaches into the host’s system buses. In general, this is a combination of hardware, software, and firmware.
The general workflow then, is:
- On the sending side
- Datagrams are encapsulated in the frame.
- Error checking bits are added, schemes for reliable data transfer, flow control, etc. are also added.
- On the receiving side
- Checks for errors, reliable data transfer, flow control, etc.
- Extracts the datagram, then passes it to the upper layer at the receiving side.
The IEEE 802.3 frame structure is an example of what it could look like.
