0% found this document useful (0 votes)
137 views3 pages

CRC 6

The data link layer has four main functions: 1) Detect errors using error detection codes like CRC, parity, and checksums. 2) Request retransmission of lost data using automatic repeat request (ARQ). 3) Perform framing by adding headers and trailers to packets to detect starts and ends. 4) Support initialization and disconnection operations between communicating devices. To perform these functions, the data link layer adds header and trailer bits to packets received from the upper layer to form frames. Error detection codes like CRC codes and parity checks are added to frames to detect errors. CRC codes are particularly effective at detecting burst errors.

Uploaded by

FaizanQazi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views3 pages

CRC 6

The data link layer has four main functions: 1) Detect errors using error detection codes like CRC, parity, and checksums. 2) Request retransmission of lost data using automatic repeat request (ARQ). 3) Perform framing by adding headers and trailers to packets to detect starts and ends. 4) Support initialization and disconnection operations between communicating devices. To perform these functions, the data link layer adds header and trailer bits to packets received from the upper layer to form frames. Error detection codes like CRC codes and parity checks are added to frames to detect errors. CRC codes are particularly effective at detecting burst errors.

Uploaded by

FaizanQazi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Data Link Layer: Functionality

• The data link layer must:


Data Link Layer – Detect errors (using redundancy bits)
– Request retransmission if data is lost
(using automatic repeat request -- ARQ)
– Perform framing (detect packet start and
end)
Srinidhi Varadarajan – Support initialization and disconnection
operations

Data Link Layer Frame Format


• The packet from the upper layer is the service
• These functions require that extra bits be
data unit (SDU)
added to the packet to be transmitted
• The frame (header, network layer packet, and
– Header bits are added to the front of each each
trailer) is the protocol data unit (PDU)
packet
– Trailer bits are added to the rear of each packet
• Note that the data link layer does not care
what is in the network layer packet and the
– The header, packet from upper layer (service data
physical layer does not care what is in the
unit), and trailer form a frame
frame generated by the data link layer

header service data unit trailer header service data unit trailer
frame frame

Error Detection Error Detection Codes

• Two types • Naïve scheme


– Error Detection Codes (e.g. CRC, Parity,
Checksums) – Send a duplicate copy of the message
– Error Correction Codes (e.g. Hamming, Reed • Problems
Solomon)
– Takes up too much space
• Basic Idea
– All bit combinations in a packet are valid – Poor performance.
– Add redundant information to determine if errors • Can’t even detect 2 bit errors
have been introduced
• Why redundant?

1
Single Parity Checks Two Dimensional Parity
Parity
bits
• Technically used for 1 bit error detection. Can also 0101001 1
detect any odd number of bit errors.
1101001 0
• Involves adding an extra “parity” bit to the bit string
• Two varieties: 1011110 1
– Even Parity Data
0001110 1
– Odd Parity
• Basic Idea: 0110100 1
– For even parity, make the total number of 1’s in the bit string 1011111 0
an even number. This mechanism decides the value of the
parity bit. Odd parity makes the number of 1”s odd instead of Parity
even. 1111011 0
byte
• Single Parity cannot detect burst errors
– Burst errors cause errors in a sub-string of arbitrary length
• Each byte is protected by a parity bit
– A burst error is as likely to cause an even number of errors
as an odd number of errors • The entire frame is protected by a parity
byte

Two-Dimensional Parity Checks


CRC Codes
• Arrange a string of bits as a
two-dimensional array and compute parity over • Burst errors are hard to model -- three
each row and each column of the array
parameters are typically used to
• Can detect
measure the effectiveness of a code for
– Any number of errors in a single row (detect even
number of errors with column parity) error detection
– Any number of errors in a single column (detect even 1. Minimum distance of the code
number of errors with row parity)
– Does it protect against everything? 2. Burst-detecting capability
• Answer is no. Why? Hint: Read between the lines. Single row 3. Probability that a random string is
or column
• What about burst errors
accepted as being error-free
– Need something stronger. CRC codes

Cyclic Redundancy Check CRC Computation


• Treat the (n+1) bit message as a polynomial of • Given:
degree n. The bits are the coefficients of the – Message: M(x)
polynomial.
– Divisor: C(x)
– 1101 = 1*x3 + 1*x2 + 0*x1 + 1*x0

• Calculating CRC • Multiply M(x) by xk, i.e. add k zeroes to the end of
– Sender and transmitter choose a divisor polynomial of
the message. Call this T(x)
degree k. e.g x3 + x2 + 1. Call this C(x) • Divide T(x) by C(x).
– Add k bits to the (n+1) bit message such that the • Subtract the remainder from T(x)
n+1+k bit message is exactly divisible by the divisor

• Choice of divisor is very important. • The result is the message including the CRC
– It determines the kind of errors that the CRC can guard
against.

2
CRC Computation
Generator
11111001
Message
CRC Codes
1101 10011010000
1101
1001 • Note: The CRC is computed over the entire
1101
1000 message, not a byte or a row/column.
1101
• When a message+CRC arrives at the
1011
1101 destination, divide it by the generator
1100 polynomial. If the remainder is 0, the
1101
message is intact, else it has been corrupted.
1000
1101 – The bit pattern that can cause a CRC code to fail
101 Remainder is not a regular pattern such a random error or
burst errors. That’s why CRCs are strong.
• C(x) = x3 + x2 + 1 – Try out an example, where you try corrupting the
• M(x) = x7 + x4 + x3 + x CRC in the previous slide
• Subtraction: logical XOR operation

Real World Example: Internet Checksum Example: Internet Checksum


u_short cksum(u_short *buf, int count)
• What’s a checksum? {
– Take a guess, check sum! register u_long sum = 0;
while (count--) {
– Another error detection scheme sum += *buf++;
• Treat message as a sequence of 16-bit if (sum & 0xFFFF0000) {
– /* carry, so wrap around */
integers – sum &= 0xFFFF;
– sum++;
• Add these integers together using 16-bit }
one’s-complement arithmetic }
return ~(sum & 0xFFFF);
• Take the one’s complement of the result }
• Resulting 16-bit number is the checksum

You might also like