ECE 421: Digital Communication
Flow and Error Control
Lecturer: Dr. Shimaa Salama
References
Behrouz A. Forouzan “Data Communication and
Networking” (3rd Edition), McGraw Hill, 2004.
Flow Control
Whenever an entity produces items and another entity consumes
them, there should be a balance between production and
consumption rates.
If the items are produced faster than they can be consumed, the
consumer can be overwhelmed and may need to discard some
items.
If the items are produced more slowly than they can be consumed,
the consumer must wait, and the system becomes less efficient.
Flow control is related to the first issue. We need to prevent losing
the data items at the consumer site.
Flow Control
Flow control is one of the most important duties of the data link
layer.
Flow control coordinates the amount of data that can be sent before
receiving an acknowledgment.
In most protocols, flow control is a set of procedures that tells the
sender how much data it can transmit before it must wait for an
acknowledgment from the receiver.
The flow of data must not be allowed to overwhelm the receiver.
Flow Control
Any receiving device has a limited speed at which it can process
incoming data and a limited amount of memory (buffer) in which
to store incoming data.
The receiving device must be able to inform the sending device
before those limits are reached and to request that the transmitting
device send fewer frames or stop temporarily.
Producer Consumer
Error Control
Error control is both error detection and error correction.
Error control allows the receiver to inform the sender of any frames
lost or damaged in transmission and coordinates the retransmission
of those frames by the sender.
In the data link layer, the term error control refers primarily to
methods of error detection and retransmission.
Any time an error is detected in an exchange, specified frames are
retransmitted. This process is called automatic repeat request
(ARQ).
HDLC
High-Level Data Link Control (HDLC) is an actual protocol
designed to support both half-duplex and full-duplex
communication over point to point and multipoint links.
HDLC implements the ARQ mechanisms.
Configurations and Transfer Modes
HDLC provides two common transfer modes that can be used in
different configurations: Normal Response Mode (NRM) and
Asynchronous Balanced Mode (ABM).
NRM
In Normal Response Mode (NRM), the station configuration is unbalanced.
HDLC
Configurations and Transfer Modes
NRM
We have one primary station and multiple secondary stations. A primary
station can send commands; a secondary station can only respond.
The NRM is used for both point-to-point and multipoint links.
HDLC
Configurations and Transfer Modes
ABM
In ABM, the configuration is balanced.
The link is point-to-point, and each station can function as a
primary and a secondary.
HDLC
Frames
HDLC defines three types of frames: information frames (I-
frames), Supervisory frames (S-frames), and Unnumbered frames
(U-frames).
I-frames are used to transport user data and control information
relating to user data (piggybacking).
S-frames are used only to transport control information.
U-frames are reserved for system management. Information
carried by U-frames is intended for managing the link itself.
HDLC
Frame Format
Control field is The frame
used for flow check sequence
and error control (FCS) is an
error detection
field
Information field
contains the user's
data or management
information.
HDLC
Control Field
Control Field for I-Frames
I-frames are designed to carry user data, in addition, they can
include flow and error control information (piggybacking).
The first bit is 0, this means the frame is an I-frame.
HDLC
Control Field
Control Field for I-Frames
The next 3 bits, called N(S), define the sequence number of the
frame in travel.
With 3 bits, we can define a sequence number between 0 and 7;
but in the extension format, in which the control field is 2 bytes,
this field is larger.
The value of this field corresponds to the value of control
variable S in the three ARQ mechanisms.
HDLC
Control Field
Control Field for I-Frames
The next bit is called the P/F bit. The P/F field is a single bit with
a dual purpose. It has meaning only when it is set (bit = 1) and can
mean poll or final. It means poll when the frame is sent by a
primary station to a secondary. It means final when the frame is
sent by a secondary to a primary.
The last 3 bits, called N(R), correspond to the acknowledgment
number when piggybacking is used.
HDLC
Control Field
Control Field for S-Frames
S-frames are used only to transport control information.
Supervisory frames are used for flow and error control whenever
piggybacking is either impossible or inappropriate (e.g., when the
station either has no data of its own to send or needs to send a
command or response other than an acknowledgment).
S-frames do not have information fields.
HDLC
Control Field
Control Field for S-Frames
The first 2 bits of the control field is 10, this means the frame is an
S-frame.
The fifth bit is the P/F bit.
The last 3 bits, called N(R), correspond to the acknowledgment
number (ACK) or negative acknowledgment number (NAK).
The second 2 bits is a code that defines the four types of S-frames:
Receive Ready (RR), Receive Not Ready (RNR), Reject (REJ),
and Selective Reject (SREJ).
HDLC
Control Field
Control Field for S-Frames
Receive Ready (RR):
If the value of the code subfield is 00, it is an RR S-frame.
This kind of frame acknowledges the receipt of a safe and sound
frame or group of frames.
In this case, the value N(R) field defines the acknowledgment
number.
HDLC
Control Field
Control Field for S-Frames
Receive not ready (RNR)
If the value of the code subfield is 10, it is an RNR S-frame.
This kind of frame is an RR frame with additional functions. It
acknowledges the receipt of a frame or group of frames, and it
announces that the receiver is busy and cannot receive more frames.
It acts as a kind of congestion control mechanism by asking the
sender to slow down.
The value of N(R) is the acknowledgment number.
HDLC
Control Field
Control Field for S-Frames
Reject (REJ):
If the value of the code subfield is 01, it is a REJ S-frame.
This is a NAK frame, but not like the one used for Selective
Repeat ARQ. It is a NAK that can be used in Go-Back-N ARQ to
improve the efficiency of the process by informing the sender,
before the sender time expires, that the last frame is lost or
damaged.
The value of N(R) is the negative acknowledgment number.
HDLC
Control Field
Control Field for S-Frames
Selective reject (SREJ):
If the value of the code subfield is 11, it is an SREJ S-frame.
This is a NAK frame used in Selective Repeat ARQ.
The value of N(R) is the negative acknowledgment number.
HDLC
Control Field
Control Field for U-Frames
U-frames are reserved for system management (exchange session
management and control information between connected devices).
Information carried by U-frames is intended for managing the link
itself.
U-frame codes are divided into two sections: a 2-bit prefix before the
P/F bit and a 3-bit suffix after the P/F bit. Together, these two
segments (5 bits) can be used to create up to 32 different types of U-
frames.
HDLC
Control Field
Control Field for U-Frames
HDLC
Example: Piggybacking without Error
N(R) N(S)
HDLC
Example: Piggybacking without Error
Station A begins the exchange of information with an I-frame
numbered 0 followed by another I-frame numbered 1.
Station B piggybacks its acknowledgment of both frames onto an
I-frame of its own.
Station B’s first I-frame is also numbered 0 [N(S) field] and
contains a 2 in its N(R) field, acknowledging the receipt of A’s
frames 1 and 0 and indicating that it expects frame 2 to arrive next.
HDLC
Example: Piggybacking without Error
Station B transmits its second and third I-frames (numbered 1 and
2) before accepting further frames from station A. Its N(R)
information, therefore, has not changed: B frames 1 and 2 indicate
that station B is still expecting A frame 2 to arrive next.
Station A has sent all its data. Therefore, it cannot piggyback an
acknowledgement onto an I-frame and sends an S-frame instead.
The RR code indicates that A is still ready to receive.
The number 3 in the N(R) field tells that frames 0, 1, and 2 have all
been accepted and that A is now expecting frame number 3.
HDLC
Example: Piggybacking with Error
Discard
HDLC
Example: Piggybacking with Error
Suppose frame 1 sent from station B to station A has an error
and the system is using the Go-Back-N mechanism.
Station A informs station B to resend frames 1 and 2.
Station A sends a reject supervisory frame to announce the error
in frame 1.