The Data Link Layer
The Data Link Layer
Chapter 3
Data Link Layer Design Issues
P Services Provided to the Network Layer
P Framing
P Error Control
P Flow Control
Functions of the Data Link Layer
P Provide service interface to the network layer
P Dealing with transmission errors
P Regulating data flow
< Slow receivers not swamped by fast senders
Functions of the Data Link Layer (2)
P Raw bit stream from physical layer are not error free
P The number of bits may be less than, equal to, or more than the
number of bits transmitted
P Data link must detect and correct
P The usual approach
< Break bit stream into frames
< Compute checksum for each frame
< Checksum is recomputed at the receiver and compared
Framing
Character count
P Bit stuffing
P Assume flag : 01111110 (1 zero, 6 ones, 1 zero)
P (a) The original data.
P When a sequence of 5 ones appear then stuff a zero (0)
P (b) The data as they appear on the line.
P (c) The data as they are stored in receiver's memory after
destuffing.
P Resynch -> find flag
Framing
Use redundancy
P Use two bits to transmit 1 bit
P 0 is transmitted as 01
P 1 is transmitted as 10
P No 00 or 11
P 00 or 11 can be used to delimit frames
Error Control and Flow Control
P Error Control:
< Ensure reliability -> need feedback
< Protocol requires somekind of acknowledgement
< Complication: frame can vanish
< Don’t wait forever -> use timer
– Acknowledgement must received before timer expires
< Acknowlegement frame can be lost -> send frame again
< Danger! Multiple frames -> use sequence number for each frame
P Flow Control
< Feedback-based
< Rate-based
Error Detection and Correction
P Error-Correcting Codes
< Include enough redundant information along with data so that the
receiver can correct the error
P Error-Detecting Codes
< Include enough redundant information along with data so that the
receiver can detect an error
Error Type
P Isolated: 0 -> 1, or 1 -> 0
P Parity bit
P Error detection
P Added to data so that number of 1 bits in codeword is
P Even (even parity)
P Odd (odd parity)
P E.g., ASCII of ‘H’ is 1001000, its codeword is
P ________ if even parity is used
P ________ if odd parity is used
P Parity code’s Hamming distance = _
Error-Correcting Codes
P Some definitions
needed in the
protocols to follow.
These are located
in the file
protocol.h.
Unrestricted Simplex Protocol
No loss, never damaged
(A) (B)
P (A) transmitter
P (B) receiver
Simplex Stop-and-Wait Protocol
No Error, simplex traffic, but prevent flood
P (A) transmitter
< Need to wait for ack from
receiver
P (B) receiver
< After receiving a data send
an ack
(A) (B)
A Simplex Protocol for a Noisy Channel
P Error in channel
P Transmitter
< A positive acknowledgement
with retransmission protocol.
< Retransmit until correctly
received
P Positive Acknowledgement with
Retransmission (PAR) or
Automatic Repeat reQuest (ARQ)
P 1 bit sequence number
P If 0 is the current sequence
number then 1 is the next
sequence number and (1 -> 0)
A Simplex Protocol for a Noisy Channel
P Receiver
< A positive acknowledgement
with retransmission protocol.
Sliding Window Protocols
Bidirectional
P To achieve full-duplex :
< Two channel (one for each direction)
< Same channel (or circuit) for both direction
< Data are intermixed with acknowledgement
P Interleaving data and control are possible
P Piggiback is also possible (wait to send)
P Protocols:
< A One-Bit Sliding Window Protocol
< A Protocol Using Go Back N
< A Protocol Using Selective Repeat
Sliding Window Protocols
New packet
given the next
highest sequence
number
P Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The
notation is (seq, ack, packet number). An asterisk indicates where a
network layer accepts a packet.
A Protocol Using Go Back N
Pipelining
P Pipelining
< channel capacity b bps
< frame size is l
< round-trip propagation time is R sec
< Time to transmit = l/b
Pipelining
+ channel capacity b bps
+ frame size is l
+ round-trip propagation
time is R sec
+ Time to transmit = l/b
+ line utilization =
P Control field of
P (a) An information frame.
P (b) A supervisory frame.
P (c) An unnumbered frame.
The Data Link Layer in the Internet