Tải bản đầy đủ (.pdf) (34 trang)

Dât link control protocols

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (1.32 MB, 34 trang )

ie

CHAPTER

7

Data LINK CONTROL
PROTOCOLS

7.1

Flow Control

Stop-and-Wait Flow Control

Sliding-Window Flow Controt
7.2

Error Control
Stop-and-Wait ARQ
Go-Back-N ARQ

Selective-Reject ARO
7.3.

High-Level Data Link Control (HDLC)

Basic Characteristics
Frame Structure

Operation



7.4

Recommended

7.5

Key Terms, Review Questions, and Problems

Reading

Key Terms
Review Questions
Problems
Appendix 7A

Performance Issues

Stop-and-Wail Flow Control

Errot-Free Sliding-Window Flow Control
ARQ


208

CHAPTER

7 / DATA


LINK

PROTOCOLS

6 ONEROL

KEY POINTS

errors, and because the receiver
* Because of the possibility of transmission
data arrive, synchronization
of data may need to regulate the rate at which
It is necessary to
themselves.
by
insufficient
and interfacing techniques are
device that provides funcimpose a layer of control in each communicating
and error control. This layer of
tions such as flow control, error detection,
protocol.
contro! is known as a data link control
sender
to regulate the flow of data from a
* Flow control enables a receiver

overflow.
so that the receiver’s buffers do not
control is achieved by retransmission
error

« Ina data link control protocol,
acknowledged or for which the other
of damaged frames that have not been
side requests a retransmission.

sion link. For efd sending signals over a transmis
Our discussion so far has concerne
control and manage
unications, much more is needed to

fective digital data comm
over a
our emphasis to that of sending daia
the exchange. In this chapter, we shift
added
is
logic
of
the necessary control, a layer
data communications link. To achieve
data
as
to
red
refer
is
d in Chapter 6; this logic
above the physical interfacing discusse
is
ocol

prot
ol
contr
col. When a data link
link contro} or a data link control proto
link.
een systems is referred to as a data
used, the transmission medium betw
and objec
ents
irem
requ
list some of the
To see the need for data link control, we
mittingtrans
d
ecte
conn
n between two directly
tives for effective data communicatio
receiving stations:

+ Frame synchronization:

The beginning
Data are sent in blocks called frames.

ed this topic
recognizable. We briefly introduc
and end of each frame must be

frames (Figure 6.2).
with the discussion of synchronous
r than

must not send frames at a rate faste
+ Flow control: The sending station

them.
the receiving station can absorb
em should be
oduced by the transmission syst
¢ Error controk Bit errors intr

corrected.

a local area network (LAN), the
On a multipoint line, such as
in a transmission must be specified.
identity of the two stations involved
a physically
It is usually not desirable to have
« Control and data on same link:
gly, the
rdin
Acco
rmation.

« Addressing:

contro! info

separatc communications path for
g
ol information from the data bein
contr
h
nguis
receiver must be able to disti
transmitted.
Link management:

termination of a sustained
The initiation, maintenance, and
g

of coordination and cooperation amon
data exchange require a fair amount
required.
management of this exchange are

stations. Procedures for the

None of these requirements is
see
described in Chapter 6. We shall
r
isfies these requirements is a rathe
data
of
mechanisms that are part


g techniques
satisfied by the physical interfacin
ocol that satprot
link
in this chapter that a data
at two key
ing
look
by
complex affair. We begin
control.
error
and
ol
link control: flow contr


71/ PLOW CONTROL

209

Following this background we look at the most important example of a data link
control protocol: HDLC (high level data link control). This protocol is important for

two reasons: First, it is a widely used standardized data link controt protocol. Sec-

ond, HDLC serves as a baseline from which virtually all other important data link
control protocols are derived. Finally, an appendix to this chapter addresses some

performance issues relating to data link control.


Flow control is a technique for assuring that a transmitting entity does not over-

whelm a
buffer of
must do
software.

receiving entity with data. The receiving entity typically allocates a data
some maximum length for a transfer. When data are received, the receiver
a certain amount of processing before passing the data to the higher-level
In the absence of flow control, the receiver’s buffer may fill up and over-

flow while it is processing old data.
To begin, we examine mechanisms for flow control in the absence of errors.
The model we will use is depicted in Figure 7.1a, which is a vertical-time sequence
diagram. It has the advantages of showing time dependencies and illustrating the
correct send-receive relationship. Each arrow represents a single frame transiting a
data link between two stations. The data are sent in a sequence of frames, with each
Source

Destination

_

|

Source

same


Frame 1

Frame 2 P|

Frame 2

Frame 3

Frame 2

Frame 4

Frame 3

|

Frame 5

e

E

aI

Destination

P|

Frame !


+

Frame 3
Frame 4 P|

|

J Frame 4

P|

Garbled
frume

Frame 5

|

Frame 5

(a) Error-free

Figure 7.1

q
Frame 3

Wransmission


Model of Frame Transmission

Frame 5

(b) Transmission

with

losses and errors


210

L PROTOCOLS
CHAPTER 7 / ĐATA LINK CONTRO

rmation. ‘The time it
the data and some control info
frame containing a portion of
um is the transmisthe bits of a frame onto the medi
takes for a station to emit all of
time is the
length of the frame. The propagation
sion time; this is proportional to the
For this
ion.
inat
the link between source and dest
time it takes for a bit to traverse
; no

ived
rece
ully
essf
es that are transmitted are succ
same
section, we assume that all fram
the
iu
e
arriv
es
e with errors. Furthermore, fram
frames are Jost and none arriv
e suffers an arbitrary

