8 Data Link Layer 08112022 011032pm

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Data Link Layer

5-1
Link Layer: Introduction “link”
Some terminology:
• hosts and routers are nodes
• communication channels that connect
adjacent nodes along communication path
are links
• wired links
• wireless links
• LANs
• layer-2 packet is a frame, encapsulates
datagram
• link layer is to move a datagram from one
node to an adjacent node over a single
communication link

data-link layer has responsibility of


transferring datagram from one node
to adjacent node over a link
5: DataLink Layer 5-2
Link Layer Services
• Framing, link access:
• Almost all link-layer protocols encapsulate each network-layer datagram within
a link-layer frame before transmission over the link.
• A frame consists of a data field, in which the network-layer datagram is
inserted, and a number of header fields.
• encapsulate datagram into frame, adding header, trailer
• channel access if shared medium
• “MAC” addresses used in frame headers to identify source, dest
• different from IP address!
• Link layer it guarantees to move each network-layer datagram across
the link without error.
• Reliable delivery between adjacent nodes
• we learned how to do this already
• it guarantees to move each network-layer datagram across the link without
error.

5: DataLink Layer 5-3


Link Layer Services (more)
• Flow Control:
• pacing between adjacent sending and receiving nodes
• Error Detection:
• errors caused by signal attenuation, noise.
• receiver detects presence of errors:
• signals sender for retransmission or drops frame
• Error Correction:
• receiver identifies and corrects bit error(s) without resorting to retransmission
• Half-duplex and full-duplex
• with half duplex, nodes at both ends of link can transmit, but not at same time

5: DataLink Layer 5-4


Adaptors Communicating
datagram
link layer protocol rcving
sending node
node
frame frame
adapter adapter

• link layer implemented in • receiving side


“adaptor” (NIC) • looks for errors, rdt, flow
• Ethernet card, 802.11 card control, etc
• extracts datagram, passes to
• sending side: rcving node
• encapsulates datagram in a
frame • link & physical layers
• adds error checking bits, rdt,
flow control, etc.

5: DataLink Layer 5-5


Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields

 Error detection not 100% reliable!


 protocol may miss some errors, but rarely
 larger EDC field yields better detection and correction

5: DataLink Layer 5-6


Error Detection Schemes
• Parity Bit
• Internet Checksum
• CRC

5: DataLink Layer 5-7


Parity
• Value of parity bit is such that character has even
(even parity) or odd (odd parity) number of ones

• Simple Parity
• Longitudinal Redundancy Check/Vertical
Redundancy Check (LRC/VRC)

8
Parity Examples - Using Even Parity

Even Parity of 1’s LRC/VRC


Data VRC
1 0 0 1 1 1 0 0
Data Parity 0 0 1 1 1 0 0 1
1 1 1 0 1 1 1 0
1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0
0 0 1 1 1 0 0 1
0 0 1 1 1 0 0 1
0 0 1 0 1 0 1 1
1 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1
1 0 0 0 1 1 1 0 LRC

9
Parity Checks
Simple parity - If performing even parity, add a
parity bit such that an even number of 1s are
maintained.
If performing odd parity, add a parity bit such that
an odd number of 1s are maintained.
For example, if the character 1001010 is to be sent,
using even parity, a parity bit = 1 would be added to
the character.
If the character 1001011 is to be sent, using even
parity, a parity bit = 0 would be added to the
character.

10
Parity Checks

What happens if the character 10010101 (parity bit


is the last bit) and the first two 0s accidentally
become two 1s?
Thus, the following character is received: 11110101.
Will there be a parity error?
High overhead (one extra bit per 7-bit
character=12.5%)
Problem: Simple parity only detect bits in error
(50%)

11
Parity Checks

Longitudinal parity adds a parity bit to each


character then adds a row of parity bits
after a block of characters.
The row of parity bits is actually a parity bit
for each “column” of characters.
The row parity bits plus the column parity
bits add a great amount of redundancy to a
block of characters.

12
13

You might also like