You are on page 1of 81

COE 341: Data & Computer Communications (T062)

Dr. Marwan Abu-Amara


Chapter 7:
Data Link Control Protocols
COE 341 Dr. Marwan Abu-Amara 2
Contents
1. Error Control
a. Stop-and-Wait ARQ
b. Go-Back-N ARQ
c. Selective-Reject ARQ
2. Flow Control
a. Stop-and-Wait flow control
b. Sliding-Window flow control
3. High-Level Data Link (HDLC)
COE 341 Dr. Marwan Abu-Amara 3
What is Data Link Control
The logic or procedures used to convert the raw
stream of bits provided by the physical layer into a
reliable connection
Requirements and Objectives:
Frame synchronization
Error control
Flow control
Addressing
Multiplexing data and control on connection
Link management
COE 341 Dr. Marwan Abu-Amara 4
Error & Flow Control
We now study two main functions of the data-
link layer
Error control
Flow control
Why Error & Flow Control together?
We usually lump Error Control and Flow Control
discussions together because the data-link
protocols used for error control are also used for
flow control
COE 341 Dr. Marwan Abu-Amara 5
Error Control Definition
Error Control is the second type of methods used to
handle errors in frames
First type is FEC
Error Control methods are those that use
retransmission in the case an error occurs in a frame
This process is called Automatic Repeat Request (ARQ)
In general, a retransmission is needed if a:
Frame is erroneous
Frame is lost (i.e. does not arrive or arrives too late)
There are several reasons for this to happen (e.g. existence of
noise, network congestion)
COE 341 Dr. Marwan Abu-Amara 6
Flow Control Definition
We define Flow Control as: The set of
procedures used to restrict the amount of
data that a TX can send before waiting for an
acknowledgement from the RX (per
Forouzan)
This is to avoid overwhelming the RX by the flow
of data from TX
RX does not absorb the received data instantly
It buffers (temporarily stores) the data it receives to do
some processing before sending it upward to higher
layers
Without flow control, the RX buffer may overflow and
data gets lost
COE 341 Dr. Marwan Abu-Amara 7
Flow Control

Assume:
No frames lost
No frames arrive in error
Frames arrive in the same order they were sent,
following a variable propagation delay
COE 341 Dr. Marwan Abu-Amara 8
A Model of Frame Transmission
Loss
Error
Only one frame
traveling on the link
at any given time
COE 341 Dr. Marwan Abu-Amara 9
Error & Flow Control Protocols
There are three main types of error control
protocols (ARQ-based):
Stop-and-Wait ARQ
Sliding Window ARQ
Go-back-N ARQ
Selective-Reject ARQ
There are two main types of flow control
protocols:
Stop-and-Wait
Sliding Window
COE 341 Dr. Marwan Abu-Amara 10
Categories of Error Control
COE 341 Dr. Marwan Abu-Amara 11
Categories of Flow Control
COE 341 Dr. Marwan Abu-Amara 12
Stop-and-Wait ARQ
Stop-and-Wait ARQ is a simple protocol:
TX keeps a copy of the last frame sent
After receiving the frame, RX sends back an ACK
After receiving this ACK, TX sends another frame
and so on
Both Data & ACK frames are alternately
numbered with 0 or 1
Data Frame 0 is acknowledged by ACK 1
Data Frame 1 is acknowledged by ACK 0
COE 341 Dr. Marwan Abu-Amara 13
Stop-and-Wait ARQ: Normal Operation
COE 341 Dr. Marwan Abu-Amara 14
Stop-and-Wait ARQ: Abnormal Operation
Stop-and-Wait ARQ deals with encountered
anomalies as follows:
Lost or Damaged Frames: RX discards them silently
i.e. without sending Negative-ACK (NACK) back to
TX
RX keeps its current value for R (R var. defined on prev.
slide)
Lost or Damaged ACK:
TX discards damaged ACK
TX keeps a timer, after sending a frame, within which ACK
must be received. Otherwise, ACK is considered lost.
In both situations, Lost and Damaged ACK, the TX sends
the frame again
COE 341 Dr. Marwan Abu-Amara 15
Stop-and-Wait ARQ: Lost Frame
COE 341 Dr. Marwan Abu-Amara 16
Stop-and-Wait ARQ: Lost ACK
COE 341 Dr. Marwan Abu-Amara 17
Stop-and-Wait ARQ: Delayed ACK
Another abnormality: TX receiving a late ACK
Timer has already expired
The ACK was considered lost
Frame is re-sent again
This frame will be duplicate at RX and discarded
Also its ACK will be discarded when received back at TX
Then the late ACK arrives
Now TX can send the next frame
COE 341 Dr. Marwan Abu-Amara 18
Stop-and-Wait ARQ: Delayed ACK
Lost
COE 341 Dr. Marwan Abu-Amara 19
Stop-and-Wait ARQ Piggybacking
Piggybacking is a method
that combines the data
and the ACK in one frame
It is useful in bidirectional
communications
Stations can send their
data along with ACK to
data previously received
Piggybacking is faster
and saves bandwidth
COE 341 Dr. Marwan Abu-Amara 20
Stop-and-Wait ARQ Drawback
In Stop-and-Wait ARQ, the line is not efficiently
utilized because only one frame is sent at a time
Its ACK must be awaited for
During this waiting period no frames are sent
Inefficiency gets even worse when
TX speed is high
TX quickly sends frame then sits idle
Propagation distance is high
It takes longer for the frame and its ACK to reach destination
Both cases leave the TX waiting idle for longer times
COE 341 Dr. Marwan Abu-Amara 21
Stop-and-Wait Efficiency
Let:
T
f
: Time to transmit a frame = L
f
/ R
T
ACK
: Time to transmit an ACK = L
ACK
/ R
T
Prop
: Propagation time = (link distance) / V
T
Proc
: Processing time
We define the frame total time as (see next
slide):
T
total
= T
f
+ 2 T
Prop
+ T
Proc
+ T
ACK

