Chapter 3 The Data Link Layer: User A User B
Chapter 3 The Data Link Layer: User A User B
user A
user B
Model
used
Chapter 3 The Data Link Layer
3.1 Data Link Layer Design Issues
3.1.1 Services Provided to the Network layer
The usual approach is for the data link layer to break the bit
stream up into discrete frames and compute the checksum for
each frame. When a frame arrives at the destination, the
checksum is recomputed. If the newly computed checksum is
different from the one contained in the frame, the data link layer
knows that an error has occurred and takes steps to deal with it.
Chapter 3 The Data Link Layer
3.1 Data Link Layer Design Issues
3.1.2 Framing
Breaking the bit stream up into frames is more difficult than
it first appears.
Four methods:
1. Character count.
2. Starting and ending characters, with character stuffing.
3. Starting and ending flags, with bit stuffing.
4. Physical layer coding violations.
Chapter 3 The Data Link Layer
3.1 Data Link Layer Design Issues
3.1.2 Framing
Character count
Without error
Or negative
Acknowledgement (NAK)
Chapter 3 The Data Link Layer
3.1 Data Link Layer Design Issues
3.1.3 Error Control
Various flow control schemes are known, but most of them use
the same basic principle. The protocol contains well-defined
rules about when a sender may transmit the next frame.
These rules often prohibit frames from being sent until the
receiver has granted permission, either implicitly or explicitly.
Chapter 3 The Data Link Layer
3.2 Error Detection and Correction
Advantage:
n=m+r
There are 2n possible codewords and 2m possible data messages.
Hamming distance between codewords:
min d(C1,C2)=number of (same bit position) bits which differ
d(10010010,00010001)=3
radius=d bits
CRC-CCITT: x16+x12+x5+1
Chapter 3 The Data Link Layer
3.2 Error Detection and Correction
3.2.2 Error-detecting Codes
time-out
sender P(1) P(1) P(2)
error
receiver
ACK ACK
ACKs must also be numbered.
Chapter 3 The Data Link Layer
3.3 Elementary Data Link Protocols
If the data link layer waits longer than the sender’s timeout
period, the frame will be retransmitted, defeating the whole
purpose of having acknowledgements.
The sender’s window and the receiver’s window need not have
the same lower and upper limits, or even have the same size. In
some protocols they are fixed in size, but in others they can
grow or shrink as frames are sent and received.
If the window ever grows to its maximum size, the sending data
link layer must forcibly shut off the network layer until another
buffer becomes free.
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
The receiving data link layer’s window corresponds to the frames
it may accept. Any frame falling outside the window is discarded
without comment.
When a frame whose sequence number is equal to the lower edge
of the window is received, it is passed to the network layer, an
acknowledgement is generated, and the window is rotated by one.
receiver
ACK0 ACK1 ACK0 ACK1 Stop-and-Wait
sender time-out protocol
time-out
sender 0 1 1 0 ignored
receiver
ACK0 ACK1 ACK1 ACK0
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
NAK
receiver
ACK0 ACK1 ACK0
NAK can be used here to speed up processing.
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
A normal
scenario
A peculiar
scenario
(half of the
frames are
duplicates)
Efficiency=20/520=4%
It affects:
•sequence number SN
•buffer sizes in sender and receiver
sender has to buffer those sent but unacknowledged
(for possible retransmission)
(IF) receiver has to buffer those received but are out-of-
sequence (receiver has to deliver packets to network layer in
order)
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
Go Back n
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
Selective Repeat
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
3.4.2 A Protocol Using Go Back n
packets
sender’s
window
Consider when the cases when acks are
ok or when acks are lost.
receiver’s
window
All seven frames received correctly
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
3.4.3 A Protocol Using Selective Repeat
sender’s
window
Make sure there is no overlap when receiver
advances the window.
receiver’s
window
Chapter 3 The Data Link Layer
3.4 Sliding Window Protocols
3.4.3 A Protocol Using Selective Repeat
packets
ANSI ISO
ADCCP (Advanced Data HDLC (High-level Data Link
Communication Control Procedure) Control)
It just sends raw IP packets over the line, with a special flag byte
(0xC0) at the end for framing. If the flag byte occurs inside the
IP packet, a form of character stuffing is used, and the two byte
sequence (0xDB, 0xDC) is sent in its place.
Making a communication:
1. PC calls the provider’s router by a modem
2. Use LCP packets to select PPP parameters
3. Use NCP to receive an IP address
4. Send and receive IP packets
5. Use NCP to tear down the network layer connection and free up
the IP address
6. Use LCP to shutdown the data link connection
7. The computer tells the modem to hang up
Chapter 3 The Data Link Layer
3.6 Example data Link Protocols
3.6.2 The Data Link Layer in the Internet
PPP (Point-to-Point Protocol) (RFCs 1661, 1662, 1663)