Transcript
8/12/2019 Data Link Control Framing
1/79
11.1
Chapter 11Data Link Control
Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
8/12/2019 Data Link Control Framing
2/79
11.2
11-1 FRAMING
The data l ink layer needs to pack bits into frames, so
that each f rame is distinguishable from another.
Fixed-Size Framing
Variable-Size Framing
Topics discussed in this section:
8/12/2019 Data Link Control Framing
3/79
11.3
Figure 11.1 A frame in a character-oriented protocol
8/12/2019 Data Link Control Framing
4/79
11.4
Figure 11.2 Byte stuff ing and unstuf f ing
8/12/2019 Data Link Control Framing
5/79
11.5
Byte stuffing is the process of adding 1extra byte whenever there is a flag or
escape character in the text.
Note
8/12/2019 Data Link Control Framing
6/79
11.6
Figure 11.3 A frame in a bit-ori ented protocol
8/12/2019 Data Link Control Framing
7/7911.7
Bit stuffing is the process of adding one
extra 0 whenever five consecutive 1s
follow a 0 in the data, so that the
receiver does not mistake
the pattern 0111110 for a flag.
Note
8/12/2019 Data Link Control Framing
8/7911.8
Figure 11.4 Bi t stuff ing and unstuff ing
8/12/2019 Data Link Control Framing
9/7911.9
11-2 FLOW AND ERROR CONTROL
The most important responsibil i ties of the data link
layer are f low controland error control. Collectively,
these functions are known as data l ink control.
Flow Control
Error Control
Topics discussed in this section:
8/12/2019 Data Link Control Framing
10/7911.10
Flow control refers to a set of proceduresused to restrict the amount of data
that the sender can send before
waiting for acknowledgment.
Note
8/12/2019 Data Link Control Framing
11/7911.11
Error control in the data link layer isbased on automatic repeat request,
which is the retransmission of data.
Note
8/12/2019 Data Link Control Framing
12/7911.12
11-3 PROTOCOLS
Now let us see how the data link layer can combine
framing, flow control, and error control to achieve thedelivery of data from one node to another.
8/12/2019 Data Link Control Framing
13/7911.13
Figure 11.5 Taxonomy of protocols discussed in this chapter
8/12/2019 Data Link Control Framing
14/7911.14
11-4 NOISELESS CHANNELS
Let us first assume we have an ideal channel in which
no frames are lost, duplicated, or corrupted. We
introduce two protocols for this type of channel.
Simplest ProtocolStop-and-Wait Protocol
Topics discussed in this section:
8/12/2019 Data Link Control Framing
15/7911.15
Figure 11.6 The design of the simplest protocol wi th no flow or error control
8/12/2019 Data Link Control Framing
16/7911.16
Algorithm 11.1 Sender-site algor ithm for the simplest protocol
8/12/2019 Data Link Control Framing
17/7911.17
Algorithm 11.2 Receiver-site algori thm for the simplest protocol
8/12/2019 Data Link Control Framing
18/7911.18
F igure 11.7 shows an example of communication using
this protocol. I t is very simple. The sender sends a
sequence of frames without even thinking about the
receiver.
Example 11.1
8/12/2019 Data Link Control Framing
19/7911.19
Figure 11.7 F low diagram for Example 11.1
8/12/2019 Data Link Control Framing
20/79
11.20
Figure 11.8 Design of Stop-and-Wait Protocol
8/12/2019 Data Link Control Framing
21/79
11.21
F igure 11.9 shows an example of communication using
this protocol. I t is sti l l very simple. The sender sends one
frame and waits for feedback from the receiver. When the
ACK arr ives, the sender sends the next frame. Note that
sending two frames in the protocol involves the sender infour events and the receiver in two events.
Example 11.2
8/12/2019 Data Link Control Framing
22/79
11.22
Figure 11.9 F low diagram for Example 11.2
8/12/2019 Data Link Control Framing
23/79
11.23
11-5 NOISY CHANNELS
Although the Stop-and-Wait Protocol gives us an idea
of how to add f low control to i ts predecessor, noiseless
channels are nonexistent. We discuss three protocols
in this section that use error control.
Stop-and-Wait Automatic Repeat RequestGo-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request
Topics discussed in this section:
8/12/2019 Data Link Control Framing
24/79
11.24
Error correction in Stop-and-Wait ARQ is
done by keeping a copy of the sentframe and retransmitting of the frame
when the timer expires.
Note
8/12/2019 Data Link Control Framing
25/79
11.25
In Stop-and-Wait ARQ, we use sequence
numbers to number the frames.The sequence numbers are based on
modulo-2 arithmetic.
Note
8/12/2019 Data Link Control Framing
26/79
11.26
In Stop-and-Wait ARQ, the
acknowledgment number always
announces in modulo-2 arithmetic the
sequence number of the next frame
expected.
Note
8/12/2019 Data Link Control Framing
27/79
11.27
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol
8/12/2019 Data Link Control Framing
28/79
11.28
Algorithm 11.5 Sender-site algor ithm for Stop-and-Wait ARQ
(cont inued)
8/12/2019 Data Link Control Framing
29/79
11.29
Algorithm 11.5 Sender-site algor ithm for Stop-and-Wait ARQ (cont inued)
8/12/2019 Data Link Control Framing
30/79
11.30
Algorithm 11.6 Receiver-site algor ithm for Stop-and-Wait ARQ Protocol
E l 11 3
8/12/2019 Data Link Control Framing
31/79
11.31
F igure 11.11 shows an example of Stop-and-Wait ARQ.
F rame 0 is sent and acknowledged. Frame 1 is lost and
resent after the time-out. The resent frame 1 is
acknowledged and the timer stops. Frame 0 is sent and
acknowledged, but the acknowledgment is lost. Thesender has no idea if the frame or the acknowledgment
is lost, so after the time-out, it resends frame 0, which is
acknowledged.
Example 11.3
8/12/2019 Data Link Control Framing
32/79
8/12/2019 Data Link Control Framing
33/79
11.33
In the Go-Back-N Protocol, the sequence
numbers are modulo 2m,where m is the size of the sequence
number field in bits.
Note
8/12/2019 Data Link Control Framing
34/79
11.34
Figure 11.12 Send window for Go-Back-N ARQ
8/12/2019 Data Link Control Framing
35/79
11.35
The send window can slide oneor more slots when a valid
acknowledgment arrives.
Note
8/12/2019 Data Link Control Framing
36/79
11.36
Figure 11.13 Receive window for Go-Back-N ARQ
8/12/2019 Data Link Control Framing
37/79
11.37
The receive window is an abstract
concept defining an imaginary box
of size 1 with one single variable Rn.The window slides
when a correct frame has arrived;
sliding occurs one slot at a time.
Note
8/12/2019 Data Link Control Framing
38/79
11.38
Figure 11.14 Design of Go-Back-N ARQ
8/12/2019 Data Link Control Framing
39/79
11.39
In Go-Back-N ARQ, the size of the send
window must be less than 2m
;the size of the receiver window
is always 1.
Note
Example 11 6
8/12/2019 Data Link Control Framing
40/79
11.40
Example 11.6
F igure 11.16 shows an example of Go-Back-N. This is an
example of a case where the forward channel is rel iable,
but the reverse is not. No data frames are lost, but some
ACKs are delayed and one is lost. The example also
shows how cumulative acknowledgments can help if
acknowledgments are delayed or lost. After ini tialization,there are seven sender events. Request events are
tr iggered by data from the network layer; arr ival events
are triggered by acknowledgments from the physical
layer. There is no time-out event here because alloutstanding frames are acknowledged before the timer
expires. Note that although ACK 2 is lost, ACK 3 serves as
both ACK 2 and ACK 3.
8/12/2019 Data Link Control Framing
41/79
11.41
Figure 11.16 F low diagram for Example 11.6
Example 11 7
8/12/2019 Data Link Control Framing
42/79
11.42
F igure 11.17 shows what happens when a frame is lost.
F rames 0, 1, 2, and 3 are sent. However, f rame 1 is lost.The receiver receives frames 2 and 3, but they are
discarded because they are received out of order. The
sender receives no acknowledgment about f rames 1, 2, or
3. I ts timer f inally expires. The sender sends all
outstanding frames (1, 2, and 3) because it does not know
what is wrong. Note that the resending of frames 1, 2, and
3 is the response to one single event. When the sender is
responding to this event, it cannot accept the tr igger ing of
other events. This means that when ACK 2 arr ives, the
sender is sti l l busy with sending frame 3.
Example 11.7
Example 11 7 (continued)
8/12/2019 Data Link Control Framing
43/79
11.43
The physical layer must wait unti l this event is completed
and the data l ink layer goes back to i ts sleeping state. We
have shown a vertical l ine to indicate the delay. I t is the
same story with ACK 3; but when ACK 3 arr ives, the
sender is busy responding to ACK 2. I t happens againwhen ACK 4 arr ives. Note that before the second timer
expires, all outstanding frames have been sent and the
timer is stopped.
Example 11.7 (continued)
8/12/2019 Data Link Control Framing
44/79
11.44
Figure 11.17 F low diagram for Example 11.7
8/12/2019 Data Link Control Framing
45/79
11.45
Stop-and-Wait ARQ is a special case of
Go-Back-N ARQ in which the size of the
send window is 1.
Note
8/12/2019 Data Link Control Framing
46/79
11.46
Figure 11.18 Send window for Selective Repeat ARQ
8/12/2019 Data Link Control Framing
47/79
11.47
Figure 11.19 Receive window for Selective Repeat ARQ
Fi 11 20
8/12/2019 Data Link Control Framing
48/79
11.48
Figure 11.20 Design of Selective Repeat ARQ
8/12/2019 Data Link Control Framing
49/79
11.49
In Selective Repeat ARQ, the size of the
sender and receiver window
must be at most one-half of 2m.
Note
Algorithm 11 9 Sender site Selective Repeat algorithm
8/12/2019 Data Link Control Framing
50/79
11.50
Algorithm 11.9 Sender-site Selective Repeat algorithm
(cont inued)
Algorithm 11.9 Sender-site Selective Repeat algorithm (cont inued)
8/12/2019 Data Link Control Framing
51/79
11.51
go t .9 Se de s e Se ec e epea a go ( )
(cont inued)
Algorithm 11 9 Sender-site Selective Repeat algorithm (continued)
8/12/2019 Data Link Control Framing
52/79
11.52
Algorithm 11.9 Sender-site Selective Repeat algorithm (continued)
Algorithm 11 10 R i it S l ti R t l i th
8/12/2019 Data Link Control Framing
53/79
11.53
Algorithm 11.10 Receiver-site Selective Repeat algorithm
Algorithm 11.10 Receiver-site Selective Repeat algorithm
8/12/2019 Data Link Control Framing
54/79
11.54
g p g
8/12/2019 Data Link Control Framing
55/79
11.55
Figure 11.22 Delivery of data in Selective Repeat ARQ
Example 11.8
8/12/2019 Data Link Control Framing
56/79
11.56
This example is similar to Example 11.3 in which frame 1
is lost. We show how Selective Repeat behaves in this
case. Figure 11.23 shows the situation. One main
difference is the number of timers. Here, each frame sent
or resent needs a timer, which means that the timers need
to be numbered (0, 1, 2, and 3). The timer for frame 0
starts at the first request, but stops when the ACK for this
frame arr ives. The timer for frame 1 starts at the second
request, restarts when a NAK arr ives, and finally stopswhen the last ACK arr ives. The other two timers start
when the corresponding frames are sent and stop at the
last arr ival event.
p
Example 11.8 (continued)
8/12/2019 Data Link Control Framing
57/79
11.57
At the receiver site we need to distinguish between the
acceptance of a frame and its delivery to the network
layer. At the second arr ival, frame 2 arr ives and is stored
and marked, but i t cannot be delivered because frame 1 is
missing. At the next arrival, frame 3 arrives and is
marked and stored, but sti l l none of the frames can be
delivered. Only at the last arr ival, when finally a copy of
frame 1 arr ives, can frames 1, 2, and 3 be delivered to the
network layer. There are two conditions for the delivery offrames to the network layer: F irst, a set of consecutive
frames must have arr ived. Second, the set star ts from the
beginning of the window.
p ( )
Example 11.8 (continued)
8/12/2019 Data Link Control Framing
58/79
11.58
Another important point is that a NAK is sent after the
second arrival, but not after the third, although bothsituations look the same. The reason is that the protocol
does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames. The second NAK
would sti l l be NAK1 to inform the sender to resend frame
1 again; this has already been done. The first NAK sent is
remembered (using the nakSent variable) and is not sent
again unti l the frame slides. A NAK is sent once for eachwindow position and defines the f irst slot in the window.
p ( )
Example 11.8 (continued)
8/12/2019 Data Link Control Framing
59/79
11.59
The next point is about the ACKs. Notice that only two
ACKs are sent here. The first one acknowledges only thef irst f rame; the second one acknowledges three frames. In
Selective Repeat, ACKs are sent when data are delivered to
the network layer. I f the data belonging to n f rames are
delivered in one shot, only one ACK is sent for all of them.
p ( )
8/12/2019 Data Link Control Framing
60/79
11.60
Figure 11.23 F low diagram for Example 11.8
8/12/2019 Data Link Control Framing
61/79
11.61
Figure 11.24 Design of piggybacking in Go-Back-N ARQ
8/12/2019 Data Link Control Framing
62/79
11.62
11-6 HDLC
High-level Data L ink Control (HDLC)is a bit-orientedprotocol for communication over point-to-point and
multipoint l inks. I t implements the ARQ mechanisms
we discussed in this chapter.
Configurations and Transfer ModesFrames
Control Field
Topics discussed in this section:
8/12/2019 Data Link Control Framing
63/79
High-Level Data Link Control (HDLC)
HDLC was defined by ISO for use on both point-to-point and multipoint data links.
It supports full-duplex communication
Other similar protocols are Synchronous Data Link Control (SDLC) by IBM
Advanced Data Communication Control Procedure(ADCCP) by ANSI
8/12/2019 Data Link Control Framing
64/79
HDLC Overview
Broadly HDLC features are as follows: Reliable protocol
selective repeat or go-back-N Full-duplex communication
receive and transmit at the same time Bit-oriented protocol
use bits to stuff flags occurring in data Flow control
adjust window size based on receiver capability Uses physical layer clocking and synchronization to send
and receive frames
8/12/2019 Data Link Control Framing
65/79
HDLC Overview
Defines three types of stations Primary
Secondary
Combined
Defines three types of data transfer mode Normal Response mode
Asynchronous Response mode
Asynchronous Balanced mode
Three types of frames Unnumbered information
Supervisory
HDLC
8/12/2019 Data Link Control Framing
66/79
HDLC
The three stations are : Primary station
Has the responsibility of controlling the operation of dataflow in the link.
Handles error recovery Frames issued by the primary station are called commands.
Secondary station, Operates under the control of the primary station. Frames issued by a secondary station are called responses.
Combined station, Acts as both as primary and secondary station.
8/12/2019 Data Link Control Framing
67/79
HDLC
8/12/2019 Data Link Control Framing
68/79
HDLC
The three modes of data transfer operations are Normal Response Mode(NRM)
Mainly used in terminal-mainframe networks. In this case, Secondaries (terminals) can only transmit when specifically
instructed by the primary station in response to a polling Unbalanced configuration, good for multi-point links
Asynchronous Response Mode(ARM) Same as NRM except that the secondaries can initiate transmissions
without direct polling from the primary station Transmission proceeds when channel is detected idle , used mostly
in point-to-point-links
Asynchronous Balanced Mode(ABM) Mainly used in point-to-point links, for communication between
combined stations
Fi 11 25 N l d
8/12/2019 Data Link Control Framing
69/79
11.69
Figure 11.25 Normal response mode
Figure 11 26 A h b l d d
8/12/2019 Data Link Control Framing
70/79
11.70
Figure 11.26 Asynchronous balanced mode
8/12/2019 Data Link Control Framing
71/79
Non-operational Modes
Normal Disconnected Mode
Asynchronous Disconnected Mode
Both the above modes mean that the secondary node islogically disconnected from the primary node
Figure 11 27 HDLC frames
8/12/2019 Data Link Control Framing
72/79
11.72
Figure 11.27 HDLC frames
HDLC frame format
8/12/2019 Data Link Control Framing
73/79
HDLC frame format
Flag: 01111110- start and ending delimiter. Bits are stuffed for flagsin data frames
FCS: 16-bit CRC using generating polynomialG(x) = x16+ x12+ x5+ 1
Address field: In unbalanced configuration, every secondary is assigned a unique
address. Contains address of secondary station in both command andresponse frames
In balanced mode, command frame has destination address andresponse frame has sending nodesaddress
Group addresses are also possible. E.g., One command sent to all thesecondaries.
Figure 11 28 Control f ield format for the different f rame types
8/12/2019 Data Link Control Framing
74/79
11.74
Figure 11.28 Control f ield format for the different f rame types
In I-frames, N(s)is the sequence number of the frame being sent, andR(s)is the sequence number of the frame being expected.
The P/F bit, known as the poll/final bit, is used with different meaningin different contexts.
It is used to indicate pollingand to indicate the final of I-frame, etc
HDLC
8/12/2019 Data Link Control Framing
75/79
HDLC
There are three different classes of frames usedin HDLC
Unnumbered frames, used in link setup anddisconnection, and hence do not contain ACK.
Information frames, which carry actual information.
Supervisory frames, which are used for error and flowcontrol purposes and hence contain send and receivesequence numbers
HDLC
8/12/2019 Data Link Control Framing
76/79
HDLC
There are four different supervisory frames SS=00, Receiver Ready(RR), and N(R) ACKs all
frames received up to and including the one withsequence number N(R) - 1
SS=10, Receiver Not Ready(RNR).
SS=01, Reject; all frames with sequence numberN(R) or higher are rejected, which in turns ACKsframes with sequence number N(R) -1.
SS=11, Selective Reject; the receive rejects the framewith sequence number N(R)
8/12/2019 Data Link Control Framing
77/79
11.77
Table 11.1 U-f rame control command and response
Example 11.9
8/12/2019 Data Link Control Framing
78/79
11.78
Figure 11.29 shows how U-frames can be used for connection
establishment and connection release.
Node A asks for a connection with a set asynchronous balanced mode
(SABM) frame; node B gives a positive response with an
unnumbered acknowledgment (UA) frame.
After these two exchanges, data can be transferred between the two
nodes (not shown in the figure).
After data transfer, node A sends a DISC (disconnect) frame torelease the connection; it is confirmed by node B responding with a
UA (unnumbered acknowledgment).
Figure 11 29 Example of connection and disconnection
8/12/2019 Data Link Control Framing
79/79
Figure 11.29 Example of connection and disconnection
top related