The utilization of the link is defined as:
U = (T
f
)/(T
total
)
COE 341 Dr. Marwan Abu-Amara 22
Stop-and-Wait Efficiency
It is common to ignore T
Proc
and T
ACK

because they are negligible compared
to other times
In which case the utilization becomes:
U = (T
f
)/(T
f
+2T
prop
) = 1/(1 + 2a)
Where: a = T
prop
/T
f
a is called the length of the link in bits: length
of medium in bits compared to frame length (L
f
)
Notice that for very small a (i.e. when 1
st

transmitted bit reaches RX, source will still
be transmitting), U 100%
Notice that for very big a (i.e. frame
transmission is completed before 1st bit
reaches destination), U 0%
Efficient for links where a << 1 (long
frames on a short link, i.e. fills link)
TX RX
T
f
T
prop
T
prop
T
proc
T
ACK
COE 341 Dr. Marwan Abu-Amara 23
Stop and Wait Efficiency: Example
Compare the efficiency of stop-and-wait error control for two
links using the parameter a:
Fame size, L = 1000 characters of 8 bits each, = 8000 bits
200-m optical fiber link
Data rate, R = 1 Gbps
Typical wave velocity, V = 2 x 10
8
m/s



Frame TX time, t
f
= L/R = 8000/(1x10
9
)
= 8 s
Propagation time, t
prop
= d/V
= 200/(2x10
8
) = 1 s


End of first frame reaches RX after
8+1 = 9 s from start
ACK takes 1 s more to reach TX,
which sends 2
nd
frame after 10 s
Utilization = 8/10 = 80% (=1/(2a+1))
8
9
200
2 10
0.125
8000
1 10
prop
f
d
T
V
a
L
T
R

= = = =

Satellite link between 2 ground stations


d = 2 x 36,000 km, Data rate, R = 1 Mbps
Typical wave velocity, V = 3 x 10
8
m/s



Frame TX time, t
f
= L/R = 8000/(1x10
6
)
= 8 ms
Propagation time, t
prop
= d/V
= 2x36x10
6
/(3x10
8
) = 240 ms


End of first frame reaches RX after
8+240 = 248 s from start
ACK takes 240 ms more to reach TX,
which sends 2
nd
frame after 488 ms
Utilization = 8/488 = 1.6% (=1/(2a+1))
6
8
6
2 36 10
3 10
30
8000
1 10
prop
f
d
T
V
a
L
T
R

= = = =

COE 341 Dr. Marwan Abu-Amara 24


