Sequence 7. Page 1. Chapter 7: Data Link Control. Data Link Control Protocols. •
Need layer of logic above Physical to manage exchange of data over a link.
Chapter 7: Data Link Control
CS420/520 Axel Krings
Page 1
Sequence 7
Data Link Control Protocols • Need layer of logic above Physical to manage exchange of data over a link — frame synchronization — flow control — error control — addressing — control and data — link management
CS420/520 Axel Krings
Page 2
Sequence 7
1
Background information Begin(... — Speaking of Physical Layer: — let’s consider the physical layer and the characteristics of interfaces
CS420/520 Axel Krings
Page 3
Sequence 7
Line Configuration • Topology — Physical arrangement of stations on medium — Point to point — Multi point • Computer and terminals, local area network
• Half duplex — Only one station may transmit at a time — Requires one data path
• Full duplex — Simultaneous transmission and reception between two stations — Requires two data paths (or echo canceling)
CS420/520 Axel Krings
Page 4
Sequence 7
2
Traditional Configurations
CS420/520 Axel Krings
Page 5
Sequence 7
Interfacing • Data processing devices (or data terminal equipment, DTE) do not (usually) include data transmission facilities • Need an interface called data circuit terminating equipment (DCE) — e.g. modem, NIC
• DCE transmits bits on medium • DCE communicates data and control info with DTE — Done over interchange circuits — Clear interface standards required CS420/520 Axel Krings
Page 6
Sequence 7
3
Data Communications Interfacing
CS420/520 Axel Krings
Page 7
Sequence 7
Characteristics of Interface • Mechanical — Connection plugs
• Electrical — Voltage, timing, encoding
• Functional — Data, control, timing, grounding
• Procedural — Sequence of events
CS420/520 Axel Krings
Page 8
Sequence 7
4
V.24/EIA-232-F • ITU-T v.24
ITU = Intl. Telecom. Union ITU-T = ITU Telecom. Standardization Sector
• Only specifies functional and procedural — References other standards for electrical and mechanical
• EIA-232-F (USA) (first issued in 1962) — RS-232 — Mechanical ISO 2110 — Electrical v.28 — Functional v.24 — Procedural v.24 CS420/520 Axel Krings
EIA = Electronic Industry Alliance RS-232 first issued in 1962 V.24 issued in 1996 V.28 issued in 1993
Page 9
Sequence 7
Mechanical Specification
CS420/520 Axel Krings
Page 10
Sequence 7
5
Electrical Specification • Digital signals • Values interpreted as data or control, depending on circuit • Less than -3V is binary 1, more than +3V is binary 0 (NRZ-L) • For control, — less than -3V is off, — more than +3V is on
• Signal rate < 20kbps • Distance x and P < x P
4. At time (t0 + x + P + y), last bit of ACK leaves B, given m bits in ACK packet and y = m/R seconds ACK
y
5. At time (t0 + x + P + y + P), last bit of ACK reaches A and A can start next packet transmission
P CS420/520 Axel Krings
Page 31
Sequence 7
Data Link Basics • Link Utilization: — Maximum Utilization of A - B link x x + y + 2P = data transmission time/overhead time x = , neglecting y x + 2P 1 = 1+ 2( Px )
U=
= CS420/520 Axel Krings
1 , a = ( Px ) is normalized propagation delay 1+ 2a Page 32
Sequence 7
€
16
Data Link Basics • How many bits are “stuck” in the media?
B=R
d v
where: B = length of the link in bits R = rate of the link, in bps d€ = length in m v = velocity of propagation, in m/s
CS420/520 Axel Krings
Page 33
Sequence 7
Sliding Windows Flow Control • Allow multiple frames to be in transit • Receiver has buffer of size W • Transmitter can send up to W frames without ACK • Each frame is numbered • ACK includes number of next frame expected • Sequence number bounded by size of field (k) — Frames are numbered modulo 2k
CS420/520 Axel Krings
Page 34
Sequence 7
17
Sliding Window Diagram Frames buffered until acknowledged Frames already transmitted
••• 0
1
2
Frame sequence number
3
4
5
6
7
0
Window of frames that may be transmitted
1
2
3
4
Window shrinks from trailing edge as frames are sent
Last frame Last frame acknowledged transmitted
5
6
7 •••
Window expands from leading edge as ACKs are received
(a) Sender's perspective
Window of frames that may be accepted
Frames already received
••• 0
1
2
3
4
Last frame acknowledged
CS420/520 Axel Krings
5
6
7
Last frame received
0
1
2
3
4
Window shrinks from trailing edge as frames are received
5
6
7 •••
Window expands from leading edge as ACKs are sent
Page 35 (b) Receiver's perspective
Sequence 7
Figure 7.3 Sliding-Window Depiction
Example Sliding Window Source System A
Destination System B
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 F0 F1 F2
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
RR 3
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
F3 F4
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 F5
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
4 RR
F6
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
CS420/520 Axel Krings
Page 36
Sequence 7
Figure 7.4 Example of a Sliding-Window Protocol
18
Sliding Window Enhancements • Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) • Must send a normal acknowledge to resume • If duplex, use piggybacking — If no data to send, use acknowledgement frame — If data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP)
CS420/520 Axel Krings
Page 37
Sequence 7
Error Control • • • •
Detection and correction of errors Lost frames Damaged frames Automatic repeat request — Error detection — Positive acknowledgment — Retransmission after timeout — Negative acknowledgement and retransmission
CS420/520 Axel Krings
Page 38
Sequence 7
19
Automatic Repeat Request (ARQ) Three common approaches: 1. Stop and wait 2. Go back N 3. Selective reject (selective retransmission)
CS420/520 Axel Krings
Page 39
Sequence 7
Stop and Wait • Source transmits single frame • Wait for ACK • If received frame damaged, discard it — Transmitter has timeout — If no ACK within timeout, retransmit
• If ACK damaged,transmitter will not recognize it — Transmitter will retransmit — Receive gets two copies of frame — Use ACK0 and ACK1
CS420/520 Axel Krings
Page 40
Sequence 7
20
Stop and Wait Diagram Frame numbers alternate between 0 and 1
Stop and Wait is: + simple - inefficient
CS420/520 Axel Krings
Page 41
Sequence 7
Go Back N (1) • Based on sliding window • If no error, ACK as usual with next frame expected • Use window to control number of outstanding frames • If error, reply with rejection — Discard that frame and all future frames until error frame received correctly — Transmitter must go back and retransmit that frame and all subsequent frames
CS420/520 Axel Krings
Page 42
Sequence 7
21
Go Back N - Damaged Frame • • • •
Receiver detects error in frame i Receiver sends rejection-i Transmitter gets rejection-i Transmitter retransmits frame i and all subsequent frames
CS420/520 Axel Krings
Page 43
Sequence 7
Go Back N - Lost Frame (1) • • • • •
Frame i is lost Transmitter sends i+1 Receiver gets frame i+1 out of sequence Receiver send reject i Transmitter goes back to frame i and retransmits
CS420/520 Axel Krings
Page 44
Sequence 7
22
Go Back N - Lost Frame (2) • Frame i lost and no additional frame sent — Receiver gets nothing and returns neither acknowledgement nor rejection — Transmitter times out and sends acknowledgement frame with P bit set to 1 — Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) — Transmitter then retransmits frame i
CS420/520 Axel Krings
Page 45
Sequence 7
Go Back N - Damaged Acknowledgement • Receiver gets frame i and send acknowledgement (i+1) which is lost — Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i — If transmitter times out, it sends acknowledgement with P bit set as before — This can be repeated a number of times before a reset procedure is initiated
CS420/520 Axel Krings
Page 46
Sequence 7
23
Go Back N - Damaged Rejection • As for lost frame (2)
CS420/520 Axel Krings
Page 47
Sequence 7
Page 48
Sequence 7
Go Back N Diagram
CS420/520 Axel Krings
24
Selective Reject • Also called selective retransmission • Only rejected frames are retransmitted • Subsequent frames are accepted by the receiver and buffered • Minimizes retransmission • Receiver must maintain large enough buffer • More complex login in transmitter
CS420/520 Axel Krings
Page 49
Sequence 7
Selective Reject Diagram
CS420/520 Axel Krings
Page 50
Sequence 7
25
Data Link Basics Performance: Stop & Wait ARQ — note that utilization U = Tf/Tt where: • Tf = time for transmitter to emit a single frame • Tt = total time line is engaged in transmission of 1 frame
— for error free Stop & Wait:
U=
Tf
,
if a =
Tp Tf
then U =
1 1 + 2a
Tf + 2Tp — for errors, U = Tf /(NrTt ), where Nr is the expected number of transmissions of a particular frame
U=
1 N r (1 + 2 a)
CS420/520 Axel Krings
Page 51
Sequence 7
Data Link Basics • Assume P = probability a single frame is in error. • Further assume ACKs and NAKs are never in error. • The probability that we have i transmissions of a frame is: Pi-1(1-P) • Therefore:
∞
N r = ∑ iP i −1 (1 − P) = i =1
1 1− P
• For Stop & Wait then:
U= CS420/520 Axel Krings
1− P 1 + 2a Page 52
Sequence 7
26
Data Link Basics — For Sliding Window: N ≥ 2a + 1 " 1 U=# N $ 2 a +1 N < 2 a + 1
— For Selective Repeat we have: # 1− P U = $ N (1− P) % 2 a +1
N ≥ 2a + 1 N < 2a + 1
— For Go-Back-N we have to consider all retransmitted:
1− P " 1+ 2 aP $ U=# N (1− P ) $ (1+ 2 a )(1− P + NP ) % CS420/520 Axel Krings
N ≥ 2a + 1 N < 2a + 1
Page 53
Sequence 7
Data Link Basics — For Go-Back-N we have to consider all retransmissions. Then Nr is the expected number of transmitted frames to successfully transmit one frame. Each error generates requirement to retransmit K frames. ∞
N r = ∑ f (i ) P i −1 (1 − P ) i =1
Total # frames transmitted if original frame must be transmitted i times
with f (i ) = 1 + (i − 1) K = (1 − K ) + Ki
then
∞
∞
N r = (1 − K ) ∑ P i −1 (1 − P ) + K ∑ iP i −1 (1 − P ) i =1
∞
i
∞
∑ r =∑ r
with
i =0
i =1
we get Nr = 1− K + CS420/520 Axel Krings
i −1
i =1
1 = 1− r
∞
and
K 1 − P + KP = 1− P 1− P Page 54
∑ ir i =1
i −1
=
1 (1 − r ) 2
Sequence 7
27
High Level Data Link Control • HDLC • ISO 33009, ISO 4335
CS420/520 Axel Krings
Page 55
Sequence 7
HDLC Station Types • Primary station — Controls operation of link — Frames issued are called commands — Maintains separate logical link to each secondary station
• Secondary station — Under control of primary station — Frames issued called responses
• Combined station — May issue commands and responses CS420/520 Axel Krings
Page 56
Sequence 7
28
HDLC Link Configurations • Unbalanced — One primary and one or more secondary stations — Supports full duplex and half duplex
• Balanced — Two combined stations — Supports full duplex and half duplex
CS420/520 Axel Krings
Page 57
Sequence 7
HDLC Transfer Modes (1) • Normal Response Mode (NRM) — Unbalanced configuration — Primary initiates transfer to secondary — Secondary may only transmit data in response to command from primary — Used on multi-drop lines — Host computer is primary — Terminals is secondary
CS420/520 Axel Krings
Page 58
Sequence 7
29
HDLC Transfer Modes (2) • Asynchronous Balanced Mode (ABM) — Balanced configuration — Either station may initiate transmission without receiving permission — Most widely used — No polling overhead
CS420/520 Axel Krings
Page 59
Sequence 7
HDLC Transfer Modes (3) • Asynchronous Response Mode (ARM) — Unbalanced configuration — Secondary may initiate transmission without permission form primary — Primary responsible for line — rarely used
CS420/520 Axel Krings
Page 60
Sequence 7
30
Frame Structure • Synchronous transmission • All transmissions in frames • Single frame format for all data and control exchanges
CS420/520 Axel Krings
Page 61
Sequence 7
Frame Structure
CS420/520 Axel Krings
Page 62
Sequence 7
31
Flag Fields • • • • •
Delimit frame at both ends 01111110 May close one frame and open another Receiver hunts for flag sequence to synchronize Bit stuffing used to avoid confusion with data containing 01111110 — 0 inserted after every sequence of five 1s — If receiver detects five 1s it checks next bit — If 0, it is deleted — If 1 and seventh bit is 0, accept as flag — If sixth and seventh bits 1, sender is indicating abort
CS420/520 Axel Krings
Page 63
Sequence 7
Page 64
Sequence 7
Bit Stuffing • Example with possible errors
CS420/520 Axel Krings
32
Address Field • Identifies secondary station that sent or will receive frame • Usually 8 bits long • May be extended to multiples of 7 bits — LSB of each octet indicates that it is the last octet (1) or not (0)
• All ones (11111111) is broadcast
CS420/520 Axel Krings
Page 65
Sequence 7
Control Field • Different for different frame type — Information - data to be transmitted to user (next layer up) • Flow and error control piggybacked on information frames
— Supervisory - ARQ when piggyback not used — Unnumbered - supplementary link control
• First one or two bits of control filed identify frame type • Remaining bits explained later CS420/520 Axel Krings
Page 66
Sequence 7
33
Control Field Diagram
CS420/520 Axel Krings
Page 67
Sequence 7
Poll/Final Bit • Use depends on context • Command frame — P bit — 1 to solicit (poll) response from peer
• Response frame — F bit — 1 indicates response to soliciting command
CS420/520 Axel Krings
Page 68
Sequence 7
34
Information Field • Only in information and some unnumbered frames • Must contain integral number of octets • Variable length
CS420/520 Axel Krings
Page 69
Sequence 7
Frame Check Sequence Field • FCS • Error detection • 16 bit CRC • Optional 32 bit CRC
CS420/520 Axel Krings
Page 70
Sequence 7
35
HDLC Operation • Exchange of information, supervisory and unnumbered frames • Three phases — Initialization — Data transfer — Disconnect
CS420/520 Axel Krings
Page 71
Sequence 7
Examples of Operation (1) A
N(S) N(R)
A
B
A
B
B
I , 0, 0
I , 3, 0
I , 0, 1
RNR, 4
SABM
I , 1, 1 I , 2, 1
RR, 0,
UA
I , 1, 3
• • •
I , 3, 2
SABM Timeout
DISC
I , 2, 4 I , 3, 4
UA
RR , 4
(a) Link setup and disconnect CS420/520 Axel Krings
R NR , 4 ,F
Page 72
B
I , 4, 0
RR, 4,
F
Sequence 7
B I , 2, 0
I, 3, 0
I, 4 , 0
REJ, 4
P
(c) Busy condition
A
I , 3, 0
I , 5, 0
RR, 0,
I , 4, 0
(b) Two-way data exchange
A
P
RR, 3
36
Timeout
RR, 0,
P
SABM
I , 2, 1
UA
I , 1, 3
• • •
I , 3, 2 I , 2, 4
DISC
I , 3, 4
UA
RR , 4
RR, 0,
P
R NR , 4 ,F RR, 0,
P
RR, 4,
F
I , 4, 0
Examples of Operation (2)
(a) Link setup and disconnect
(b) Two-way data exchange
B
A
A I, 3, 0
I, 4 , 0
RR, 0,
I , 4, 0
P
F RR, 3, I , 3, 0
I , 5, 0 I , 6, 0
(d) Reject recovery
RR, 3
Timeout
REJ, 4
CS420/520 Axel Krings
B I , 2, 0
I , 3, 0
I , 5, 0
(c) Busy condition
RR , 4
Page 73
(e) Timeout recovery
Sequence 7
Figure 7.9 Examples of HDLC Operation
Summary • introduced need for data link protocols — which included background on interfacing
• flow control • error control • HDLC
37