3 2 Data Link Layer Error Flow Control

  • Slides: 32
Download presentation
3. 2 Data Link Layer : Error & Flow Control • data link configurations

3. 2 Data Link Layer : Error & Flow Control • data link configurations • connectionless & connection oriented services • flow control - avoiding buffer overflow • error control - backward error control via retransmission • data link protocols - stop & wait, sliding window • protocol performance issues - link utilization • the high level data link control (HDLC) protocol University of Calgary CS 441 1

Line Configurations • Topology point to point multipoint . . . • Duplicity simplex

Line Configurations • Topology point to point multipoint . . . • Duplicity simplex half duplex full duplex University of Calgary CS 441 2

Point to Point - example • Establishment - ENQ (enquiry), ACK, NAC, ERP (error

Point to Point - example • Establishment - ENQ (enquiry), ACK, NAC, ERP (error procedure) • Data Transfer • Termination - EOT ENQ A ACK B frame ACK University of Calgary CS 441 3

Multipoint Links - Primary & Secondary Nodes • Polling + P : POLL -

Multipoint Links - Primary & Secondary Nodes • Polling + P : POLL - X (note: need address) + X : NAK or X : frame to P + P : ACK • Select + P : SEL - X + X : ACK + P : frame to X + X : ACK University of Calgary CS 441 4

Flow Control - Stop & Wait • Receiver (B) needs one buffer + A

Flow Control - Stop & Wait • Receiver (B) needs one buffer + A sends Frame to B + B sends ACK to A + A sends Frame to B +. . . • Assumes no errors, in frames or ACKs • Small frames, or blocks, are: + fairer, fewer re-xmit, smaller buffers required University of Calgary CS 441 5

Performance - Link Utilization = U • TF = total time to send frame

Performance - Link Utilization = U • TF = total time to send frame • = one way propagation delay • TF = Tf +2 +Tack ~= Tf +2 • U ~= n Tf / (2 n +n. Tf) => U = 1/ (1+2 a) + where a = / Tf Tf A University of Calgary B CS 441 6

Definition of Parameter “a” • a = propagation time / transmission time • d

Definition of Parameter “a” • a = propagation time / transmission time • d = distance • V = velocity of light = 2 or 3 * 8 meters/sec • R = data rate in bits/sec • L = length of frame in bits a = / Tf a = (d/ V)/ (L/ R) a = Rd/ VL University of Calgary CS 441 7

Impact of a on Utilization a = / Tf < 1 Tf A B

Impact of a on Utilization a = / Tf < 1 Tf A B Tf A University of Calgary a>1 B CS 441 8

Flow Control - Sliding Window • Consider A to B on full duplex link

Flow Control - Sliding Window • Consider A to B on full duplex link + B allocates N frame buffers + each frame given sequence number + ack includes 1+ sequence# of last frame rec’d + A can send N frames before receiving an ACK frames that can be sent sender. . . 0 1 2 3 0 1 2 3. . received receiver. . . 0 1 2 3 0 1 2 3. . University of Calgary CS 441 9

Flow Control - Sliding Window (N=4) • A’s window: 0 1 2 3 &

Flow Control - Sliding Window (N=4) • A’s window: 0 1 2 3 & B’s window: 0 1 2 3 + A sends B F 0, F 1, F 2 & B receives all • A’s window: 3 + B sends ACK 3 & B’s window: 3 • A’s window: 3 & B’s window: 3 0 1 2 + A receives ACK 3 • A’s window: 3 0 1 2 & B’s window: 3 0 1 2 • U = 1 if N > 2 a+1 else U = N/ (1+2 a) University of Calgary CS 441 10

Error Control-ARQ (automatic repeat request) • Two basic error types: + lost frame (or

Error Control-ARQ (automatic repeat request) • Two basic error types: + lost frame (or ack/ control frame) + damaged frame (or ack/ control frame) • Control Mechanisms + error detection via CRC + retransmission after timeout + negative acks & retransmission • Three Common Versions: + Stop & Wait ARQ + Go-back-N ARQ + Selective-reject ARQ University of Calgary CS 441 11

Automatic Repeat Request protocols (ARQ) • sender required to retransmit erroneous frames + receiver

Automatic Repeat Request protocols (ARQ) • sender required to retransmit erroneous frames + receiver detects errors - fewer bits needed to reliably detect errors + sender notified to re-send frame - positive ack of frames received + sender times out on frames that are not acknowledged and re-transmits - negative acknowledgement for frames received with errors - more efficient University of Calgary CS 441 12

Error Control • Stop & Wait ARQ (automatic repeat request) F 0 A 1

Error Control • Stop & Wait ARQ (automatic repeat request) F 0 A 1 F 1 alternate 0/ 1 labels A 0 to avoid receiving duplicates F 0 lost F 0 re-sent after timeout University of Calgary A 1 lost CS 441 13

Sliding Window Based- Go-back-N ARQ • Damaged Frame + B has correctly received frames

Sliding Window Based- Go-back-N ARQ • Damaged Frame + B has correctly received frames up to I-1, A sends I, B detects error, sends NAK I + frame I lost in transit, I+1 sent, B receives I+1 out of order, sends NAK I, else + A sends nothing after I, hears nothing, resends after timeout • Damaged ACK + B receives I, sends ACK I+1 which is lost, A may receive subsequent ACK or timeout • Damaged NAK + A will eventually timeout and resend all University of Calgary CS 441 14

Go-back-N ARQ 0 1 2 frames 3 4 5 2 3 ACK 1 ACK

Go-back-N ARQ 0 1 2 frames 3 4 5 2 3 ACK 1 ACK 2 NAK 2 0 1 2 3 4 5 X X error University of Calgary 4 5 6 ACK 3 7 0 ACK 5 ACK 4 2 3 4 5 6 7 discarded CS 441 15 0

Performance of Stop & Wait ARQ • Without frame xmission errors & Tack =

Performance of Stop & Wait ARQ • Without frame xmission errors & Tack = 0 U = Tf / ( Tf + 2 ) U = 1/ (1 + 2 a) where a = / Tf • With frame probability error = P & Tack = 0 U = Tf / Nretrans(Tf + 2 ) U = 1/ Nretrans(1 + 2 a) Nretrans = i P i-1(1 -P) = 1/ (1 - P) U = (1 - P)/ (1 + 2 a) University of Calgary CS 441 16

Performance of Sliding Window: no errors • N = window size, Tack = 0

Performance of Sliding Window: no errors • N = window size, Tack = 0 & Tf = 1 if N > 1 + 2 a then receive an ACK before window exhausted, can xmit continuously => U = 1 if N< 1 + 2 a window exhausted at t 0 + N, must wait till t 0 + 2 a + 1 to send again, thus get N time units busy during 2 a + 1 => U = N/ (1 + 2 a) University of Calgary CS 441 17

Performance of Sliding Window (N<1+2 a) f 1 t 0 A t 0+a+1 B

Performance of Sliding Window (N<1+2 a) f 1 t 0 A t 0+a+1 B (assuming Tf = 1) fa fa+1 . . . f 2 f 1 . . . f 3 f 2 N t 0+2 a+1 . . . ack 1 fa+2 fa+3 ack 1 => N frames sent in 1+2 a time => U = N/ (1+2 a) University of Calgary CS 441 18

Performance of Selective Repeat with Errors • without errors: + U = 1 if

Performance of Selective Repeat with Errors • without errors: + U = 1 if N> 1+2 a else = N/ (1+2 a) • U = time to send 1 frame / total time per frame *Nr + where Nr = number of times must be resent • U = 1/ Nr if N> 1+2 a else N/ (1+2 a)*Nr • again Nr = f(i) P i-1(1 -P) = 1/ (1 -P) • thus U = (1 -P) if N>1+2 a else (1 -P)N/ (1+2 a) University of Calgary CS 441 19

Performance of Go-back-N ARQ : with errors • again just consider the Nretrans, ie

Performance of Go-back-N ARQ : with errors • again just consider the Nretrans, ie U = Tf / Nr (Tf + 2 ) U = 1/ Nr (1 + 2 a) • here each erroneous frame requires retransmission of K frames Nr = Exp{#frames xmitted to send 1} Nr = f(i) P i-1(1 -P) where f(i) = total # frames xmitted if 1 st frame must be sent i times = 1 + (i-1)K Nr = 1 - K + K/ (1 - P) University of Calgary CS 441 20

Performance of Go-back-N ARQ U = 1/ Nr(1 + 2 a) Nr = 1

Performance of Go-back-N ARQ U = 1/ Nr(1 + 2 a) Nr = 1 - K + K/ (1 - P) U = 1/ (1 - K + K/ (1 - P))(1 + 2 a) note K ~= 2 a + 1 for N> 2 a + 1 etc, thus: U = (1 - P)/ (1 + 2 a. P) 2 a U = N(1 - P)/ (1 + 2 a)(1 - P + NP) 2 a University of Calgary if N > 1 + if N < 1 + CS 441 21

Performance Comparison 1. 0 Go-back-N=7 Go-back-N=127 0. 5 stop&wait Utilization 0. 1 1. 0

Performance Comparison 1. 0 Go-back-N=7 Go-back-N=127 0. 5 stop&wait Utilization 0. 1 1. 0 University of Calgary 10 a = / Tf 1000 CS 441 22

Sliding Window with Selective Repeat & NAKs window size = 2, sequence range =4

Sliding Window with Selective Repeat & NAKs window size = 2, sequence range =4 0 1 2 frames ACK 0 ACK 1 0 3 2 ACK 3 0 1 ACK 2 NAK 2 1 2 2 ACK 0 3 2 0 1 X error University of Calgary Tanenbaum Section 3. 4. 3 CS 441 23

HDLC-High Level Data Link Control-ISO 3309 • Three stations types: + primary - issues

HDLC-High Level Data Link Control-ISO 3309 • Three stations types: + primary - issues command frames + secondary - response frames + combined - primary & secondary fcns • Two Link configurations + unbalanced - 1 primary & full/half duplex + balanced - only point to point combined • Three Data Transfer Modes + normal response mode (NRM) - unbalanced + asynchronous balanced mode (ABM) + asynchronoous response mode (ARM) -unbal. University of Calgary CS 441 24

HDLC -synchronous xmission -1 frame format • flag - 8 bits + 01111110 data)

HDLC -synchronous xmission -1 frame format • flag - 8 bits + 01111110 data) (bit stuffing used to avoid in • address - one or more octets • control 8 or 16 bits • information - variable • frame check sequence CRC-16 or 32 • flag - 8 bits - 1 flag can close & open frames flag address control data FCS University of Calgary CS 441 flag 25

Control Field Format - three frame types • Information frame (ARQ piggybacked in data)

Control Field Format - three frame types • Information frame (ARQ piggybacked in data) 1 2 3 4 5 6 7 8 0 send-seq# P/ F rec-seq# (3 or 7 bits) • Supervisory (ARQ if not piggybacked) 1 2 3 4 5 6 7 8 1 0 sup-fcn P/ F rec-seq# • Unnumbered (other functions) 1 2 3 4 5 6 7 8 1 1 unn-fcn P/ F unn-fcn University of Calgary CS 441 26

HDLC Commands & Responses • I - Information • S - Supervisory + RR

HDLC Commands & Responses • I - Information • S - Supervisory + RR + RNR receive + REJ + SREJ exchange user data ACK, ready to receive I ACK, not ready to NAK, go back N NAK selective reject • U - Unnumbered + SNMR/ SNME set mode, 2 octet control + SARM/ SARME set mode, 2 octet control + SABM/SABE, SIM, DISC, UA, DM, RD, RIM, UI, UP, RSET, XID, TEST, FMR University of Calgary CS 441 27

HDLC example - one way, reject recovery I-1 I-2 X I-3 REJ - 2

HDLC example - one way, reject recovery I-1 I-2 X I-3 REJ - 2 I-3 University of Calgary CS 441 28

HDLC example - busy condition I-1 RNR - 2 RR - P RNR -

HDLC example - busy condition I-1 RNR - 2 RR - P RNR - 2 I-1 RNR - 2 RR - P University of Calgary CS 441 29

Protocol Analysis - Finite State Machines • FSM model of communication protocol objects •

Protocol Analysis - Finite State Machines • FSM model of communication protocol objects • state defined for sending, receiving, link objects • typical state = waiting (some event) • very large number of states for simple protocols • state transitions occur when events occur • FSM = (S, M, I, T) where: + S is set of states of all objects + M is set of all types of messages + I is the set of object initial states + T is the set of state transitions • correctness, reachability, deadlock University of Calgary CS 441 30

Petri Net Models • places can be occupied by tokens • directed arcs connect

Petri Net Models • places can be occupied by tokens • directed arcs connect places and transitions • transitions are enabled if all its input arcs come from places occupied by tokens • enabled transitions can fire removing all incoming tokens and placing tokens at all places connected to it by output arcs • University of Calgary CS 441 31

Tanenbaum’s Protocol 3 - Petri Net Model send 0 link 0 on link sender

Tanenbaum’s Protocol 3 - Petri Net Model send 0 link 0 on link sender loss wait ack 0 timeout ack on link send 1 wait ack 1 timeout receiver loss 1 on link loss University of Calgary CS 441 32