Mod 2 - Data Link Layer
Mod 2 - Data Link Layer
Mod 2 - Data Link Layer
Issues
DATA LINK LAYER DESIGN ISSUES
Functions:
1. Providing a well-defined service interface to the network layer.
2. Dealing with transmission errors.
3. Regulating the flow of data so that slow receivers are not swamped by fast
senders.
The data link layer takes the packets it gets from the network layer and encapsulates them into
frames for transmission.
Services Provided to the Network Layer
1. Unacknowledged connectionless service:
• source machine send independent frames to the destination machine without having
the destination machine acknowledge them.
2. Acknowledged connectionless service:
• no logical connections used, but each frame sent is individually acknowledged.
3. Acknowledged connection-oriented service:
• the source and destination machines establish a connection before any data are
transferred.
• Each frame sent over the connection is numbered, and the data link layer guarantees
that each frame sent is indeed received.
• it guarantees that each frame is received exactly once and that all frames are received
in the right order.
Framing
• Breaking up the bit stream into frames is more difficult than it at first appears.
• A good design must make it easy for a receiver to find the start of new frames while using
little of the channel bandwidth.
Four methods:
1. Byte count.
• specify the number of bytes in the frame hence can identify end of frame.
2. Flag bytes with byte stuffing.
• each frame start and end with special bytes
3. Flag bits with bit stuffing.
• each frame start and end with special bits
4. Physical layer coding violations.
• some reserved signals to indicate the start and end of frames.
• because they are reserved signals, it is easy to find the start and end of frames and there is no need to stuff the data.
Framing - Byte count
Disadvantage:
• Even if the checksum is
incorrect so the destination 5 =101
knows that the frame is bad, it
still has no way of telling where
the next frame starts.
• Sending a frame back to the
source asking for a 7 =111
retransmission does not help
either, since the destination
does not know how many
bytes to skip over to get to the
start of the retransmission.
Framing - Flag bytes with byte stuffing
• flag byte, is used as both the starting and ending
delimiter
• Two consecutive flag bytes indicate the end of
one frame and the start of the next.
Problem:
• It may happen that the flag byte occurs in the
data, especially when binary data such as
photographs or songs are being transmitted.
Solution:
• insert a special escape byte (ESC) just before
each ‘‘accidental’’ flag byte in the data.
• on the receiving end removes the escape bytes
before giving the data to the network layer.
• This technique is called byte stuffing.
Framing - Flag bits with bit stuffing
• Each frame begins and ends with a special bit pattern, 01111110 - flag byte
Framing - bit and byte stuffing Disadvantage
• the length of a frame now depends on the contents of the data it carries.
• Data = 100 bytes
• After byte stuffing = 200 bytes
• After bit stuffing = an increase of 12.5% (225 bytes)
Framing
• Many data link protocols use a combination of these methods for
safety.
• Ethernet and 802.11 have a frame begin with a well-defined pattern
called a preamble.
• This pattern allow the receiver to prepare for an incoming packet.
• The preamble is then followed by a length (i.e., count) field in the
header that is used to locate the end of the frame.
Error Control
• Checksum
• positive or negative acknowledgements
• Timer
• sequence numbers
• The whole issue of managing the timers and sequence numbers so as to ensure that each frame is
ultimately passed to the network layer at the destination exactly once, no more and no less, is an
important part of the duties of the data link layer
Flow Control
• what to do with a sender that systematically wants to transmit frames
faster than the receiver can accept them.
Two approaches
1. Feedback-based flow control:
• the receiver sends back information to the sender giving it permission to send more data
2. Rate-based flow control:
• the protocol has a built-in mechanism that limits the rate at which senders may transmit
data, without using feedback from the receiver