Data Link Level Design Issues
description
Transcript of Data Link Level Design Issues
Physical
Link
Network
Transport
Session
Presentation
Application
OSI Reference Model-Seven LayersOSI Reference Model-Seven Layers
Transporting 0’s and 1’s point-to-point
Organizing flow of 0’s &1’s
Frame formatting-error detecting and correcting codes, ARQ
Routing and Flow Control from Link-to-Link
Managing path flow overseveral links
Setting up and Taking Down Connections
-Synchronization
Character Formats-ASCII, Encryption
User Functions
Data Link Level Design Issues
• Services provided to Network Layer
• Framing
• Error control
• Flow control
Services provided to Network Layer
Layer 4
Layer 3
Layer 2
Layer 1
Layer 4
Layer 3
Layer 2
Layer 1
Physical Medium
Host 1 Host 2
Virtual Data Path
ActualData Path
Most Common Services
• Unacknowledged connectionless service– Very low error rate– Voice traffic
• Acknowledged connectionless service– Frame arrived safely– Good for wireless (unreliable) channels
• Acknowledged connection oriented service– Reliable stream of ordered frames– Three phases -connection, data flow, disconnect
3 32 2 22 2
2
ROUTER
Routing Processor
Link LayerProcessor
Transmission line to a router
FramesPackets
Data link protocol
Placement of Data Link Protocol
• Character count - obsolete
• Starting and ending characters, with character stuffing (see next slide)
• Starting and ending flags, with bit stuffing(see following slide)
• Physical layer coding violations
Framing
Character Stuffing (Transparency to User)
DLE STX DLE ETXDLE ETXDLE
Frame
Beginningof frame
End offrame
Actual data sequence
Stuffed character
User data
The first of two DLE characters is always a stuff-delete
Bit Stuffing (Transparency to User)
01111110 011111010
Frame
Beginningof frame
End offrame
Actual data sequence
Stuffed bit
User data
A “0” following five “1’s” is always deleted
01111110
Error control
0 1 1 1 0 1 0 0
Violation
Physical layer coding violations
Error Control
• Automatic Repeat Request (ARQ)– Error detecting codes– Positive acknowledgement(ACK)– Negative acknowledgement(NACK)– Timeout– Delay sensitivity
• Forward Error Correction– Error correcting codes– Delay insensitive– Much more overhead required
Link-by-Link vs End-to-End Error Control
There’s a tradeoff
N links p = Probability of error on a single link
M = Single message transmission time
Link-by-line acknowledgementAverage no. link retransmissions=1/(1-p)Average message transmission time per link=M/(1-p)Average message transmission time N links = NM/(1-p)
End-to-end acknowledgementProbability no error end-to-end=(1-p)N
Probability at least one error end-to-end=q=1- (1-p)N
Average no. end-to-end retransmissions=1/(1-q)= (1-p)-N
Average transmission time, end-to-end = M (1-p)-N
Assumption of negligible propagation delay
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 110
0
101
102
103
104
Link error probability
Nor
mal
ized
tra
nsm
issi
on t
ime Link-by-link 3 links
Link-by-link 10 links
End-to-end 3 links
End-to-end 10 links
Flow control• Closed loop controls
– Sliding window
• Open loop– Leaky bucket
0 0
1 1
PE
PE
Encdr mod channel demod decdr1,0 1,0
Pe = probability of bit error
Binary Symmetric Channel
Fig. 1 Communica tion Syst em
DigitalS ink Demod
DigitalSourc e Modul ator
...0110...
Ch annel
Encode r
Decode r
...0110...
…11000...
…11000...
Redundancy Encoding
• Block codes– (n,k) code n= codeword length, k=Information bits
• ASCII (8,7) code
– Parity bits• ASCII “e” 10100110 Parity bit
– Hamming distance-number of different places
• Convolutional Codes– Difference in path lengths– Viterbi decoding
4327
3216
4315
bbbb
bbbb
bbbb
(1)
111111115
010011114
000101113
101001112
001110111
100010110
11010019
01100018
10011107
00101106
01110105
11000104
01011003
11101002
10110001
00000000
bitCodeword 7654321 bbbbbbb
(7,4) Hamming Code
76543218 bbbbbbbb
Augmented Hamming Codeextra parity bit over all other bits
1111111115
0010011114
1000101113
0101001112
0001110111
1100010110
011010019
101100018
010011107
100101106
001110105
111000104
101011003
011101002
110110001
000000000
bitCodeword 87654321 bbbbbbbb
Hamming Distance and Error Correction
Example-six bit codewords
Codeword 1- 001101
Codeword 2- 101001
HammingDistanceTwo
Number of places codewords differ
Code-Distance twofour code words
Code-distance threetwo code words
-Code point
011 111
110
101
000
(3,2) code
(3,1) code
000
111
n bit codeword - vertex on an n dimensional cube
Number of edges tranversed from one point to another=Hamming distance between codewords
Codewords
Intermediate vertices Distance = 5
Codewords
Single Error Detecting Code-Distance two
Single-error correcting or double-error detecting Distance three
Single-error correcting and double-error detecting Distance four
Vertex
Distances and error correction and detection
1D
12 C
Distance and Correcting and Detecting Capability
D=Number of detectable errorsC=Number of correctable errorsMinimum distance between codewords
Examples: (7,4) Hamming code =3D= 2 and C=1Augmented Hamming (8,4) code =4, D=3 and C =1
Received n bits not a codeword
Received n bits closest to one codeword
Transmitter Channel Receiver
Feedback Channel
NACK when error detected
Automatic Repeat Request
n,...,,,j;)P(Pj
n)nj(P jn
ej
e 2101bits in errors
Forward Error Correction
Pe=P(Single bit in error)Independence from bit to bit
n
Cj
jne
je )P(P
j
n)C(P)(P
1
1errorsbit than Moreerror decoding
Code Data Rate,k/n Word error prob-
ability for310eP
Word error prob-
ability for610eP
(7,4) Hamming .57 51012 . 111012 .(15,11) Hamming .73 41051 . 101051 .(31,26) Hamming .84 410654 . 1010654 .(23,12) Golay .52 91068 . 211068 .
Trade between data rate and error correcting power
Code Efficiency
n bit codeword - vertex on an n dimensional cubeAn efficient code packs the code “densely”
n nearestneigbors
Code point
n-1 nearestneighbors of adjacentpoint
Code point
i
nNumber of vertices at distance I from a codeword
C
i i
n
0
Number of vertices at distance C or lessVertices belong to codeword
Packing the cube efficiently
k2 Number of code points
Lower bound on number of verticesEquality for Perfect code
C
i
kn
i
n
1
22
Implementation of Coding and Decoding
In digital hardware, naturally
Cyclic codes-every codeword a cyclic shift of another
eg Hamming code codewords 1,3,4,6,8,10 and cyclic shifts3 - 0011010 13 - 1101000
Cyclic codes represented by a polynomial
Each code has a unique generator polynomial-G(x)e.g. For (7,4) Hamming, G(x)= 123 xx
Representing a binary sequence by a polynomiale.g., 010110101 -
Division:
3223 11
100001011101 :Addition
x)x()xx(
x x x x7 5 4 2 1
111
011100101011101 :t ionMult iplica345223
xxx)x()xx(
x x x x7 4 3 4 x x x x x x x x6 5 2 2 2 21 1 1( ) ( )
11010111110111110101
Divisor Quotient Remainder
124567 xxxxx123 xx467 xxx
125 xx
xxx
x
34
4 1
245 xxx
124 xxx
1
123
3
xx
xx
xx 2
Divisor
Quotient
Remainder
Forming a codeword from k information bits
1) D(x) - k-1 degree polynomial representing data2) Form xn-kD(x) (n-1 degree)3) Divide xn-kD(x) by G(x) , save remainder R(x)4) Form codeword C(x)= xn-kD(x) +R(x)
Mathematical justification
)x(R)x(G)x(Q)x(Dx kn
)x(G)x(Q)x(R)x(Dx)x(C kn
Codeword is a multiple of G(x)If not an error has occurred.
Example 1110(14) to be transmitted-D(x)= x3+ x2+ x
Multiplication by x3 gives x6+ x5+ x4
Remainder after division by x3+ x2+1 is x
C(x)=x6+ x5+ x4+ x 1110010(14)
Error in transmission channel error 1111010 Received
x6+ x5+ x4+ x3 + x /x3+ x2+1 R(x)= x3
++ T T Tc-Inputsequence
o-Outputsequence
s1 2s s3
Remainder 0Valid codewordno error detected
o s
s o s
s s
s o c
n n
n n n
n n
n n n
3 1
3 2 1
2 1 1
1
c s s s o1 2 3
1 1 0 0 0
1 1 1 0 0
0 0 1 1 0
1 0 0 0 1
0 0 0 0 0
1 1 0 0 0
1 1 1 0 0
0 0 1 1 0
1 0 0 0 1
0g 2g 3g
Divider circuit
Encoder Implementation
DividerCircuit
InputSequence
Remainder - R(x)
n-k tic delay
D(x)
D(x) x n k
x n k
D(x)+ R(x)x n k
Generating Polynomials of Cyclic Codes
Ham g x x
Ham g x x
Golay x x x x x x
min ( , )
min ( , )
( , )
7 4 1
1511 1
23 12 1
3
4
11 9 7 6 5
Standards for Error DetectionCRC -12 -
CRC 16 -
CRC 16(ANSI) -
CRC - CCITT -
CRC - 32
x x x x x x x x
x x x x x x
x x x x x x x x x
x x x x x x x x x x x
12 11 3 2 11 2
16 15 2 15
16 15 5 15 4 3 2
16 12 5 15 14 12 4 3 2
1 1 1
1 1 1
1 1 1
1 1 1
( )( )
( )( )
( )( )
( )( )
- x x x x x x x x x x x x x x32 26 23 22 16 12 11 10 8 7 5 4 2 1
Burst Error Capabilities of CRC Codes
TransmittedC(x)
Channel errorE(x)
ReceivedC(x) + E(x)
Because of error C(x) + E(x) is not divisible by G(x)E(x)/G(x)=R(x) ModG(x)
•If (x+1) a factor of G(x) odd number of errors
• All double errors
000
xx)x(G)x(E
ji),x(xxx)x(E ijiji 1
•All bursts of length < r+1
Interleaving for Burst Errors
n1
k2 codewords each (n1 k1)
n1
n1
Imaginedrearrangement
n2 -
k2
n2 -
k2
Error burst
n1
Additional Storage and Processing
n1 (n2 - k2 ) parity bits
Turbo codes
n2 -
k2
Convolutional codes
Tinput110100
Example(3,1) code
output+
T
+
111 100 010 110 011 001 000
0
0
0
0
1
2 1
3 1 2
1 2
i
i s
i s s
s sInitial state -
s1 s2
Initial state - s s1 2 0
Trellis Representations
00
01
10
11
00
01
10
11
000111
001110
011100
010101
State Input Next state
Viterbi Algorithm-shortest path
Trellis codes-Euclidian distance
shortest path-Hamming distance
convencoder
blockencoder CHAN block
decoderVA
Configurations
Correction
blockencoder CHAN
Errordetection
NACK
Detection
A B
Data Link Prototcols
Data Link LayerSource Machine
Unrestricted SimplexTransmitter
Form Frame
Physical Layer
Packet fromNetwork Layer
Elementary Data Link Protocols(3.3)
Flag Flag
Basic Link Level Frame
Info CKSMFrame Header
Kind Seq ACKUser DataFormed into aPacket and Passedto Network Layer
Frame headerThree fields
Dealing with an Unreliable Channel
• Timeout routines
• Sequence number in Frames
Unrestricted SimplexReceiver
•Wakeup•Remove frame from Physical level buffer•Form packet and Pass to Network Layer•Go back to sleep
Simplex Stop-and Wait
•Infinite processor speed or infinite buffer not needed•Inserting maximum delay too conservative
•ACK to sender is solution (Data in one direction only)•Transmitter
•Fetch packet from network level•Form frame•Frame stored in transmit buffer until ACK received•Transmitted after ACK
•Receiver•Remove frame from Physical level buffer•Form packet and Pass to Network Layer•Return ACK
Flow Control Problem
Stop-and Wait Simplex - Noisy Channel
Complicating Factor - ACK errorsSame frame received in succssionRemedy - sequence numbers 0 and 1
•Transmitter•Initialize sequence number•Fetch packet from network level•Form frame•Insert sequence number in frame•Timeout and resend frame•Frame stored in transmit buffer until ACK received•Invert sequence number
Receiver•CHECKSUM to validate received frame •Remove frame from Physical level buffer•Check sequence number•Form packet and Pass to Network Layer•Invert expect sequence number•Return ACK
Sliding Window Protocols
•Full Duplex Info and ACKs simultaneously•Piggybacking-ACK on Data Frames
-complications-ad hoc scheme• Sequence numbers - maximum 2n-1•Sending window - Number of frames allowed to send
•Receiving window - Number of frames allowed to accept
One bit Sliding Window(Stop-and-Wait)
Link Layer A
Link Layer B
Info and piggybacked ACKs
Info and piggybacked ACKs
One process as initiatorelse duplication(See Fig 3-14b)
A sends (0,1,A0)
A gets (0,0,B0)*A sends (1,0,A1)
A gets (1,1,B1) *A sends (0,1,A2)
A gets (0,0,B2) *A sends (1,0,A3)
B gets (0,1,A0)B sends (0,0,B0)
B gets (1,0,A1) *B sends (1,1,B1)
B gets (0,1,A2) *B sends (0,0,B2)
B gets (1,0,A3) *B sends (1,1,B3)
(Seq,ACK,Pkt #)
Time
A in Lead
A sends (0,1,A0)
A gets (0,1,B0) *A sends (0,0,A0)
A gets (0,0,B0)A sends (1,0,A1)
A gets (1,0,B1) *A sends (1,1,A1)
B sends (0,1,B0)
B gets (0,1,A0) *B sends (0,0,B0)
B gets (0,0,A0)B sends (1,0,B1)
B gets (1,0,A1)B sends (1,1,B1)
B gets (1,1,A1)B sends (0,1,B2)Time
No leader
(Seq,ACK,Pkt #)
Low throughput one bit window
Line FlowFrame
TransmissionTimeout interval Message
Transmission
Throughput(Line Utilization)
F T
F/(F+T)
Example: 50 kbps satellite channel, 1000 bit frame, Round trip delay 520 msec. F=20 msec
Window = w > 1 Pipelining
1 2 3 4 5 6 7 8
Eg: w = 4
Transmit
1 2 3 4 5 6 7 8Receive
ACKs
Can be all at onceACK last in batch
Error control
Go-back-n
1 2 3 4 5 2 3 4 5Transmit
1 2 3 4 5 2 3 4 5
Receive
Frame in error Ignored
Timeoutor NACK
A subtlety in sequence numbering
Sequence numbers-0,1,…,MAX_SEQ
Up to MAX_SEQ frames can be outstandingnot MAX_SEQ+1
Example: w=4, MAX_SEQ=3
•Frames 0, 1, 2, 3 received correctly but ACKs lost•Frames 0, 1, 2, 3 retransmitted receiver thinks they are newRemedy: MAX_SEQ=3, w=3, receiver waiting for 3in above scenario
Selective repeat
1 2 3 4 5 2 6 7
Transmit
1 2 3 4 5 2 6 7
Receive
Frame in error Stored
Timeoutor NACK
ACK
NACK
Careful of repeats
A sends frames0 1 2 3 4 5 6
A times out andresends frames0 1 2 3 4 5 6
A sends frames7 0 1 2 3 4 5
Window at B0 1 2 3 4 5 6B gets 0 1 2 3 4 5 6without errorB sends ACK andAdvances window to7 0 1 2 3 4 5(empty buffers)
B gets 0 1 2 3 4 5 6without errorB sends ACK for0 1 2 3 4 5 6 Bad packets sent to network level
(Seq,ACK,Pkt #)
ACKs destroyed
Problem with SR
A sends frames0 1 2 3
A times out andresends frames0 1 2 3
Window at B0 1 2 3B gets 0 1 2 3without errorB sends ACK forAdvances window to4 5 6 7(empty buffers)
B gets 0 1 2 3without errorB sends ACK
(Seq,ACK,Pkt #)
ACKs destroyed
Remedy: New window has no overlap with original windowi.e window half of max sequence number
Number of buffers=window sizeTimer for each bufferAuxiliary timer
Efficiency Comparisions
F=Frame transmission time
RT=Roundtrip delay(propagation, processing)
w=Window size (sec) > RT (simplification)
PF=Probability frame error detected= 1-(1-PB)F
=1-(1-F PB)= F PB for PB<<1
TSaw , TGBn , TSR Total frame transmission times
=F/ Total frame transmission time
Stop and Wait
1 2 2 2 3 4Transmit
1 2 2 2 3 4
Receive
Frame in error
RT RT
Tsaw=(F+RT)/(1- PF)= (1- PF)/(1+RT/F)
Go-back-n
1 2 3 4 5 6 7 8 9 10 2 3 4 5Transmit
1 2 3 4 5 6 7 8 9 10 2 3 4 5
Receive
RT
TGBn =F /(1- PF)+RT PF /(1- PF)
= (1- PF)/(1+ PF RT/F)
Selective Repeat
1 2 3 4 5 6 7 8 9 10 2 111213
1 2 3 4 5 6 7 8 9 10 2 111213
Receive
RT
TSR = F /(1- PF) = 1- PF
Tsaw=(F+RT)/(1- PF)
= (1- PF)/(1+RT/F)
TGBn =F /(1- PF)+RT PF /(1- PF)
= (1- PF)/(1+ PF RT/F)
TSR = F /(1- PF) = 1- PF
Stop and Wait
Go-Back-n
Selective Repeat
0 2 4 6 8 10 12 14 16 18 200
0.2
0.4
0.6
0.8
1
1.2
Eff
icie
ncy
Normalized round trip
SAW PF=.1SAW PF=.01
SR PF=.1
SR PF=.01
GBn PF=.1
GBn PF=.01
Homework problems
#1 Calculate the efficiency of all three protocols for the following set of parameters:1) Frame length = 1000 bits2) Line rate = 1.544 Mbps3) Line length = 1000 km4) Bit error probability=10-4
5) Assume window larger than RT6) Assume propagation of 6 sec/km
#12, #15,#20, #24,#25
Finite State Machine Models of Protocols
• S = Set of possible channel and process states
• M = Set of frames on channel
• I = Set of initial states
• T = Set of transitions between states
• Reachability analysis
• Deadlock state– No transition out of state– No forward progress possible
• SDL - Specification Description Protocol
Example: Send-and-Wait Protocol
• Two sender states, 0,1
• Two receiver states, 0,1
• Four Channel states– 0 Frame in transit– 1 Frame in transit– A Ack in transit– Channel empty
0 0 -
0 0 0
0 0 0 1 0 -1 0 1
0 1 00 1 -
1 0A
1 1 -
1 1 1
0 1 A
0 7
0
7
1
05
4 2
0
3
6
8
08 0
Tra
nsi
tion
Wh
o ru
ns?
Fra
me
acce
pte
d
Fra
me
emit
ted
To
net
wor
k la
yer
0 (Frame lost)1 R 0 A Yes2 S A 1 -3 R 1 A Yes4 S A 0 -5 R 0 A No6 R 1 A No7 S (timeout) 0 -8 S (timeout) 1 -
Stop and Wait Protocol (Sender, Receiver, Channel)
Normaloperation
Flag Flag Data CKSMAddresses Control
Bit oriented protocols SDLC, HDLC, ADCCP, LAP, LAP
Addresses - Multiple terminals lines
Control - Sequence number, ACKs, etc (See next slide.)
Data - Transparency to User
CKSM - CRC Codes
Types of FramesDifferences in Control FieldsInformation
0 Sequence P/F Next
Control Field
Piggybacked ACKType indicator 3 bit number Poll/Final
Supervisory
1 0 Type P/F Next
Control Field
0 -ACK , 1 - NACK, 2 - Receive not ready3 - Selective reject
Unnumbered - Control and Data (sometimes) - depends onparticular protocol
Control Functions
• DISC(disconnect)-Machine going down
• SNRM(Set Normal Response Mode)-Machine coming back on unbalanced
• SABM(Set Asynchronous Balanced Mode)
• FRMR(Frame Reject)-Frame looks funny
• UA(Unnumbered Acknowledgement)-ACK for control frames
• Miscellaneous - Initialization, polling, status reports
LAN
LAN
LAN
LAN
The Internet
Router
Subnet
HostsLeased Lines
MODEM
MODEM
RO
UT
ER
Dial-up Telephone Line
TCP/IP ConnectionUsing SLIP of PPP
Access
PPP Point-to-Point Protocol
• Framing similar to HDLC-Frame delineation, error detection
• LCP(Link Control Protocol)-line bringing up,testing, setting options, putting down
• NPC(Network Control Protocol)-Negotiating network layer options
PPP FrameSimilar to HDLC but Character Oriented
Flag Payload CKSM Addresses Control FlagProtocol
•Character stuffing to make frame integral number of bytes•Flag - 01111110•Address - 11111111 all stations accept the frame•Control - 00000011 default, sequence number on unreliablelines•Address and control field can be omitted by negotiation•Protocol-Kind of packet in payload field•Payload variable up to some maximum•Checksum-2 bytes with 4 bytes optional
Dead Network
Establish Authenticate
OpenTerminate
Failed
Failed
Carrier Detected Both sides agree on options Successfulauthentication
NCP configurationDoneCarrier Dropped
ATM(Asynchronous Transfer Mode)
5 octets 48 octets
CellHeader User Data
Upper layers Upper layers
Plane managementLayer management
Control plane User Plane
ATM Adaptation layer
ATM layer
Physical layer
PMD-Physical medium dependent
TC - Transmission convergencecells bits
5 octets 48 octets
CellHeader User Data
No error control
HEC - Checksum over headerusing generator polynomialControl bytes
ationsynchronizfor 01010101
128
)xxx(
Non-Data Cells in ATM
• Idle cells in synchronous media
• OAM (Operations and Maintenance)– First three header bytes all zeros– Exchanges between switches– Speed matching in SONET– Framing function
Cell ReceptionCell delineation
HUNT
PRESYNCH
SYNC
Bit-by-bitcheck
Cell-by-cellcheck
Correct HEC detected
Incorrect HEC detected
Consecutivecorrect HECs
Consecutiveincorrect HECs
Probability of random “correct” pattern = 2-8
Probability of random “correct” patterns = 2-8