Computer Communication Networks CS-418: Lecture 2 - 1 Data Link Layer - Framing Techniques
Computer Communication Networks CS-418: Lecture 2 - 1 Data Link Layer - Framing Techniques
CS-418
Lecture 2 – 1
Data Link Layer – Framing Techniques
• We will refer any device that runs a link layer (i.e., layer 2)
protocol as a node.
• Nodes include hosts, routers or switches, and Wi-Fi access
points.
• We will also refer to the communication channels that connect
adjacent nodes along the communication path as links.
• In order for a datagram to be transferred from source host to
destination host, it must be moved over each of the individual
links in the end-to-end path.
• Over a given link, a transmitting node encapsulates the datagram
in a link layer frame and transmits the frame into the link.
Spring Semester 2021 4
Introduction to the Link Layer
• Data Link layer has number of specific functions it can carry out.
These include:
• Link access:
• A medium access control (MAC) protocol specifies the rules by which
a frame is transmitted onto the link.
• For point to point links that have a single sender at one end of the
link and a single receiver at the other end of the link, the MAC
protocol is simple – the sender can send a frame whenever the link is
idle.
• When multiple nodes share a single broadcast link the MAC protocol
serves to coordinate the frame transmissions of the many nodes.
• Data Link layer has number of specific functions it can carry out.
These include:
• Error detection and correction:
• The link layer hardware in a receiving node can incorrectly decide that a bit in a
frame is zero when it was transmitted as a one, and vice versa.
• Such bit errors are introduced by signal attenuation and electromagnetic noise.
Because there is no need to forward a datagram that has an error, many link
layer protocols provide a mechanism to detect such bit errors.
• This is done by having the transmitting node include error detection bits in the
frame, and having the receiving node perform an error check.
• Error detection in the link layer is usually implemented in hardware.
• Error correction is similar to error detection, except that a receiver not only
detects when bit errors have occurred in the frame but also determines exactly
where in the frame the errors have occurred (and then corrects these errors).
Spring Semester 2021 9
Services Provided by the Link Layer
• Data Link layer has number of specific functions it can carry out.
These include:
• Flow Control:
• The nodes on each side of a link have a limited amount of buffering
capacity.
• This is a potential problem, as a receiving node may receive frames
at a rate faster than it can process the frames (over some time
interval).
• Without flow control, the receiver's buffer can overflow and frames
can get lost.
• Similar to the transport layer, a link layer protocol can provide flow
control in order to prevent the sending node on one side of a link
from overwhelming the receiving node on the other side of the link.
Spring Semester 2021 10
Where is Link Layer Implemented
• It is implemented in a
network adapter, or
sometimes known as a
network interface card (NIC).
• The controller in the NIC , is
usually a single, special-
purpose chip that implements
many of the link-layer services
(framing, link access, error
detection, etc.).
• The data Link layer takes the packet from the network layer and
encapsulates them in frames for transmission.
• Each frame contains a frame header, a payload field for holding
the packet, and a frame trailer.
• The data link layer breaks the bit stream up into discrete frames and
compute the checksum for each frame.
• When a frame arrives at the destination, the checksum is recomputed.
• If the newly computed checksum is different from the one contained in the
frame, the data link layer knows that an error has occurred and takes steps
to deal with it.
• One way to achieve this framing is to insert time gaps between frames,
much like the spaces between words in ordinary text.
• However, networks rarely make any guarantees about timing, so it is
possible these gaps might be squeezed out or other gaps might be inserted
during transmission.
FLAG
FLAG HEADER
HEADER PAYLOAD
PAYLOAD TRAILER FLAG
Original Data
After Stuffing
At Receiver