ver, each transmitted fram
order in which they are sent. Howe
nt of delay before reception.
and variable amou

Stop-and-Wait

Flow Control

rol, works as folknown as stop-and-wait flow cont
The simplest form of flow control,
ives the frame,
rece
ion entity

s a frame. After the destinat
lows. A source entity transmit
nowledgment
ack
an
pt another frame by sending back
it indicates its willingness to acce
nowledgment
ack
the
source must wait until it receives
simply by
to the frame just received. The
data
of
flow
The destination can thus stop the
hardly be
before sending the next frame.
can
ed,
inde
This procedure works fine and,
often the
is
it
withholding acknowledgment.
r,
eve
How

a few large frames.
in
sent
is
age
mess
a
n
whe
improved upon
blocks and transmit
4 large block of data into smaller
case that a source will break up
ons:
is done for the following reas
the data in many frames. This

eiver may be limited.
» The buffer size of the rec
be an error, neces, the more likely that there will
© The longer the transmission
frames, errors are
r
entire frame. With smalle
sitating retransmission of the
retransmitted.
be
r amount of data needs to
detected sooner, and a smalle
e not to permit one

as a LAN. it is usually desirabl
such
,
ium
med
red
sha
¢ Ona
causing long delays
for an extended period, thus
station to occupy the medium
.
at the other sending stations
stop-and-wait procemes for a single message, the
With the use of multiple fra
only one frame at a time
essence of the problem is that
The
e.
uat
deq
ina
be
may
e
dur
of a link as follows:
we first define the bit length
ain
expl

To
sit.
tran
in
be
can

B=Rxe
where:

(7.1)

present on the link
this is the number of bits
bits;
in
link
the
of
B = length
occupies the link
when a stream of bits fully
R

bps
= data rate of the link, in

d=

V


,

link in meters
length, or distance, of the

velocity of propagation, In m/s

ble. However, a data link
js fixed rather than varia
link, the amount of delay
ched or ATM network, i
swit
uitcirc
a
as
{On a direct point-to-point
such
connection,
can be used over a network

control protocol
variable.
which case the delay may be



-1



7.L/ ELOW CONTROL

211

fạ+1

tạ+a

l:
tytita

ITj
tạ+l+a
=

[RỶ

B

EY



=

=nL 1

LR

[T]

ty +44 2a

(b)a
(a)a>1
Figure 7.2

——>

=

=

Stop-and-Wait Link Utilization (transmission time = 1; propagation time = a)

In situations where the bit length of the link is greater than the frame length,

serious inefficiencies result. This is illustrated in Figure 7.2. In the figure, the trans-

mission time (the time it takes for a station to transmit a frame) is normalized to

one, and the propagation delay (the time it takes for a bit to travel from sender to

receiver) is expressed as the variable a. Thus, we can express @ as

aa

B

(7.2)


where L is the number of bits in the frame (length of the frame in bits).
When a is less than 1, the propagation time is less than the transmission time.
In this case, the frame is sufficiently long that the first bits of the frame have arrived
at the destination before the source has completed the transmission of the frame.

When a is greater than 1, the propagation time is greater than the transmission time.

In this case, the sender completes transmission of the entire frame before the leading bits of that frame arrive at the receiver. Put another way, larger values of a are
consistent with higher data rates and/or longer distances between stations. Appendix 7A discusses a and data link performance.

Both parts of Figure 7.2 (a and b) consist of a sequence of snapshots of the

transmission process over time. In both cases, the first four snapshots show the
process of transmitting a frame containing data, and the last snapshot shows the return of a small acknowledgment frame. Note that for a > 1, the line is always


212

CHAPTER

7 / ĐATA

LINR

CONTIROI

PROLOCOLS

utilized. In essence, for

underutilized and even for a < 1, the line is inefficiently
and receiver, stop-andsender
n
very high data rates, for very long distances betwee
tion.
wait flow control provides inefficient line utiliza

ing at 1 Gbps. The velocExample 7.1. Consider a 200-m optical fiber link operat
2 x 10° m/s. Using Equaity of propagation of optical fiber is typically about
octets,

tion (7.1), B = (10° X200)/(2 %X 10%)

= 1000. Assume a frame of 1000

a = (1000/8000) = 0.125.
or 8000 bits, is transmitted. Using Equation (7.2),
starts at time t = 0. After 1 ps
Using Figure 7.2b as a guide, assume transmission
g edge (first bit) of the frame
(a normalized time of 0.125 frame times), the leadin
are spread out across the link:
has reached R, and the first 1000 bits of the frame
the frame has just been emitted
At time ¢ = 8 ps, the trailing edge (final bit) of
spread out across the link. At
by T, and the final 1000 bits of the frame are
at R. R now sends back an’ ACK frame. :
t= Ops, the final bit of the frame arrives
negligible (very small ACK frame)...

If we assume the frame transmission time is
this.

at Tatr = 10 ps-At
and that the ACK is sent immediately, the ACK arrives transmission time for the,
actual
T can begin transmitting a new frame. The

_ point,

the first frame and receive and
frame was 8 ps, but the total time to transmit
¬..-....
ted
wg
:
/
10s.
is K
AC
two ground stations that.communi-”
co” Now consider a 1-Mbps link between,
te has. an altitude of roughly €ate viaa satellite relay. A geosynchronous satelli
i
240,000.



36,000


=
km, Then B = (10° x 2 X:36,000,000)/(3x 10%)
7-2a as a guid
Figure
Using
30.
=
bits, a= (240000/8000)

af 8000
takes,240
itse
work through the same steps as before. In this ca
the entire frame. t
for
ms
8
onal
additi
an
of the frame to arrive and

leading edge

488 ms. The actual transmission time~ |
arrive. The ACK arrives back at T at f =
j
time to transmit the first frame and refor'the first frame was 8 ms, but the total

“Geive'and ACK is 488:ms.


:

Sliding-Window Flow Control

be
so far is that only one frame at a time can
The essence of the problem described
frame
the
than
er
great
is
length of the link
in transit. In situations where the bit
. Efficiency can be greatly improved by
result
cies
icien
ineff
length (a > 1), serious
at the same time.
allowing multiple frames to be in transit
via a
for two stations, A and B, connected
Let us examine how this might work
t W
accep
can

B
Thus,
s.
frame
W
r space for
full-duplex link. Station B allocates buffe
owledgframes, and A

is allowed to send W

frames without waiting for any ackn

been acknowledged, each is labeled with
ments. To keep track of which frames have
an acknowledgment that in-

frame by sending
a sequence number. B acknowledges a
also
frame expected. This acknowledgment
cludes the sequence number of the next
with
g
nnin
receive the next W frames, begi
implicitly announces that B is prepared to
s.
be used to acknowledge multiple frame
also

the number specified. This scheme can
until
nt
dgme
owle

and 4, but withhold ackn
For example, B could receive frames 2, 3,
owledgment with sequence number 5,
ackn
an
ning
frame 4 has arrived. By then retur
one time. A maintains a list of sequence
B acknowledges frames 2, 3, and 4 at


7.1/FLOW CONTROL

213

numbers that it is allowed to send, and B maintains a list of sequence numbers that it
is prepared to receive. Each of these lists can be thought of as a window of frames.
The operation is referred to as sliding-window flow control.
Several additional comments need to be made. Because the sequence number
to be used occupies a field in the frame, it is clearly of bounded size. For example,
for a 3-bit field, the sequence number can range from 0 to 7. Accordingly, frames

are numbered modulo 8; that is, after sequence number 7, the next number is 0. In


general, for a k-bit field the range of sequence numbers is 0 through 2" ~ 1, and

frames are numbered modulo 2*. As wilt be shown subsequently, the maximum

window size is 2* — 1.

Figure 7.3 is a useful way of depicting the sliding-window process. It assumes
the use of a 3-bit sequence number, so that frames are numbered sequentially from

0 through 7, and then the same numbers are reused for subsequent frames. The

shaded rectangle indicates the frames that may be sent: in this figure, the sender may
transmit five frames, beginning with frame 0. Each time a frame is sent, the shaded
window shrinks; each time an acknowledgment is received, the shaded window

grows. Frames between the vertical bar and the shaded window have been sent but
not yet acknowledged. As we shall see, the sender must buffer these frames in case
they need to be retransmitted.
The window size need not be the maximum possible size for a given sequence
number length. For example, using a 3-bit sequence number, a window size of 4

could be configured for the stations using the sliding-window flow control protocol.
Frames buffered
until acknowledged
Frames already transmitted

seep

OP


LL

273;

that may be transmitted

4 tS Pot
/

Frame

sequence
number

Lastframe
acknowledged

|.
Window of frames



Lastframe
transmitted

7] O}

