Professional Documents
Culture Documents
3 Link Layer I
3 Link Layer I
436 Computer
Communication Networks II
Link Layer I
Link Layer
Learning Layers: We started with the Physical Layer
Application
Transport
Network
Link
Physical
Physical Layer
Topics
Application
Transport
Network
Link
Physical
Link Layer
Scope of the Link Layer
Concerns how to transfer messages over one or
more connected links
Messages are frames, of limited size
Builds on the physical layer
Frame
Link Layer
Frames
Link layer accepts packets from the network layer, and
encapsulates them into frames that it sends using the physical
layer; reception is the opposite process
Network
Link
Virtual data path
Transport
Operating Network
System
Link
Hardware
Physical
Link Layer
Typical Implementation of Layers
Link Layer
Topics
Framing
Delimiting start/end of frames
Retransmissions
Handling loss
Multiple Access
802.11, classic Ethernet
Switching
Modern Ethernet
Link Layer - Framing
Topic
The Physical Layer gives us a stream of bits. How do we
interpret it as a sequence of frames?
1100101100011
????
Link Layer - Framing
Framing Methods
We will consider the following framing methods:
Byte count
Byte stuffing
Bit stuffing
Expected
case
Error
case
Link Layer - Framing
Byte Stuffing
Better idea
Have a special flag byte value that means start/end of
frame
Replace (stuff) the flag inside the frame with an escape
code
Complication: have to escape the escape code
Frame
format
A ESC FLAG B
Stuffing
A ESC ESC B
examples
A ESC ESC ESC FLAG B
A ESC ESC ESC ESC B
Link Layer - Framing
Bit Stuffing
Can stuff at the bit level too
Call a flag six consecutive 1s
On transmit, after five 1s in the data, insert a 0
On receive, a 0 after five 1s is deleted
Link Layer - Framing
Bit Stuffing
Can stuff at the bit level too
Call a flag six consecutive 1s
On transmit, after five 1s in the data, insert a 0
On receive, a 0 after five 1s is deleted
Data bits
Transmitted bits
with stuffing
Link Layer - Framing
PPP over SONET
Retransmissions
Handling loss
Multiple Access
802.11, classic Ethernet
Switching
Modern Ethernet
Link Layer - Error Control
Topic
1 1 1
Signal 0 0 0 0 0
Noisy 1 1 1
Signal 0 0 0 0 0
Very
Noisy 1 1 1
0 0 0 0 0
Signal
Link Layer - Error Control
Solution Add Redundancy
Receiver
Receive D+R bits with unknown errors
Recompute R check bits based on the D data bits; error if R does not
match R
R = f(D)
???
Link Layer - Error Control
Intuition for Error Codes
All
codewords 2D+R codewords
Correct
codewords
2D codewords
But error could be in the check bits as well as the data bits.
Data might even be correct
Link Layer - Error Correction
Intuition for Error Correcting Code
Suppose we construct a code with a Hamming distance of at
least 3
Need 3 bit errors to change one valid codeword into
another
Single bit errors will be closest to a unique valid codeword
A C
B D
Link Layer - Error Correction
Intuition for Error Correcting Code
A C
B D
Link Layer Error Control
Error Correction in Practice
Heavily used in physical layer
LDPC is the future used for demanding links like 802.11, WIMAX, LTE,
power-line,
Convolution codes widely used in practice
Retransmissions
Handling loss
Multiple Access
802.11, classic Ethernet
Switching
Modern Ethernet
Link Layer Retransmissions
Two strategies to handle errors
Detect errors and retransmit frame;
Automatic Repeat reQuest ARQ
Application
Transport
Network
Link
Physical
Link Layer
Context on Reliability
Everywhere. It is a key issue
Different layers contribute differently
Application
Transport
Network With increasing level of
Link application-awareness
Physical
Link Layer -ARQ
ARQ often used when errors are common or must be corrected
E.g., WiFi, and TCP
Sender Receiver
Frame
Timeout Time
ACK
Link Layer -ARQ
Loss and retransmission
Sender Receiver
Frame
Timeout Time
Frame
Timeout
ACK
Link Layer -ARQ
Why are frames lost over the links?
Frame could be received by the receiver, but error is
detected
Noise/resulting error so severe that receiver may not detect
frame
Link Layer -ARQ
Why automatic repeat request?
Sender Receiver
Frame
Timeout Time
Frame
Timeout
ACK
Link Layer -ARQ
What is tricky about ARQ?
Non-trivial issues
How long to set the timeout?
How to avoid accepting duplicate frames as new frames
Want
Performance in the common case
Correctness always
Link Layer ARQ
Timeouts
Timeouts should be
Not too big (link goes idle)
Not too small (too many retransmissions)
Sender Receiver
Frame
Timeout
ACK
Frame
The same frame?
New frame?
ACK
Link Layer ARQ
Duplicates
Or the timeout is early?
Sender Receiver
Frame
Timeout Frame
ACK
The same frame?
New frame?
ACK
Link Layer ARQ
Sequence Numbers
Frames and ACKs must both carry sequence numbers for
correctness
Sender Receiver
Frame - 0
Frame - 0
ACK - 0
Frame - 1
Frame - 1
ACK - 1
Link Layer ARQ
Stop-and-Wait
With ACK loss:
Sender Receiver
Frame - 0
Frame - 0
ACK - 0
Frame - 0
Frame 0
Resend
ACK - 0
Link Layer ARQ
Limitation of Stop-and-Wait
It allows only a single frame to be outstanding from the
sender
Good for LAN, not efficient for high BD