Sliding Window Protocol
Stop-and-Wait can be very inefficient when a > 1
Protocol:
Assumes full duplex line
Source A and Destination B have buffers each of size W frames
For k-bit sequence numbers:
Frames are numbered: 0, 1, 2, , 2
k
-1, 0, 1, (modulo
2
k
)
ACKs (RRs) are numbered: 0, 1, 2, , 2
k
-1, 0, 1,
(modulo 2
k
)
A is allowed to transmit up to W frames without waiting for an ACK
B can receive up to W consecutive frames
ACK J (or RR J), where 0 s J s 2
k
-1, sent by B, means B has
received frames up to frame J-1 and is ready to receive frame J
B can also send RNR J: B has received all frames up to J-1 and is
not ready to receive any more
Window size W, can be less or equal to 2
k
-1
COE 341 Dr. Marwan Abu-Amara 25
Sliding Window Protocol
Example of Sliding-Window-Protocol: k = 3 bits, W = 7
Observations:
A may Tx W = 7 frames
(F0, F1, , F6)
After F0, F1, & F2 are Tx-
ed, window is shrunk (i.e.
can not transmit except
F3, F4, , F6)
When B sends RR3, A
knows F0, F1 & F2 have
been received and B is
ready to receive F3
Window is advanced to
cover 7 frames (starting
with F3 up to F1)
A sends F3, F4, F5, & F6
B responds with RR4
when F3 is received A
advances the window by
one position to include F2
W
W
W
W
W = distance between first unacknowledged
frame and last frame that can be sent
COE 341 Dr. Marwan Abu-Amara 26
Go-back-N ARQ
Go-back-N ARQ improves the efficiency of the line by
sending up to W frames before worrying about ACK
This is called Pipelining (several tasks are started before the
1
st
is finished)
For this, the frames must be sequentially numbered
Sequence number must be included in the header of
the frame
If m bits are reserved for sequence number then the
sequence numbers range from 0 to 2
m
1
Example:
m = 3 bits, then seq. numbers range is 0-7 and could be used
as:
0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1,
COE 341 Dr. Marwan Abu-Amara 27
Go-back-N ARQ Sliding Window
At the TX side, to hold the outstanding frames until
they are individually ACK, we use a window
The window size W cannot exceed 2
m
1
W is fixed in this protocol but may be variable in others (e.g.
TCP)
Each time a proper ACK is received for a frame the
window slides past this frame, hence the name
Sliding Window
The acknowledged frames can be purged out of the TX
memory
As an example, next slide shows that frame 0 and 1
have been acknowledged
So the sliding window slides just past them in (b)
COE 341 Dr. Marwan Abu-Amara 28
TX Sliding Window
In (b), frame 0 and frame 1 were properly acknowledged
COE 341 Dr. Marwan Abu-Amara 29
RX Sliding Window
At the RX side, the size of the window is
always 1
The RX window is centered on the next
expected frame number
If any other frame arrives (i.e. out of sequence
arrival), it is immediately discarded
If the right frame arrives, the window slides
past it to zoom on the next expected frame
COE 341 Dr. Marwan Abu-Amara 30
RX Sliding Window
COE 341 Dr. Marwan Abu-Amara 31
Go-back-N ARQ Control Variables
TX keeps track of three variables
S: Sequence number of the recently sent frame
S
F
: Sequence number of the first frame in the window
S
L
: Sequence number of the last frame in the window
The frame size W is related to these variables by:
W = S
L
S
F
+ 1
On the other hand the RX has only one variable:
R: Expected frame sequence number
COE 341 Dr. Marwan Abu-Amara 32
Go-back-N ARQ: TX & RX Control Variables
COE 341 Dr. Marwan Abu-Amara 33
Timers & Acknowledgments
TX sets a timer for each frame sent
RX has no timers
RX sends an ACK if a frame arrives with no errors and in order
If RX receives damaged or out of sequence frame, it silently
discards them until it receives the expected frame
The silence of the RX causes the TX timer to expire
This in turn causes the TX to go back and send all frames starting
from the non-acknowledged frame
This is why it is called Go-back-N ARQ
Example:
If TX has already sent frame-6 but the timer for frame-3 expires
without receiving an ACK for it, the TX goes back and send frames
3, 4, 5, 6
COE 341 Dr. Marwan Abu-Amara 34
Go-back-N ARQ Normal Operation
COE 341 Dr. Marwan Abu-Amara 35
Go-back-N ARQ Lost Frame Operation
Here, ACK2 acknowledges
frames 0 & 1 at the same time