by 2p

spa]


——>

Window shrinks from

trailing edge as
frames are sent

5]

6]

7 fee

——

Window expands

from leading edge
as ACKs are received

(a) Sender's perspective

Window of frames
that may be accepted

OF

LG


2]

3

Last frame

acknowledged

6;

wa

eos]

P=

Frames already received

/

Lastframe
Teceived

7/0

—=

)71]2]3
}4)]5 4 6] 7 [eee


Window shrinks from

¿

fi

ag edge ar

mes are received

(bị Receiver's perspective
Figure 7.3)

Sliding- Window Depiction

m

Window expands

from leading edge

as ACKs are sent

.


CHAPTER

7 / DATA


LINK

CONTROL

PROTOCOLS
Destination System B

Source System A


——
[ðITIZI3T4I5I6|7I8TITZTa14i5Ts1zÏ



1617]
ISI
710] [2131415
I.IAIE
stats
Tia
IIEIs76]I8IIIS
-BIIEB

__
—m


——


iERiznIizniistr
1smzBE—
Cd

ao
3]4]šI617I8ØIr[Z1314[5Isl]

4-PHTZISTATSTs|710[1T2T21415T617Ì
4

RR3

:

244

-

617 |
lt 23141511
7fo516
[ori [2 [34

BL
tạ

ts

[SIEEI4EIEITISITEIZT4ISTe71



me
HHHEDIEILSEILTHE
CHỦ RIEIEIOTURE..2
——
[8IIIZISI4IsIE|7TðTTTZI2I+IsIsIr]
Figure 7.4

Example of a Sliding-Window Protocol

sequence
An example is shown in Figure 7.4. The example assumes a 3-bit

A and B have
number field and a maximum window size of seven frames. Initially,

with frame 0 (FO).
windows indicating that A may transmit seven frames, beginning
nt,A has shrunk
After transmitting three frames (F0, F1, F2) without acknowledgme

transmitted frames. The
its window to four frames and maintains a copy of the three
with frame number 3.
window indicates that A may transmit four frames, beginning

all frames
B then transmits an RR (receive ready) 3, which means “I have received
3; in fact, lam
up through frame number 2 and am ready to receive frame number


this , A is
prepared to receive seven frames, beginning with frame number 3.” With
3; also A
frame
back up to permission to transmit seven frames, still beginning with
A proceeds to
may discard the buffered frames that have now been acknowledged.
and allows
F3,
edges
transmit frames 3, 4, 5, and 6. B returns RR 4, which acknowl
reaches A,
RR
this
time
transmission of F4 through the next instance of F2. By the
window
its
open
only
may
it has already transmitted F4, FS, and F6, and therefore A

to permit sending four frames beginning with F7.
The mechanism so far described does indeed provide a form of flow control:
one it has
The receiver must only be able to accommodate seven frames beyond the
of frames
flow

the
off
cut
to
station
a
last acknowledged. Most protocols also allow
from the other side by sending
acknowledges former frames but
means “I have received all frames
more.” At some subsequent point,
to reopen the window.

a Receive Not Ready (RNR) message, which
forbids transfer of future frames. Thus, RNR 5
up through number 4 but am unable to accept any
the station must send a normal acknowledgment


7.2 / ERROR

CONTROL

215

So far, we have discussed transmission in one direction only. If two stations exchange data, each needs to maintain two windows, one for transmit and one for re-

ceive, and each side needs to send the data and acknowledgments to the other. To
provide efficient support for this requirement, a feature known as piggybacking is


typically provided. Each data frame includes a field that holds the sequence number
of that frame plus a field that holds the sequence number used for acknowledgment.

Thus, if a station has data to send and an acknowledgment to send, it sends both together in one frame, saving communication capacity. Of course, if a station has an
acknowledgment but no data to send, il sends a separate acknowledgment frame,

such as RR or RNR. If a station has data to send but no new acknowledgment to

send, it must repeat the last acknowledgment sequence number that it sent. This is
because the data frame includes a field for the acknowledgment number, and some

value must be put into that ficld. When a

station receives a duplicate acknowledg-

ment, it simply ignores it.

Sliding-window flow control is potentially much more efficient than stop-andwait flow control. The reason is that, with sliding-window flow control, the transmis-

sion link is treated as a pipeline that may be filled with frames in transit. In contrast,
with stop-and-wait flow control, only one frame may be in the pipe at a time. Ap-

pendix 7A quantifies the improvement in efficiency.

Example 7.2 Let us consider the use of sliding-window flow control for the two
configurations of Example 7.1. As was calculated in Example 7A, it takes. 10 ps ©

- for. an ACK to the first frame to be received. It takes 8 psto transmit one frame

so the sender can transmit one frame and part of a second frame by the time th

ACK to the first frame is received. Thus, a window size of 2 is adequate to enable
“the sender to transmit frames continuously, or a rate of one frame every 8s.
With

stop-and-wait, a rate of only one frame per LŨ ps is possible.

For the satellite
frame to be received.
transmit 61 frames by
‘window size of 6 bits
“of one frame every 8

:
:

configuration, it takes 488 ms for an ACK to the first
It takes 8 ms to transmit one frame, so the sender can
the time the ACK to the first frame is received. With a’
or more, the sender can transmit continuously, ora rate
ms. If the window size is 7, using a 3-bit window field,

then the sender can only send 7 frames and then must wait for an ACK before

~ sending more. In this case, the sender can transmit at a rate of 7 frames per
488 'ms, or about one frame evéry 70 ms. With stop-and-wait, a rate of only one

frame per 488 ms is possible.

72


ERROR CONTROL
Error control refers to mechanisms to detect and correct errors that occur in the
transmission of frames. The model that we will use, which covers the typical case, is
illustrated in Figure 7.1b. As before. data are sent as a sequence of frames; frames ar-

tive in the same order in which they are sent and each transmitted frame suffers an

arbitrary and potentially variable amount of delay before reception. In addition, we
admit the possibility of two types of crrors:


CUAPLER

7 / DAEA

© Lost frame:

CONTROL

LINK

PROPOCUES

A frame fails to arrive at the other side. For example, a noise burst

may damage a frame to the extent that the receiver is nol aware that a frame
has been transmitted.
¢ Damaged frame: A recognizable trame does arrive, but some of the bits are
in error (have been altered during transmission).


The most common techniques for error control are based on some or all of the

following ingredients:

¢ Error detection:

As discussed in Chapter 6.

* Positive acknowledgment:

The destination returns a positive acknowledgment

to successfully received, error-free frames.

* Retransmission after timeout: The source retransmits a frame that has not
been acknowledged after a predetermined amount of time.
¢ Negative acknowledgment and retransmission: The destination returns a negative acknowledgment to frames in which an error is detected. The source
retransmits such frames.
Collectively, these mechanisms are all referred to as automatic repeat request
(ARQ); the effect of ARQ is to turn an unreliable data link into a reliable one.
Three versions of ARQ have been standardized:
Stop-and-wait ARO
Go-back-N ARQ

Selective-reject ARQ

All of these forms are based on the use of the flow control techniques
discussed in Section 7.1. We examine each in turn.
Stop-and-Wait ARQ
e outlined

Stop-and-wait ARQ is based on the stop-and-wait flow control techniqu
an acawait
must
then
and
frame
single
a
transmits
station
source
previously. The

knowledgment (ACK). No other data frames can be sent until the destination
station’s reply arrives at the source station.
ion
Two sorts of errors could occur. First, the frame that arrives at the destinat
e
techniqu
ection
could be damaged. The receiver detects this by using the error-det
the
y,
possibilit
this
for
referred to earlier and simply discards the frame. To account
stasource station is equipped with a timer. After a frame is transmitted, the source
time
the

by
received
is
edgment
tion waits for an acknowledgment. If no acknowl
that the timer expires, then the same frame is sent again. Note that this method

until an
requires that the transmitter maintain a ‘copy of a transmitted frame
acknowledgment is received for that frame.
followThe second sort of error is a damaged acknowledgment. Consider the
B,
station
by
correctly
received
is
frame
The
ing situation. Station A sends a frame.

which responds with an acknowledgment (ACK). The ACK

is damaged in transit

the same
and is not recognizable by A, which will therefore time out and resend
accepted
therefore
has

B
B.
by
accepted
is
and
arrives
frame
frame. This duplicate

To avoid this problem, frames
two copies of the same frame as if they were separate.


72 /ERROIR CONTROIL

217

are alternately labeled with 0 or 1, and positive acknowledgments are of the form

ACKO and ACKL. In keeping with the sliding-window convention, an ACKO acknowledges receipt of a frame numbered | and indicates that the receiver is ready
for a frame numbered 0.
Figure 7.5 gives an example

of the use of stop-and-wait ARQ,

showing

the


transmission of a sequence of frames from source A to destination B. The figure

shows the two types of errors just described. The third frame transmitted by Ais lost
or damaged and therefore no ACK is returned by B.A times out and retransmits the
frame. Later, A transmits a frame

labeled

1 but the ACKO

for that frame

is lost. A

times out and retransmits the same frame. When B receives two frames in a row with
the same label, it discards the second frame but sends back an ACKO to each.

Frame trans-

mission time

Propagation

Pagation titime ‡

œ

A
:


~:

FT
Lị

fram,

| -+---7
Ste
ACK

| a] ¥ ACK trans‡ mission time

2

Timeout interval

ỄE

Frame @ lost:

A retransmits

-

Timeout interval
ACKO

3


À

cK

lost:

A retransmits LÍ

“0

ee

Figure 7.5

‡—] B discurds
duplicate trame

Stop-and-Wait ARQ


218

CHAPTER

7 / DATA

LINK

CONTROL


PROTOCOLS

The principal advantage of stop-and-wait ARQ is its simplicity. Ets principal
mechdisadvantage, as discussed in Section 7.1, is that stop-and-wail is an inefficient
more
provide
anism. The sliding-window flow control technique can be adapted to
s ARQ.
efficient line use; in this context, it is sometimes referred to as continuou

Go-Back-N

ARQ

is most commonThe form of error control based on sliding-window flow control that
series of frames
a
send
may
station
a
ly used is called go-back-N ARO. In this method,

of unacknowlsequentially numbered modulo some maximum value. The number

sliding-window flow
edged frames outstanding is determined by window size, using the
edge incoming
acknowl
will

on
destinati
the
control technique. While no errors occur,
If the destit).
edgemen
acknowl
ked
piggybac
or
frames as usual (RR = receive ready,
edgment
acknowl
negative
a
send
may
il
frame,
nation station detects an error in a

destination sta(REJ = reject) for that frame, as explained in the following rules. The

the frame in error is
tion will discard that frame and all future incoming frames until
must retransmit the
REJ,
a
receives
it

when
station,
correctly received. Thus, the source

interim.
frame in error plus all succeeding frames that were transmitted in the
transmission,
each
After
B.
station
to
frames
sending
is
Suppose that station A
that B has
Suppose
ted.
transmit
just
frame
the
for
timer
A sets an acknowledgment
ted frame i.
previously successfully received frame (i — 1) and A has just transmit
ncies:
The go-back-N technique takes into account the following continge

B detects an error, or the
1. Damaged frame. If the received frame is invalid (i.e.,
e that it has received
frame is so damaged that B does not even perceiv

as the result of
a frame), B discards the frame and takes no further action
that frame. There are two subcases:

frame (i + 1).
a. Within a reasonable period of time,A subsequently sends
must retransA
i.
REJ
a
B receives frame (i + 1) out of order and sends
mit frame i and all subsequent frames.

es nothing and returns
b. A does not soon send additional frames. B receiv
RR
neither an RR

nor a REJ. When

A’s timer expires, it transmits an

set to 1. B interprets
frame that includes a bit known as the P bit, which is
be acknowledged

must
that
nd
comma
a
as
1
the RR frame with a P bit of
, which is frame
expects
it
that
frame
next
by sending an RR indicating the

¿. Alternatively, A could
i. When A receives the RR, it retransmits frame

just retransmit frame i when its timer expires.
2. Damaged RR. There are two subcases:
error in transit.
a. B receives frame i and sends RR (i + 1), which suffers an
means that all
6
RR
(e.g.,
Because acknowledgments are cumulative
receive a subwill
A

that
be
frames through 5 are acknowledged), it may
the timer
before
arrive
will
it
sequent RR to a subsequent frame and that
associated with frame i expires.
b. If A’s timer expires, it transmits an RR command

as in Case 1b. It sets

to the RR
another timer, calied the P-bit timer. If B fails to respond

com-

timer will
mand, or if its response suffers an error in transit, then A’s P-bit


7.2 / ERROR

CONTROL

219

expire. At this point, A will try again by issuing a new RR command and


restarting the P-bit timer. This procedure is tried for a number of iterations. If A fails to obtain an acknowledgment after some maximum num-

ber of attempts, it initiates a reset procedure.
3. Damaged REJ. If a REJ is lost, this is equivalent to Case Lb.

Figure 7.6a is an example of the frame flow tor go-back-N ARQ. Because of
the propagation delay on the line, by the time that an acknowledgment (positive or
negative) arrives back at the sending station, it has already sent at least one additional

frame

beyond

the one

being

acknowledged.

In this example,

Discarded by

receiver

4 retransmitted

retransmitted


Timeout

{a} Ga-back-N ARQ
Figure 7.6

Stiding- Window ARQ

(b) Selective-reject ARQ
Protocols

4 is

Buffered by
receiver

4, 5, and 6

Timeout

frame


7 / DATA

CHAPVER

LHNK

CONTROTE


PO TOCOLS

damaged. Frames 5 and 6 are received out of order and are discarded by B. When

frame 5 arrives, B immediately sends a REJ 4. When the REJ to frame 4 is recvived,

not only frame 4 but frames 5 and 6 must be retransmitted. Note that the transmitter must keep a copy of all unacknowledged frames.
In Section 7.1, we mentioned that for a k-bit sequence

number

field, which

provides a sequence number range of 2* the maximum window size is limited to
2* — 1. This has to do with the interaction between error control and acknowledgment. Consider that if data are being exchanged in both directions, station B must

send piggybacked acknowledgments to station A’s frames in the data frames being
transmitted by B, even if the acknowledgment

has already been sent. As we have

mentioned, this is because B must put some number in the acknowledgment field of
its data frame. As an example, assume a 3-bit sequence number (sequence number
space = 8). Suppose a station sends frame 0 and gets back an RR 1, and then sends

frames 1,2,3,4,5,6, 7,0 and gets another RR 1.This could mean that all eight frames

were received correctly and the RR ! is a cumulative acknowledgment. It could also
mean that all eight frames were damaged or lost in transit, and the receiving station
is repeating its previous RR 1.The problem is avoided if the maximum window size


is limited to 7(22 — 1).

Selective-Reject ARQ

With selective-reject ARQ, the only frames retransmitted are those that receive a

negative

acknowledgment,

in this case called SREJ, or those that time

out. Fig-

a
ure 7.6b illustrates this scheme. When frame 5 is received out of order, B sends
B continues to acSRE] 4, indicating that frame 4 has not been received. However,

point,
cept incoming frames and buffers them until a valid frame 4 is received. At that
B can place the frames in the proper order for delivery to higher-layer software.

it
Selective reject would appear to be more efficient than go-back-N, because
must
receiver
the
hand,
other

the
On
minimizes the amount of retransmission.

in error is
maintain a buffer large enough to save post-SREJ frames until the frame
seproper
the
in
frame
that
g
reinsertin
for
retransmitted and must contain logic
frame
a
send
to
able
be
to
logic
complex
more
quence. The transmitter, too, requires

much less
out of sequence. Because of such complications, select-reject ARQ is
a satellite

for
choice
useful
a
is
reject
Selective
widely used than go-back-N ARQ.
involved.
delay
on
propagati
link because of the long

than for goThe window size limitation is more restrictive for selective-reject

Allow
back-N. Consider the case of a 3-bit sequence number size for selective-reject.
:
[TANE03]
scenario
following
the
consider
and
seven,
a window size of
ht

. Station A sends frames 0 through 6


to station B.

ew

nv

7.
. Station B receives all seven frames and cumulatively acknowledges with RR
Because of a noise burst, the RR 7

is lost.

. A times out and retransmits frame 0.
and
. B has already advanced its receive window to accept frames 7,0, 1,2,3,4,
0,
frame
new
a
is
this
that
and
lost
been
5. Thus it assumes that frame 7 has
which it accepts.

on


220


73

/0IGE-LEVEL

DATA

LINK

CONTROL

(HDLC)

221

The problem with the foregoing scenario is that there is an overlap between

the sending and receiving windows. To overcome the problem, the maximum window size should be no more than half the range of sequence numbers. In the preceding scenario, if only four unacknowledged frames may be outstanding, no
confusion can result. In general, for a K-bit sequence number field, which provides a

sequence number range of 2*, the maximum window size is limited to VN

7.3

‘HIGH-LEVEL DATA LINK CONTROL

(HDLC)


The most important data link control protocol is HDLC (ISO 3009, ISO 4335). Not
only is HDLC widely used, but it is the basis for many other important data link
* control protocols, which use the same or similar formats and the same mechanisms
as employed in HDLC.

Basic Characteristics
To satisfy a variety of applications, HDLC defines three types of stations, two link
configurations, and three data transfer modes of operation. The three station types
are as follows:

* Primary station:

Responsible for controlling the operation of the link. Frames

issued by the primary are called commands.
* Secondary station: Operates under the control of the primary station. Frames
issued by a secondary are called responses. The primary maintains a separate
logical link with each secondary station on the line.
* Combined station: Combines the features of primary and secondary. A combined station may issue both commands and responses.
The two link configurations are as follows:

* Unbalanced configuration: Consists of one primary and one or more secondary stations and supports both full-duplex and half-duplex transmission.
* Balanced configuration: Consists of two combined stations and supports both
full-duplex and half-duplex transmission.
The three data transfer modes are as follows:

n.
* Normal response mode (NRM): Used with an unbalanced configuratioThe
primary may initiate data transfer to a secondary, but a secondary may only

transmit data in response to a command from the primary.
* Asynchronous balanced mode (ABM): Used with a balanced configuration.

Either combined station may initiate transmission without receiving permission from the other combined station.
* Asynchronous response mode (ARM): Used with an unbalanced configuration. The secondary may initiate transmission without explicit permission of
the primary. The primary still retains responsibility for the line, including inialization, error recovery, and logical disconnection.


222

WS

PROTOCS

CONTROL

LINK

7 / DATA

CHAPTER

is used on multidrop lines, in which a number of terminals are connect:

NRM

ed to a host computer. The computer polls cach terminal for input. NRM

is also


a terminal
sometimes used on point-to-point links, particularly if the link connects
modes?
three
the
of
used
widely
most
the
is
ABM
.
or other peripheral to a computer

there is no
it makes more efficient use of a full-duplex point-to-point link because
s in
situation
special
some
to
le
applicab
is
it
used;
rarely
is
polling overhead. ARM

which a secondary may need to initiate transmission.
Frame

Structure

form of frames,
HDLC uses synchronous transmission. All transmissions are in the
exchanges.
and a single frame format suffices for all types of data and control
and conFigure 7.7 depicts the structure of the HDLC frame. The flag, address,
and
FCS
The
trol fields that precede the information field are known as a header.
flag fields following the data field are referred to as a trailer.
Flag Fields

pattern OLI11110.A
Flag fields delimit the frame at both ends with the unique
opening flag for the
the
and
frame
one
single flag may be used as the closing flag for

+<—

3


16 or 32

variable

Bor 16

38> +8:
extendable
bits

.Flag -

-

FCS.

Information `

Control

Address

°* Flag |

(a) Frame format

1L

bị


2

5

4

3



8

7

6

]-- GL

PFE

N(R)
N(R)

S: Supervisory

19"

5

PEF


U: Unnumbered

1,1

M_

[BE

-

7

6

5

4

7 N(S}

91.

I: Information

§n

l6

l4 1ã


8

N(S) = Send sequence number
.|

*

N(R) = Receive sequence number
S = Supervisory function bits

M = Unnumbered function bits
P/E = Pol/ñnal bit

M

(c) 8-bit control field format

1

2

Information | 9
Supervisory | 1-|

0

4

3


5

NG)

a
s

le

7

6

cone

8

9

1

pm

lelalolr|-

(d) 16-bit control field format

Figure 7.7


|

(b) Extended address field

3

2

1

[ol

13

101112

9

HDLC Frame Structure

IW

Ps
2

2

13

NR

NW.

Sy


7.3 / HIGH-LEVEL

DATA LINK CONTROL

(HDLC)

223

next, On both sides of the user-network interface, receivers are continuously hunting

a frame,
for the flag sequence to synchronize on the start of a frame. While receiving
frame.
the
of
end
the
determine
to
sequence
that
for
hunt
to
a station continues

are no
there
(ie.,
patterns
bit
arbitrary
of
presence
the
allows
protocol
Because the
there
protocol),
link
the
by
imposed
fields
various
the
of
content
the
on
restrictions
the
inside
e
somewher

appear
not
will
01111110
pattern
the
that
is no assurance
To avoid this problem, a procedure known as
frame, thus destroying synchronization.
the
bit stuffing is used. Between the transmission of the starting and ending flags,
the
in
1s
transmitter will always insert an extra 0 bit after each occurrence of five
a
When
stream.
bit
frame. After detecting a starting flag, the receiver monitors the
the
If
deleted.
is
it
pattern of five ls appears, the sixth bit is examined. If this bit is 0,

sixth bit is a 1 and the seventh bit is a 0, the combination is accepted asa flag. If the
sixth and seventh bits are both 1, the sender is indicating an abort condition.


With the use of bit stuffing, arbitrary bit patterns can be inserted into the data
field of the frame. This property is known as data transparency.
Figure 7.8 shows an example of bit stuffing. Note that in the first two cases, the
extra 0 is not strictly necessary for avoiding a flag pattern but is necessary for the
operation of the algorithm. The pitfalls of bit stuffing are also illustrated in this figure. When a flag is used as both an ending and a starting flag, a I-bit error merges
two frames into one. Conversely, a i-bit error inside the frame could split it in two.

Original pattern:
111111111111011111101111110
After bit stuffing:

111118111116110111118Ø1011111810
(a) Example

1

>

|

`

|

Transmitted frame

}-«<——— Bit inverted
| Flag |


[Fug

| Fiag |

}

Received frame

(b) An inverted bit splits a frame in two

|

[Ftag |

l

[Frag |

Transmitted frame

| Ftag |

Received frame

en AE
pester

~<———— Bit inverted

.


[Ftag |

(c) An inverted bit merges two Frames

Figure 7.8

Bit Stuffing


224

CHAPTER

7 / DATA

LINK

CONTROL

PROTOCOLS

Address Field

The address field identifies the secondary station that transmitted or is to re-

ceive the frame. This field is not needed for point-to-point links but is always included for the sake of uniformity. The address field is usually 8 bits long but, by prior

agreement, an extended format may be used in which the actual address
multiple of 7 bits. The leftmost bit of each octet is 1 or 0 according as it

the last octet of the address field. The remaining 7 bits of cach octet form
address. The single-octet address of 11111111 is interpreted as the
address in both basic and extended formats. It is used to allow the
broadcast a frame for reception by all secondaries.

length is a
is or is not
part of the
ail-stations
primary to

Control Field

HDLC defines three types of frames, each with a different control field format. Information frames (1-frames) carry the data to be transmitted for the user
(the logic above HDLC that is using HDLC). Additionally, flow and error control
data, using the ARQ mechanism, are piggybacked on an information frame.
ing
Supervisory frames (S-frames) provide the ARQ mechanism when piggyback
control
link
tal
is not used. Unnumbered frames (U-frames) provide supplemen

frame
functions. The first one or two bits of the control field serve to identify the

in Figtype. The remaining bit positions are organized into subfields as indicated

ures 7.7c and d. Their use is explained in the discussion of HDLC operation later
in this chapter.

All of the control field formats contain the poll/final (P/F) bit. Its use depends

is set to 1
on context. Typically, in command frames, it is referred to as the P bit and
frames, it
response
In
entity.
HDLC
to solicit (poll) a response frame from the peer
d as
transmitte
frame
response
the
indicate
is referred to as the F bit and is set to | to

a result of a soliciting command.
numNote that the basic control field for S- and I-frames uses 3-bit sequence
be
can
field
control
extended
an
command,
bers. With the appropriate set-mode
always
U-frames

numbers.
sequence
7-bit
used for S- and I-frames that employs
contain an 8-bit control field.
Information Field

The

information field is present only in I-frames and some

U-frames. The

of
field can contain any sequence of bits but must consist of an integral number
efined
system-d
some
to
up
variable
is
octets. The length of the information field
maximum.

Frame Check Sequence Field

d from
The frame check sequence (FCS) is an error-detecting code calculate
16-bit

the
is
code
normal
The
the remaining bits of the frame, exclusive of flags.

may be
CRC-CCITT defined in Section 7.2. An optional 32-bit FCS, using CRC-32,
choice.
this
dictates
y
employed if the frame length or the line reliabilit


7.3 / HIGH-LEVEL DATA LINK CONTROL

(HDLC)

225

Operation

HDLC operation consists of the exchange of I-frames, S-frames, and U-frames between two stations. The various commands and responses defined for these frame
types are listed in Table 7.1. In describing HDLC operation, we will discuss these

three types of frames.
The operation of HDLC involves three phases. First, one side or another
initializes the data link so that frames may be exchanged in an orderly fashion.

During this phase, the options that are to be used are agreed upon. After initialization, the two sides exchange user data and the control information to exercise
flow and error control. Finally, one of the two sides signals the termination of the
operation.

Tabie 7.1.

HDLC Commands and Responses
Description

-Name
- .Exchange user data

}. Information
(1)

ative
e :Selective reject (SREI
‘Vanumbered (Đ)

Acknowledgment; sở bị

Negative acknowledgment; selective Teje


2 Set normat Tésponsé:

Ss (SNRMISNRME)

Set asynchronous respon:
7> mode (SARM/SARME}

hi
et asynchronous balanced

Set mode; exténded =

¡; mode (SABM,SABME)

Sét initialization mode (SIM) <8

2)

Se
sens
Disconnect (DISC) °
Í _ -Unnumbered acknowledgment (UA)
;
SẼ
go

Disconnected mode (DM}

R

.

Initialize link control fu

ee Terminate logical link connection - LẦN:
‘Acknowledge acceptance
of one of the set-mode

I
:
- ' .€dmmandsˆ

Responder is int disconnected mode

"...

Request disconnect (RD)
Request initialization mode (RIM)...
Unanumbered information (UI)
Unnumbered poli (UP)
Reset (RSET)
Exchange identification (XID)
‘est (TEST)
Frame reject (FRMR)

ee,

R
R
cr
me
c
CIR
CIR
R

`
Request for DISC command

Initialization needed; request for SIM. command
Used to exchange. control information
Used to solicit control information
Used for recovery; resets N(R), N(S}
Used to request/report status
Exchange identical information fields for testing
Report receipt of unacceptable frame


226

CHAPTER

7 / DATA

LINK

Initialization

Initialization may

CONTROL

PROTOCOLS

setbe requested by either side by issuing one of the six

mode commands. This command serves three purposes:
ted.
1. It signals the other side that initialization is reques


ARM)
2. It specifies which of the three modes (NRM, ABM,

is requested.

to be used.
3. It specifies whether 3- or 7-bit sequence numbers are

module on that end
If the other side accepts this request, then the HDLC
the initiating side. If
to
back
transmits an unnumbered acknowledged (UA) frame
sent.
is
frame
the request is rejected, then a disconnected mode (DM)
Data Transfer

accepted, then a logical conWhen the initialization has been requested and
data in ]-frames, starting
user
send
to
begin
nection is established. Both sides may
of the I-frame are sequence
with sequence number 0. The N(S) and N(R) fields


An HDLC module sending a
numbers that support flow control and error control.
modulo 8 or 128, depending on
sequence of I-frames will number them sequentially,
and place the sequence number in
whether 3- or 7-bit sequence numbers are used,
ed; it enables the HDLC
N(S). N(R) is the acknowledgment for I-frames receiv
s to receive next.
module to indicate which number I-frame it expect
error control. The receive ready
and
l
contro
flow
for
S-frames are also used

by indicating the next I-frame
(RR) frame acknowledges the last I-frame received
user data traffic (I-frames) to
expected. The RR is used when there is no reverse
as
e not ready (RNR) acknowledges an I-frame,
carry an acknowledgment. Receiv
transmission of I-frames. When the
with RR, but also asks the peer entity to suspend
go-back-N


REJ initiates the
entity that issued RNR is again ready, it sends an RR.
has been rejected and that retransARO. It indicates that the last 1-frame received
is required. Selective reject
mission of all I-frames beginning with number N(R)
a single frame.
(SREJ) is used to request retransmission of just
Disconnect

either on its own initiative if
Either HDLC module can initiate a disconnect,
issues a

its higher-layer user. HDLC
there is some sort of fault, or at the request of

The remote entity must accept
disconnect by sending a disconnect (DISC) frame.
its layer 3 user that the connecthe disconnect by replying with a UA and informing
be lost,
nowledged I-frames may
tion has been terminated. Any outstanding unack

and their recovery is the responsibility of higher layers.

Examples of Operation
es are presented in FigTo better understand HDLC operation, several exampl
a legend that specifies the
ure 7.9. In the example diagrams, each arrow includes
of N(R)


appropriate, the values
frame name, the setting of the P/F bit, and, where
ation is present and 0 if absent.
design
the
if
1
is
bit
F
or
P
the
and N(S). The setting of
setup and disconnect. The
Figure 7.9a shows the frames involved in link

nd to the other side and
HDLC protocol! entity for one side issues an SABM comma
s a UA response and
return
upon receiving the SABM,

starts a timer. The other side,



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×