Data Link Layer
Data Link Layer
Quiz
What is the role of the data link layer?
A. Routing Packets
B. Next hop delivery
C. Encoding
D. Supporting processes
1. Framing Techniques
2. Error Control
Byte Oriented Protocol
Bit Oriented Protocol
Data Link Layer:
Reliable Data Transfer
Outline Sending
Process
Receiving
Process
Sending Receiving
– Unreliable channel with bit Process Process
Sending Receiving
b) Implementation
Automatic Repeat Request (ARQ)
– Do we need both?
Packet Packet
– Checksum, CRC etc
ACK NACK
● Receiver Feedback
Next Packet Same Packet
– ACK + NACK
RDTv1.0
RDTv1.0 has a fatal flaw!
● What if the ACK/NACK
got corrupted? Required Functionality:
● Error Detection
– What should sender do then?
mechanism
● Send next packet? If prev.
pkt is lost, RDT not – Checksum, CRC etc
providing reliability
● Receiver Feedback
● Send previous packet? If
prev. pkt is not lost, creates – ACK + NACK
duplicates
RDTv2.0
• Receiver gives feedback Required Functionality:
(ACK, NACK)
● Error Detection
• Sender retransmits mechanism
"sequenced" packet on
NACK, garbled
– Checksum, CRC etc
ACK/NACK
● Receiver Feedback
• Receiver discards
– ACK + NACK
duplicates if any based
on sequence number – Data Sequence Numbers
RDTv2.0
Duplicate Rx accepts
Rx discards
RDTv2.1
● Optimization: NACK free operation
● Receiver Feedback
– ACK + NACK
ACK0
ACK1
ACK0
(a) No Loss
(b) Lost Packet
Packet0 ACK0
Packet0
ACK0 Timeout
Timeout
Packet0
Duplicate Packet Packet1
Discard Packet
ACK0 Send ACK
Packet0 ACK0
Packet0
ACK0 Timeout
Duplicate Packet
Timeout
Packet0 ACK0 Discard Packet
Send ACK
Duplicate Packet Packet1
Discard Packet
ACK0 Send ACK Duplicate ACK,
Retransmit Packet1
Packet1
ACK1
Packet0 ACK0
Packet0
ACK0 Timeout
Duplicate Packet
Timeout
Packet0 ACK0 Discard Packet
Send ACK
Duplicate Packet Packet1
Discard Packet
ACK0 Send ACK Duplicate ACK,
Retransmit Packet1
Packet1
ACK1
Packet0 ACK0
Packet0
ACK0 Timeout
Duplicate Packet
Timeout
Packet0 ACK0 Discard Packet
Send ACK
Duplicate Packet Packet1
Discard Packet
ACK0 Send ACK Duplicate ACK,
Ignore, Do nothing
ACK1
7
● Throughput: 8000 bits / [(8000/10 ) + 2*0.010]
= 384.6Kbps
RTT
Packet1
Sender Receiver
• a >>>1 Tx <<< PD less utilization
Sender Receiver
Performance of Stop and Wait Protocol
• for eg. : A 1.5 Mbps link with a 45-ms RTT. i.e the link has (delay
x bandwidth) product of 67.5Kb or 8 KB. Since the sender can
send only one frame per RTT and assume frame size is 1 KB, this
implies a maximum sending rate of
P5 Ack5
Utilization = P1
P6 Ack6 Utilization = TX
5*TX time / P7 Ack7 time / (TX time
(TX time + P8 Ack8 + RTT)
RTT) P9 Ack9
Eg: 3.8%
b) Stop and Wait
Eg: 19% a) Sliding Window
Performance of Stop and Wait Protocol
7
● Throughput: 8000 bits / [(8000/10 ) + 2*0.010]
= 384.6Kbps
AlreadyAcked Can‟tsend
SWS
Receiver Side
● Maintains the following three variables
– Received Window Size (RWS): upper bound on the number of
out of order frames
– LAF denotes sequence number of last acceptable frame
– LFR denotes sequence number of last frame received
● Set LAF = LFR + RWS
In order, Passed up
Expected, Hole RWS Acceptable, within window
Consequences
● Need a range of sequence numbers (two won’t suffice)
• Examples:
•
• 1. Simple - Sliding Window Protocol
• 2. Go Back N - Sliding Window Protocol
• 3. Selective Repeat - Sliding Window Protocol
Utilization of Sliding Window Protocol
• U = 1 W > (1 + 2a)