CHAPTER 4]
Data Link Control
and Protocols
Data communication requires
at least two devices working together, one to send and
one to receive, Even such a ba: seat deal of
oe eae sic arrangement requires a great deal of coordination for
a igible exchange to occur. The most important responsibilities of the data link
layer are flow control and error control.
Collectively, these functions are known as
data link control,
In this chapter, we first informally define flow and error control. We then intro-
duce three mechanisms that handle flow and error control. We finally discuss a popular
a link protocol, HDLC.
11.1) FLOW AND ERROR CONTROL
Flow and error control are the main functions of the data link layer. Let us i
define each.
formally
low Control
Flow control coordinates the amount of data that can be sent before receiving acknowl-
edsment and is one of the most important duties of the data link layer. In most proto-
I ‘a set of procedures that tells the sender how much data it can
tranamit before it must wait for an acknowledgment From the receiver. The flow of data
vw fewed to overwhelnr the receiver, Any receiving device has a limited
speed at which itean process incoming data and a limited smount of memory in which
data, The receiving device must be able to inform the sending device
tetore those limits are reached and fo request thatthe transiting device send fewer
efore those emporarily. Incoming data must be checked and processed before they
frames oF stop Tempo f such processing is often slower than the rate of transmission
can be used. The rae vpecivng device has a block of memory. called a buffer, reserved
for aan data until they are processed. If the buffer begins to fill up, the
for storing incoming. <* halt transmission until it is once again able to
receiver miist be able to tell the sender to ie
cols, flow control is
must not be
to store
rece268 CHAPTER 11 DATA LINK CONTROL AND PROTOCOLS
ee Ir jet the t of data that the |
fe Deares used to restrict the amous
Flow control refers to a set of P : |
sender can send before waiting for acl
|
Error Control ction. It allows the receiver to
Error control is both error detection and error correction sion ‘and coordinates the
inform the sender of any frames lost oF damaged Less Tayer. the tert error control
he data 5
retransmission of those frames by the sender. In ven ‘Betot bout) in the
7 / retransi
refers primarily to methods of error detection and sisitt dean
ne-an.cxror
data link layer is often implemented simply: Anytime an eo
exchange, specified frames are retransmitted. This process 1S CaNe0 T°
request (ARQ):
which is the
| Error control in the data link layer is based on automatic repeat request,
| retransmission of data.
Flow and Error Control Mechanisms
In this section we introduce three common flow and error control mechanisms: Stop-
and-Wait ARQ, Go-Back- ARQ, and Selective-Repeat ARQ. Although these are
sometimes referred to as protocols, we prefer the term mechanisms.
11.2 STOP-AND-WAIT ARQ
" Stop-and-Wait ARQ is the simplest flow and error control mechanism, It has the fol-
lowing features:
HL The sending device keeps a copy of the last frame transmitted until it receives an
acknowledgment for that frame. Keeping a copy allows the sender to retransmit
lost or damaged frames until they are received correctly,
For identification purposes, both data frames and acknowledgment (ACK) frames
are numbered alternately 0 and 1. A data 0 frame is acknowledged by an ACK 1
frame, indicating thatthe receiver has received data frame 0 and is now expecting
data frame 1. This numbering allows for identification of data frame: case of
duplicate transmission (important in the case of lost acknowledgment or delayed
acknowledgment, as we will sce shortly),
BA damaged or lost frame is treated in the same
receiver detects an error in the received frame,
sends no acknowledgment. If the receiver recei
(O instead of 1 or 1 instead of 0), it knows that
out-of-order received frame.
The sender has a control variable, which
recently sent frame (0 or 1). The receiver
that holds the number of the next frame ¢:
manner by the receiver. If the
it simply discards the frame and
ves u frame that is out of order
4 frame is lost. It discards the
we call S, that holds the number of the
has a control variable, which we call R,
‘xpected (0 or 1),B Th SECTI
le sender st ON 11.2. STOP-AND.
7 s vo )- WAIT,
received wit as
ord:
ats at
Mer it
hin gg MF When jg
i n allotted tine et
ie Nt afr
aged te time pen cue an acknowledgment is not
it + the sender assumes th '
'S at the frame was lost
t
Sender, Receiver
Time Time
Lost or Damaged Frame
frame is handled in the same way by the receiver; when the receiver
Jost or damaged 7 . .
ives ‘a damaged frame, it discards it, which essentially means the frame is lost. The
iver remains silent about a ost frame and keeps its value of R, For example, in Fig-
Bsc frame 1, but it is lost. The receiver does nothing, retain-
sender transmits ’
ure ee Send After the timer atthe sender ste expires, anther copy of frame 1
sing
is sent.CHAPTER 11 DATA LINK CONTROL AND PROTOCOLS
Figure 11.2
Time-out
Stop-and-Wait ARQ, lost frame
Sende Receiver
Lost Acknowledgment
A lost or damaged acknowledgment is.handled in the same way by the sender; if the
sender receives a damaged acknowledgment, it discards it. Figure 11.3 shows a lost
ACK 0. The waiting sender does not know if frame 1 has been received. When the
timer for frame | expires, the sender retransmits frame |. Note that the receiver has
already received frame
1 and is expecting to receive frame 0 (R = 0). Therefore, it
silently discards the second copy of frame 1,
Figure 11.3. Stop-and-Wait ARQ, lost ACK frame
Time-out
Saal Receiver
R=0
Expecting frame 0,
frame 1 discarded
TimeSECTION 11.2 STOP-AND-WAITARQ 271
The reader may have di
iscovered th
If the frames Were not numbered, the roeth
a duplicate), keeps it, vee
“nsStpand wa AR
‘ait ARQ, numbering frames prevents the retaining of duplicate frames.
ugh this example the need to number frames.
ver, thinking that frame 1 is a new frame (not
Delayed Acknowledgment
Another problem that may occur is delayed acknowledgment. An acknowledgment can
be delayed at the receiver or by some problem with the link. Figure 11.4 shows
the delay of ACK 1: it is received after the timer for frame 0 has already expired. The
sender has already retransmitted a copy of frame 0. However. the value of R at
the receiver site is still 1, which means that the receiver expects to see frame 1. The
receiver, therefore, discards the duplicate frame 0.
Figure 11.4 Stop-and-Wait ARQ. delayed ACK
Sender Receiver
Time-out
‘Time-out
wo ACKS, one that was delayed and one that was
, is discarded.
ted. The second ACK 1 is —_
fier the duplicate frame : ro number the acknowledgments, let us examine Fie
sean understand WHY “eyed [ACK I reaches the sender, frame 1 is sent. However
it - i e then receives an
jain. After the 0°) the receiver. The sender :
fra rel is ost and never reas CKS were not numbered, the sender would interpre
the duplicate frame sents HO edgment for frame 1. Numbering the ACKs p
e the acl
cK as
the second A
frames.
keep track of the received data fra
| method to ki
received t
has now
‘The senderCHAPTER 1] DATA LINK CONTROL AND PROTOCOLS
cd the next
[Nani Seino Ieainenty are need it an acknowledgment is delayed and “enext)
| frame is lost.
Bidirectional Transmission
The stop-and-wait mechanism we have discussed is unidirectic However, we can
have bidirectional transmission if the two parlics have {Wo separate channel Is 7 ia
duplex transmission or share the same channel for half-duplex transmission in this
case, each party needs both Sand R variables to track frames sent and expected.
Piggybacking
Piggybacking is a method to combine a data frame with an a
example, in Figure 11.5, Stations A and B both have data to send.
separate data and ACK frames, station A sends a data frame that includes ¢
Station B behaves in a similar manner. 7 -
Figure 11.5 Piggybacking
Time Time
Pigeybacking can save bandwidth because the overhead from a d
ACK frame (addressees, CRC, etc.,) can be combined int rae amend an
S 11.3 GO-BACK-N ARQ
In Stop-and-Wait ARQ, at any point in time for a sender, there i
; i : sender, there is
ousting ae hs awa we cae oe ane he
sie cy, multiple frames should be in
oth
is, We need to Tet more than
of the transmission medium, To improve
transition while wailing for acknowledgment. InoSECTION 11.3 GO-BACK-NARQ 273
one frame be outstanding, Two pro
tive Repeat ARO. We *Ocols use this concept: Go-B d Selec
Tao bad Aetna CoDac ARQ ai Ske
ARQ, we can Section and the second in Section 11.4.
edgments; we Keep a send uy
to W frames bef ing about acknowl-
y COPY of these fram eee tames before worrying about ac!
code requires adiona fesse ‘until the ackn arrive. This pro-
e
Sequence Numbers
n are num
bered sequentially. However, because we need
ber of eacl
ach frame in the header, we need to set a limit. If
“pws. bits for the sequence number, the sequence numbers
1. For example, if m is 3, the only sequence numbers are 0
However, we can Tepeat the sequence. So the sequénee num-
0.1, 2,3,4,5,6,7,0, 1,2,3,
At the sender site, to hold
the concept of a window.
the outstanding frames until they are acknowledged, we use
We imagine that all frames are stored in a buffer. The out-
Standing frames are enclosed in a window. The frames to the left of the window are
those that have already been acknowledged and can be purged: those to the right ofthe
‘window cannot be sent until the window slides over them. The size of the window is at
most 2” — | for reasons that we discuss later
The size of the window in this protocol is fixed, although we can have a variable-
size window in other protocols such as TCP (See Chapter 22). The window slides to
include new unsent frames when the correct acknowledgments are received. The wins
dow is a sliding window. For example, in Figure 11.6a, frames 0 through 6 have been
seni. In part b, the window slides two frames over because an acknowledgment was
received for frames 0 and 1.
Figure 11.6 Sender sliding window
Window size = 7
j_Wedowsie 7
wef 5]6]|7 ON T1213 [4] 5 )6
a. Before sliding
Window si:
a
Tele [aise ts|
b. After sliding two frames274 CHAPTER 11 DATA LINK CONTROL AND PROTOCOLS
Receiver Sliding Window /
: col is always 1. The receiver j
The size of the window at the receiver site in this, protocol ‘ 2 Mile ame arrivin vs
always looking for a specific frame to arrive in a specific order. Any ne arriving out
of or scaril Is to be resent. The receiver window also slides as
of order is discarded and need When that ani
‘a io ‘ame 0. hen that arriv
shown in Figure 11.7. In part a the receiver is waiting for frame 0. rrives,
the window slides over.
Figure 11.7 Receiver sliding window
Poa
a. Before sliding
|
| Ce aT 0 |
b. After sliding
Control Variables
The sender has three variables, S, Sy, and S,. The S variable holds th
of the recently sent frame; Si holds the sequence number of the first frame in the wine
dow; and S;, holds the sequence number of the last frame in the window. The size of the
window is W, where W= S,~Sp+1.
The receiver only has one variable, R, that holds the sequence number of the frame
i expects 10 receive. If the sequence number of the received frame is the same as.the
value of R, the frame is accepted; if not, it is Tejected. Figure 11.8 shows the sender and
receiver window with their control variables, - :
Figure 11.8 Control variables
a
cfu. |
*
7 ——__
Frames | | Frames waiting Framcgpge $ |
sexnowleged | The ine iene Frames that cannot |
ua be accepted |
R
4. Sender window |
_ . Receiver window
i
Timers
The sender sets a timer for each frame sent, The goes:
+ The receiver has no ti
imers.SECTION 11.3 GO-BACK-NARQ 275
Acknowledgment
I
(the receiver sends posit
in order. Ifa frame Be ‘lame cknowledgments iffa frame has arrived safe and sound and
discard all subsequent frames untlitreciec teeters receiver is silent and will
Frere fet ames unlit eeives th one itis expecting Fi silence of the
the sender to go back and rose kno wedged frame to expire. She in turn, causes
timer. The receiver does not have - frames, beginning with the one with the expired
cumulative acknowledgment for sev acknowleiae cach frame received. It can send one
Resending Frame
When a
hea a fc anes the sender goes back and sends a set of frames starting from
the aan p to the last one sent. For example, suppose the sender has already
nt frame 6, but the timer for frame 3 expires. This means that frame 3 has not been
acknowledged, so the sender goes back and sends frames 3, 4,5, 6 again. That is why
-ol is called Go-Back-N ARQ.
Operation
Let us sce what happens in various situations.
Normal Operation
11.9 shows a normal opel ism. The sender keeps track of the
ration of this mechani:
indows as the acknowledgments
Figure 1
outstanding frames and updates the variables and wi
arrive.
,-Back-N ARQ. normal operation
Figure 11.9 6°‘6 CHAPTER 11 DATA LINK CONTROL AND PROTOCOLS
Damaged or Lost Frame
¢ what happens if a frame is lost. Figure 1
Note that when the receiver receives frame 3, it Is €
expecting frame 2, not frame 3 (according, to its wine
expires at the sender site, the sender sends frames 2.4m
1.10 shows that frame 2 is lost,
carded because the receiver is
Jow). After the timer for frame 2
1d 3 (it goes back to 2).
Now let us
Figure 11.10 Go-Back-N ARQ, lost frame
Sender Receiver
Time-out
Time ‘Time
Damaged or Lost Acknowledgment
“If an acknowledgment is damaged or lost, we can h
‘ 1 ave two situati
acknowledgment arrives before the expiration of any timer. there is no need tee
mission of frames because acknowledgments are cumulative i ‘7 no need for retrans-
means ACK | to ACK 4, So if ACK T, ACK ¢ in this protocol. ACK 4
them However, if the next ACK affives aft » and ACK 3 ate Tost, ACK 4 covers
é ver, if after the time- — CONE
afier th ae resem. Note thatthe receiver never esende wy aCe gs allie frames
sends an
and details as an exercise. CK. We leave the figure
Delayed Acknowledgment
‘A delayed acknowledgment also trigger .
figure and details asan creieise. rs the resending of frames. Again, we leave the
umm ealSender w3. SECTIO, 7
Sender Window Size N 11.3 GO-BACK-NARQ 277
We can now
show wi
le, wi Why the
r he Choose nj wth Size of the sender wind
Compares a window ch means now must be less than 2". As an exame
: he si .
Size of 3 ang a of the window can be 2”
Figure 11.14 ~ 1, oF 3. Figure
|
s (ot f2f3}0)
s
folnfa]3
3 ng p
R $
Time-out 5
9
5 :
Comectly p——
s
a, Window size < 2" '. Window size = 2
If the size of the window is 3 (less than 2°) and all three acknowledgments are lost,
the frame 0 timer expires and all three frames are resent. However, the window of the
receiver is now expecting frame 3, not frame 0, so the duplicate frame is correctly dis-
carded, On the other hand, if the su the window is 4 (equal to 2°) and all acknowl-
Tost thie sender will send the duplicate of frame 0. However, this time the
edgnients ar
Siaiour * he receiver expects foresee Fame D s0it seeps fame O, nota a dupl-
cate, but as the first frame in the next cycle. This is an error.
and Piggybacking
ARQ, Go-Back-N ARQ can also be bidirectional. We
ficiency of the transmission. However, note
\dow and a receiver window. We leave the
Bidirectional Transmission
| and-Wait
Asin te ce 0 neice
iggyba
can also use PigeY i
‘that each. direction needs both ® eae
configuration of the windowTER I DATA LINK CONTROL AND PROTOCOLS
CU4 SELECTIVE REPEAT ARQ
° sceiver site. The receiver keeps track of
Go-Back-N ARQ simplifies the process at the receive!
only one varia
dis
und there is no need to buffer out-of-order frames: they are simply
arded, However, this protocol is very inefficient for
frame has a higher probability of damage,
frames. This resendin
noisy link. Ina noisy link a
which means the resending of multiple
uses up the bandwidth and slows down the transmission, For
noisy links, there is another mechanism that does not resend NV frames when just one
frame is damaged: only the damaged frame is resent. This mechanism is called Selec
tive Repeat ARQ. It is more efficient for noisy links, but the processing at the receiver
is more complex.
Sender and Receiver Windows
The configuration of the sender and its control variables for Selective Repeat ARQ are
the same as those for Go-Back-N’ ARQ. However, for reasons to be discussed later, the
size of the window should be at most one-half of the value 2”, The receiver window
size must also be this size. This window, however, specifies the range of the accepted
received frame. In other words, in Go-Back-, the receiver is looking for one specific
sequence number; in Selective Repeat, the receiver is looking for a range of sequence
numbers. The receiver has two control variables Ry and R, to define the boundaries of
the window, Figure 11.12 shows the sender and receiver windows.
Figure 11.12 Selective Repeat ARQ. sender and receiver wi
dows
Fame | fo
Frames waiting Frames re |
aciaouteaged | | | She cen andashnowledged | | Yeneehay”
SSS, RR,
4
b. Receiver window
Selective Repeat ARQ also defines a negat
imer expires.
Operation
Let us show the operation of th
e mech; ith a
hats sow ta nism with an example of a lost frame, as shown
mes 0 and | are accepted whey
by the receiver window. When frame } ion because they are in the range specified
son. However, the receiver sends a NAK Sone itis al
When the sender receives the Nave
because itis inthe range of the
Iso accepted for the same rea
2 to show that fra iv
AK 2 itaceen that frame 2 has not been received:
window, only frame 2, which is then acceptea
SECTIOI
IN 11.4 SELECTIVE REPEAT ARQ 279
Time Time
Lost and Delayed ACKs and NAKs
layed ACKs and NAKs as exercises. Note that the sender also sets
We leave lost and del:
a timer for each frame sent.
Sender Window Size
the size of the sender and receiver windows must be at most
ample, we choose m = 2, which means the size of the win
14 compares a window size of 2 with a window
We can now show W
one-half of 2”. For an ex!
dow should be 2/2, or 2. Figure 1
size of 3.
Ifthe
res and frame
not frame 0.
3 and al
this time. the
part of the ), so it accept
the next cycle. This is clearly an error.
eae maar: Wisin nee Fea)
‘Repeat
“In Selective ie
sive ofthe window is2 andall acknowledgments 6 lost, the timer for frame 0
wing Howeve, the window of the recive is now expect
ree duplicate fame iscorectly discarded. When the ee
oun owledgments are Tost, the sender sends a duplicate of
‘window of the receiver expects to receive frame 0 (0 is
frame 0, not as a duplicate, but as the first frame in
frame
the window is
frame 0. However
window)ender window size
Figure 11.14 Selective Repeat ARQ, sender wi
Sender Receiver
|
mel) oe
ST 10} 1]2)3,
oe
-ow [OLE
§
A.
ly
accepted
Correctly
Discarded]
Time Time Time Time
a. Window si 1 b. Window size > 2"~"
Bidirectional Transmission and Piggybacking
Asin the case of Stop-and-Wait ARQ and the Go-Back-N ARQ, Selective Repeat ARQ
can also be bidirectional. We can use piggybacking to improve the efficiency of the
transmission. However, note that cach direction needs both a sender window and a
receiver window. We leave the configuration of the windows
Bandwidth-Delay Product
A measure of the efficiency of an ARQ system is the product of the bandwidth (in bits
Per second) and the round-trip delay (in seconds). If the link has an adequate band-
width, the sender will exhaust its window quickly and will wait for the acknowledg-
ments to come. If the delay is long, the nder can also exhaust its window while
waiting. So the product of these two {i tors can be i
‘an be used t an
ARQ system. The bandwidth-delay eee eee
Product is a measure of the number of bits we
an send out of our system while waiting for news from the receiver. =
Example 1
In a Stop-and-Wait ARQ system, the ba
stem, the bandwidth
make a round trip. What is the bandwidth-delay ‘o
the line is 1 Mbps, and 1 bit takes 20 ms to
in length what isthe wilzation percentage fy
Product? If the system data frames are 1000 bits
ie link?
Solution
‘The bandwidth-delay product jg
6
1x 10% x 20 x 10 = 20,000 bitsSECTION 115 HDLC 281
‘The stem can send 2,
: 000 bi
reciverand thn back ag tit kes for he dao go fro teed he
: Ick again, Howey
uilzation is only 1000120 00, gg ie the sytem ends only 100 bits Wecan say that eink
delay, use of Stop-and.Writ ape For this reason, fora lnk with high bandwidth or long
it
ARQ wastes the capacity ofthe ink
Example 2
‘Whats the tization,
ere
2 15-rame sequence? Preentage ofthe link in Example | ifthe ink uses Go-BackW ARQ with
Solution
‘The bandwidth
dig in ce is ill 20000 The syecan sen pS ames ot 15.00 is
iit ip. This means the uilizaton is 15 00°20 00, or 5 pce OF cous, if there
es, the utlzation percentage is much es because frames have fo beeen
Pipelining
In networking and in other areas, task is often begun before the previous task has
cnded, This is known as pipelining. Tere is no pipelining in Stopand-Wait ARQ
because we need to wait fora frame to reach the destination and be acknowledged
fore the next frame canbe sent. However, piclning does aply to Go-BackwN ARQ
and Selective Repeat ARQ because several frames can be sent before we receive news
about the previous frames.
Pipelining improves theeffieny ofthe arson he umber of bis in tran-
ston sage wth espet othe tanith pole
ee
11.5 HDLC
High-level Data Link Cor
pal-taplex and fllsupes comm
implements the ARQ mechanisms We
trol (HDLC) san cal rotcl designe support both
ication over pint--pont and multipoint inks.
cussed inthis caper.
ransfer Modes
HDLC provides 16°" ‘common modes of transmission: NRM and ABM.
Configurations and Tl
RM ie scsi rd Wee
In normal reper wa mullet sa primary station can send com-
ane Ft ey gn: ENR se rn oo
ma;
sn lle it inks —
ABM ed mode (ABM) the configuration i balanced. The link is
inane nan eh primary and a secondary, as shown in
point-to-point
Fioure 11.16.