Download Error Control at Data Link Layer

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Error Control at Data Link Layer
1
Single Bit Error vs. Burst Error
2
Error Detection
Error detection uses the concept of
redundancy adding extra bits for
detecting errors at the destination.
3
Redundancy for Error Detection
4
Parity Check
5
2-d Parity Check
6
2-d Parity Check
• Based on “bit addition”
• A redundancy of n bits can detect a burst error of
length n
• If length more than n, can detect with a high
probability
• Some exceptions
– Any example?
7
Cyclic Redundancy Check (CRC)
Based on modulo-2 division
Most popular
8
Binary Division in CRC Generator
9
Binary Division in CRC Checker
10
Standard Polynomials
11
Name
Polynomial
Applicati
on
CRC-8
x8 + x2 + x + 1
ATM
header
CRC-10
x10 + x9 + x5 + x4 + x 2 + 1
ATM
AAL
ITU-16
x16 + x12 + x5 + 1
HDLC
ITU-32
x32 + x26 + x23 + x22 + x16 +
x12 + x11 + x10 + x8 + x7 +
x5 + x4 + x2 + x + 1
LANs
Rules to Select A Polynomial
• Should not divisible by x
– Detect all burst errors of length less than or equal to degree
• Should be divisible by x+1
– Detect all burst errors affecting an odd number of bits
• E.g., x+1, x2+1
• The CRC-12
– x12 + x11 + x3 + x + 1
– detect all burst errors affecting an odd number of bits, will
detect all burst errors with a length less than or equal to 12, and
will detect with 99.97% probability burst errors with a length
of 12 or more.
12
Checksum
13
Checksum: Sending
Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
10101001 00111001
The numbers are added using one’s complement
10101001
Sum
00111001
-----------11100010
Checksum
00011101
The pattern sent is
14
10101001 00111001 00011101
Checksum: Receiving
Now suppose the receiver receives the pattern sent in Example 7
and there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s, which,
after complementing, is all 0s and shows that there is no error.
10101001
00111001
00011101
Sum
11111111
Complement
00000000 means that the pattern is OK.
15
Checksum: Error
A burst error of length 5 that affects 4 bits.
10101111 11111001 00011101
When the receiver adds the three sections, it gets
10101111
11111001
00011101
Partial Sum
Carry
Sum
16
1 11000101
1
11000110 => Complement 00111001 !!!??
Error Correction
• Retransmission
– Go back N retransmission
– Selective retransmission
• Forward Error Correction
– Hamming Code
• Burst Error Correction
17
Forward Error Correction
• Purpose: An FEC (n, m) encoder
– Take m-bit original data as input
– Add r=n-m check bits to the original data to produce a n-bit
codeword
– The receiver can fix any error
18
Hamming Distance
• Code: set of codewords
• Hamming distance between 2 codewords is the
number of bit positions where the 2 codewords
differ
– HammingDist(10001001, 10110001) = 3
• Hamming distance of a code is the minimum
Hamming distance between any two codewords
in the code
– HammingDist({0000000000,0000011111,111110000
0,1111111111}) = 5
19
Interesting Findings
• To detect d single-bit errors
– Need a distance-(d+1) code
• Appling d single-bit errors to a codeword must result in an
invalid codeword. (WHY?)
• To correct d single-bit errors
– Need a distance-(2d+1) code
• Given an incorrect codeword, the corresponding correct one
must be the codeword closest in Hamming distance
(WHY?)
20
How Many Extra Bits is Needed?
Msg
msg x1
……
……
x1
x2
xm+r
1-x1
x2
x1
1-x2
xm+r
x1
x2
1-xm+r
xm+r
m+r+1
invalid
Suppose we want to correct single errors
# all possible data inputs = 2m, # possible (m+r)-bit numbers = 2m+r
=> 2m(m+r+1) ≤ 2m+r => m+r+1 ≤ 2r
# check bits needed = rmin
21
Data and Redundancy Bits
22
Number of data bits
m
Number of redundancy bits
r
Total bits
m+r
1
2
3
2
3
5
3
3
6
4
3
7
5
4
9
6
4
10
7
4
11
Hamming Code
• To correct single errors
• Redundant bits are placed at all power-of-2 positions of
the original data bits.
• The value of a redundant bit is the parity check bit of a
set of data bits.
– Considering a data bit at position k, express k as a sum of
powers of 2.
• E.g., 11 = 1+2+8. Thus, data bit at position 11 is checked by redundant
bit at position 1, 2, and 8.
23
Redundant bits in Hamming Code
24
Correct Errors with Hamming Code
Parity check for r1
Parity check for r2
Parity check for r4
Parity check for r8
Correct: 10011100101
25
Burst Errors with Hamming Code
A sequence of k codewords is arranged as a matrix,
1st column sent first, then 2nd column, then 3rd, etc.
k-bit burst error => at most 1 bit in each codeword is wrong
Use Hamming code to correct such bits
26