COE 341 Dr. Marwan Abu-Amara 36
Quiz: Window Size Condition for Go-back-N
ARQ
Earlier, we mentioned
that the size of the
window must be W s 2
m

1 i.e. W < 2
m
where
m is the number of bits
reserved (in the frame
overhead) for the
sequence number
By comparing the
figures across explain
the need for this
condition
COE 341 Dr. Marwan Abu-Amara 37
Sliding Window Protocol
Animation for Sliding Window protocol
Sliding Window Protocol Simulation
(http://www.cs.stir.ac.uk/~kjt/software/comms/jasper/S
WP3.html)
COE 341 Dr. Marwan Abu-Amara 38
Two neighboring nodes (A and B) use a sliding-
window protocol with a 3-bit sequence number. As
the ARQ mechanism, go-back-N is used with a
window size of 4. Assuming A is transmitting and B
is receiving, show the window positions for the
following succession of events:
a) Before A sends any frames
b) After A sends frame 0, 1, 2 and B acknowledges 0, 1
and the ACKs are received by A
c) After A sends frames 3, 4, and 5 and B
acknowledges 4 and the ACK is received by A
Example: Problem 7-9
COE 341 Dr. Marwan Abu-Amara 39
Example: Problem 7-9 - Solution
a)
0 1 2 3 4 5 6 7 0


b)
0 1 2 3 4 5 6 7 0


c)
0 1 2 3 4 5 6 7 0


W
W
W
COE 341 Dr. Marwan Abu-Amara 40
Sliding Window Protocol - Piggybacking
When using sliding window protocol in full
duplex connections:
Node A maintains its own transmit window
Node B maintains its own transmit window
A frame contains: data field + ACK field
There is a sequence number for the data field, and a
sequence number for the ACK field
COE 341 Dr. Marwan Abu-Amara 41
Selective-Repeat ARQ
Go-back-N ARQ simplifies the job of the RX
RX keeps track of one control variable R only
Out-of-sequence frames are simply dropped, not buffered
However, this protocol is inefficient for noisy links
where the probability of damaged frames is high
This means many retransmissions will occur which uses up
the bandwidth of the link
For noisy links, a more efficient mechanism is used in
which only the damaged frame is retransmitted (not
all N frames)
It is called Selective-Repeat ARQ
COE 341 Dr. Marwan Abu-Amara 42
Selective-Repeat ARQ TX & RX Windows
Window configuration for the TX is the same as for
Go-back-N ARQ
However, the window size should be W s ( 2
m
) i.e. W s
2
(m-1)

RX window must have the same size as the TX
This a major difference with Go-back-N ARQ where window
W = 1 for the RX
RX window specifies a range of a acceptable frame
sequence numbers
Also, in selective-repeat ARQ the RX uses negative
ACK (NACK) to report the sequence of a damaged
frame to the TX
COE 341 Dr. Marwan Abu-Amara 43
Selective-Repeat ARQ: TX & RX Control Variables
Here, S = S
F
COE 341 Dr. Marwan Abu-Amara 44
Selective-Repeat ARQ Operation: Lost Frame
Example
Here, ACK2 acknowledges
frames 0 & 1 at the same time

COE 341 Dr. Marwan Abu-Amara 45
Quiz: Window Size Condition for Selective-
Repeat ARQ
Earlier, we mentioned
that the size of the
window must be W s
2
m 1
where m is the
number of bits reserved
(in the frame overhead)
for the sequence
number
By comparing the
figures across explain
the need for this
condition
COE 341 Dr. Marwan Abu-Amara 46
Sliding Window Protocol - Efficiency
Refer to Appendix A
When window size is W (for error free), link utilization,
U, is given by




where a = T
prop
/T
f
(i.e. length of link in bits)
Sliding window protocol can achieve 100% utilization if
W > (2a + 1)
The smaller the W needed the better! (Why?)
To get high value for U, small value for a is needed as well !!
1 (2 1)
(2 1)
2 1
W a
U
W
W a
a
> +

< +

+
COE 341 Dr. Marwan Abu-Amara 47
Sliding Window Efficiency: Example
Compare the efficiency of Sliding Window flow control for two
links using the parameter a:
Fame size, L = 1000 characters of 8 bits each, = 8000 bits
200-m optical fiber link
Data rate, R = 1 Gbps
Typical wave velocity, V = 2 x 10
8
m/s
Frame TX time, t
f
= L/R = 8 s
Propagation time, t
prop
= d/V = 1 s


a = t
prop
/ t
f
= 0.125
100 % link utilization is achieved with
window size W:
W > (2 a+1) > (2 x 0.125 +1) > 1.25
i.e. W = 2 (A window of just 2 frames)
Satellite link between 2 ground stations
d = 2 x 36,000 km, Data rate, R = 1 Mbps
Typical wave velocity, V = 3 x 10
8
m/s
Frame TX time, t
f
= L/R = 8 ms
Propagation time, t
prop
= d/V = 240 ms


a = t
prop
/ t
f
= 30
100 % link utilization is achieved with
window size W:
W > (2 a+1) > (2 x 30 +1) > 61
W = 61, k = 6 bit
(Large window and buffer sizes)
For k = 3 bits, W = 7:
Utilization U = W/(2a+1) = 7/(61)
= 11.5% > 1.6% for Stop and wait.
COE 341 Dr. Marwan Abu-Amara 48
Stop-and-Wait & Sliding Window as Flow
Control Protocols
Problem:
Qualitatively explain how the Stop-and-Wait and
the Sliding Window protocols could be used for
flow control
Hint:
Think about the use of ACK and when the RX could
send it back to the TX
COE 341 Dr. Marwan Abu-Amara 49
High-Level Data Link Control Protocol (HDLC)
One of the most important data link control protocols
and it is the basis for many data link control protocols.
The job of the HDLC layer (Link Layer, Layer 2) is to
ensure that data passed up to the next layer has
been received exactly as transmitted (i.e error free,
without loss and in the correct order)
Another important job is flow control, which ensures
that data is transmitted only as fast as the receiver
can receive it.
There are two distinct HDLC implementations
HDLC NRM (see (SDLC), and
HDLC Link Access Procedure Balanced (LAPB)
Usually when referring to HDLC people mean LAPB
or some variation
COE 341 Dr. Marwan Abu-Amara 50
High-Level Data Link Control Protocol (HDLC)
To satisfy a variety of applications, HDLC defines
three types of stations, two link configurations, and
three types of data transfer modes of operation.
Station types:
Primary Station (PS):
Responsible for controlling the operation of the link
Frames issued by the PS are called commands
Secondary Station (SS): Frames issued by the SS are called
responses operates under the control of a primary station
Combined Station: issues commands and responses
Link configurations:
Unbalanced: one primary plus one or more secondary
Balanced: two combined stations
COE 341 Dr. Marwan Abu-Amara 51
High-Level Data Link Control Protocol (HDLC)
Transfer modes:
Normal Response Mode (NRM) used in
unbalanced config.; secondary may only tx data in
response to a command from primary
Asynchronous Response Mode (ARM) used in
unbalanced config.; Secondary may initiate data tx
without explicit permission; primary still retains line
control (initialization, error recovery, )
Asynchronous Balanced Mode (ABM) used in
balanced config.; either combined station may tx
data without receiving permission from other station
Animation for HDLC
COE 341 Dr. Marwan Abu-Amara 52
HDLC Applications
NRM:
Point-multipoint (multi-drop line): one computer
(primary) polls multiple terminals (secondary
stations)
number of terminals are connected to a host computer
ARM: rarely used
ABM: most widely used (no polling involved)
Full duplex point-to-point
COE 341 Dr. Marwan Abu-Amara 53
HDLC NRM
COE 341 Dr. Marwan Abu-Amara 54
HDLC ABM
COE 341 Dr. Marwan Abu-Amara 55
HDLC Frame Structure
COE 341 Dr. Marwan Abu-Amara 56
HDLC Frame Format
Flag:
Size: 1 Byte
Special pattern 0 1 1 1 1 1 1 0 used as frame begin/end and synch.
Used in Header and trailer
Address:
Size: 1 Byte (or more for larger networks)
If primary station created the frame, the address is that of the destination
secondary station
If secondary station created the frame, the address is that of the source
secondary station
Networks not using primary/secondary (e.g. Ethernet) use 2-Byte address
(source/destination)
Control:
Size: 1 or 2 Bytes
Used for error & flow control
Information:
Size: Varies from network to network. Always fixed within a network
Contains user data from Network layer or Network Management information
FCS:
Size: 2 or 4 Bytes
Implements ITU-T CRC for error detection
COE 341 Dr. Marwan Abu-Amara 57
HDLC Frame Structure Flag Field
Flag Field: unique pattern 01111110
Used for synchronization
To prevent this pattern form occurring in data bit stuffing
procedure is used
Tx-er inserts a 0 after each 5 1s
Rx-er, after detecting flag, monitors incoming bits when a pattern of
5 1s appears; the 6
th
/7
th
bit are checked:
If 0, it is deleted
If 10, this is a flag
If 11, this is an ABORT
Pitfalls of bit stuffing: one bit errors can split one frame into two or
merge two frames into one
COE 341 Dr. Marwan Abu-Amara 58
HDLC Data Transparency
If the data field of an HDLC frame contains a
pattern identical to the flag pattern (01111110),
the RX will interpret it as end-of-frame flag
Next bits will be considered part of the next frame
This is called lack of Transparency
Bit Stuffing is the process of adding one extra
0 whenever there are five consecutive 1s in the
data so that the receiver does not mistake the
data for a flag
COE 341 Dr. Marwan Abu-Amara 59
HDLC Bit Stuffing & Removal
COE 341 Dr. Marwan Abu-Amara 60
HDLC Bit Stuffing
Problems: With bit stuffing, Single-bit errors could
split a frame into 2 or merge two frames into 1.

01111100
(Bit stuffed)
(Bit stuffed)
01111110
Frame
Splitting
Frame
Merging
01111110
01111100
COE 341 Dr. Marwan Abu-Amara 61
HDLC Frame Structure Address Field
Address field identifies the secondary station that
transmitted or is to receive frame
Not used (but included for uniformity) for point-to-point
links
Extendable by prior arrangement
Address = 11111111 (single octet) used by the primary
to broadcast to all secondary stations
Extended Address Field
COE 341 Dr. Marwan Abu-Amara 62
HDLC Frame Structure Control Field
Three types of frames: I, S, and U
Information frame (I): carry user data (upper layers) flow and error control info
is piggybacked on these frames as well
Supervisory frame (S): carry flow and error control info when piggybacking is not
used
Unnumbered frame (U): provide supplementary link control
First 2 bits of the control field determine the type of frame, the remaining are
organized as shown in figure 7.7.c and d (next slide)
Poll/Final (P/F) bit:
In command frames (P): used to solicit response from peer entity
In response frames (F): indicate response is the result of soliciting command
COE 341 Dr. Marwan Abu-Amara 63
HDLC Frame Structure Control Field
Extension of sequence number
7-bit sequence numbers rather than 3-bit ones
Set-mode command extends control field to 16 bit
for S and I frames
Unnumbered frames always use 8-bit
COE 341 Dr. Marwan Abu-Amara 64
HDLC Frame Structure Information/FCS Fields
Information field:
Present ONLY in I-frames and some U-frames
Contains integer number of octets
Length is variable up to some system defined maximum

FCS field:
CRC error detecting code
Calculated from ALL remaining bits in frame (excluding flag
field)
Normally 16 bits (CRC-CCITT polynomial = X
16
+X
12
+X
5
+1), or
32-bit optional FCS using CRC-32
COE 341 Dr. Marwan Abu-Amara 65
HDLC Frames
HDLC uses Synchronous transmission
HDLC defines three types of frames
Information frames (I-frames)
Used to transport user data and user control information
relating to the user data (e.g. piggybacking)
Supervisory frames (S-frames)
Used to transport control information only
Unnumbered frames (U-frames)
Used in the link management
COE 341 Dr. Marwan Abu-Amara 66
HDLC Generic Frame Format
Indicates that the first
transmitted field is the Header
flag, then the address, then the
control

Header

Trailer

COE 341 Dr. Marwan Abu-Amara 67
HDLC I, S & U Frames Format
COE 341 Dr. Marwan Abu-Amara 68
HDLC I-Frames
I-frames are designed to carry user data from
Network-layer
They can include flow & error control information
(piggybacking)
The bits of the I-frame Control field are:
First bit is always 0. It means it is an I-frame
Next 3-bits, called N(S), define the sequence of the frame
So possible sequences are 0,1,2,3,4,5,6,7
Next bit is called P/F (Poll or Final)
When a primary station polls other stations, it sets this bit to 1
When a secondary station responds to a poll, it sets this bit to 1
Next 3-bits, called N(R), define the value of the ACK when
piggybacking is used
COE 341 Dr. Marwan Abu-Amara 69
HDLC I-Frames
COE 341 Dr. Marwan Abu-Amara 70
HDLC S-Frames
COE 341 Dr. Marwan Abu-Amara 71
HDLC U-Frames
COE 341 Dr. Marwan Abu-Amara 72
U-frame control command and response
Command/response Meaning
SNRM Set normal response mode
SNRME Set normal response mode (extended)
SABM Set asynchronous balanced mode
SABME Set asynchronous balanced mode (extended)
UP Unnumbered poll
UI Unnumbered information
UA Unnumbered acknowledgment
RD Request disconnect
DISC Disconnect
DM Disconnect mode
RIM Request information mode
SIM Set initialization mode
RSET Reset
XID Exchange ID
FRMR Frame reject
COE 341 Dr. Marwan Abu-Amara 73
HDLC Operation
HDLC operation consists of the exchange of I-
frames, S-frames, and U-frames between two
stations.
Table 7.1 list types of Control/Response
functions for various frame types
The operations of HDLC involve three phases:
Initialization (by either side): U-Frames
Both agree on various options
Data Transfer (by the two sides): I- and S-Frames
Exchange of user data and control info for flow and error
control
Disconnect (by either side): U-Frames
Signaling termination of operation
COE 341 Dr. Marwan Abu-Amara 74
HDLC Operation
Initialization:
(Link Setup & Disconnect)
Issue SABME command and starts timer
B responds with UA (or DM if request is
rejected)
A receives UA and initializes its variables
To disconnect: issue DISC command
Followed by UA
SABME: Set Asynchronous balanced/extended mode;7-bit sequence
COE 341 Dr. Marwan Abu-Amara 75
HDLC Operation
Data Transfer:
Once initialization is complete a logical path is
established.
Both sides start to send I-frames (Full-duplex
exchange) starting with seq. number 0
N(S), N(R) both are seq. number to support
flow and error control
N(R) is the ACK for the I-frame received; it
enables the HDLC module to indicate which
number I-frame it expect to receive next.
RR is used (S-frame) when there is no
reverse user data (I-frame) traffic
COE 341 Dr. Marwan Abu-Amara 76
HDLC Operation
Disconnect:
Either side can issue a DISC frame
to request disconnect
The remote entity MUST accept
the request by sending UA.
Any outstanding I-frame will be
lost.
Busy condition: Notice the use of
P/F bit.
When A is unable to keep up with
the speed of the transmitter B or
buffer is full.
A sends RNR, to halt the
transmission of B
To check the readiness of A,
periodically B sends RR frame with
P set.
Once the condition of being busy is
cleared A responds with F=1

COE 341 Dr. Marwan Abu-Amara 77
HDLC Operation
Reject Recovery:
I-frame 4 was lost
B receives I-frame 5 (out of
order) responds with REJ 4
A resend I-frame 4 and all
subsequent frames (Go-back-N)
Timeout Recovery:
A sends I-frame 3 but it is lost
Timer expires before
acknowledgement arrives
A polls Node B
B responds indicating it is still
waiting for frame 3 B set the F
bit because this a response to
As solicitation
COE 341 Dr. Marwan Abu-Amara 78
HDLC Example: Piggybacking w/o Errors
Next slide shows an exchange using piggybacking when
there is no 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 Bs first I-frame is also numbered 0 [N(S) field] and
contains a 2 in its N(R) field, acknowledging the receipt of
As frames 1 and 0 and indicating that it expects frame 2 to
arrive next
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 As frame 2 to arrive next
COE 341 Dr. Marwan Abu-Amara 79
HDLC Example: Piggybacking w/o Errors
COE 341 Dr. Marwan Abu-Amara 80
HDLC Example: Piggybacking with Errors
Suppose frame 1 sent from station B to station
A has an error
Station A informs station B to resend frames 1
and 2 (the system is using the Go-Back-N
mechanism)
Station A sends a reject supervisory frame to
announce the error in frame 1
Next slide shows the exchange
COE 341 Dr. Marwan Abu-Amara 81
HDLC Example: Piggybacking with Errors

You might also like