0% found this document useful (0 votes)
23 views34 pages

CCN Lec 08

The data link layer provides reliable communication between adjacent nodes by: 1. Framing the bit stream into packets and adding checksums to detect errors. 2. Using acknowledgments and retransmissions to ensure reliable delivery of frames. 3. Providing different types of services like connection-oriented and connectionless to meet the needs of different applications.

Uploaded by

hamza riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views34 pages

CCN Lec 08

The data link layer provides reliable communication between adjacent nodes by: 1. Framing the bit stream into packets and adding checksums to detect errors. 2. Using acknowledgments and retransmissions to ensure reliable delivery of frames. 3. Providing different types of services like connection-oriented and connectionless to meet the needs of different applications.

Uploaded by

hamza riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 34

DATA LINK LAYER

Lecture No 08
Chapter Overview
The main goal of this layer is providing reliability
to the layers above it.
 DLL Design Issues
 What are the services provided by DLL?

 Error Detection and Correction


 Adding redundancy in order to find and correct errors.

 DLL Protocols
 Sliding Window Protocols
Data Link Layer Structure
 DLL is divided into Two sub layers.
 Logical Link Control
 MAC Sub-layer
Logical Link Control
 The uppermost sublayer is Logical Link Control
(LLC). This sublayer multiplexes protocols running at
top of the data link layer, and optionally provides flow
control, acknowledgment, and error recovery.
 PPP and HDLC protocols works in Logical Link
Control Sub Layer.
LLC Design
The concerns at the LLC include:

1. What services should be provided to upper layers?


2. Framing,
3. Error Control.
4. Flow Control.
LLC Design
The goal of the data link layer is to provide reliable, efficient
communication between adjacent machines connected by a
single communication channel. Specifically:
1. Group the physical layer bit stream into units called frames.
Note that frames are nothing more than "packets" or
"messages". By convention, we'll use the term "frames" when
discussing DLL packets.
2. Sender checksums the frame and transmits checksum
together with data. The checksum allows the receiver to
determine when a frame has been damaged in transit.
Cont…
3. Receiver re-computes the checksum and
compares it with the received value. If they
differ, an error has occurred and the frame is
discarded.
4. Perhaps return a positive or negative
acknowledgment to the sender. A positive
acknowledgment indicate the frame was received
without errors, while a negative acknowledgment
indicates the opposite.
Cont…
5. Flow control. Prevent a fast sender from
overwhelming a slower receiver. For example, a
supercomputer can easily generate data faster
than a PC can consume it.
6. In general, provide service to the network layer.
The network layer wants to be able to send
packets to its neighbors without worrying about
the details of getting it there in one piece.
DLL Design

There are several possible kinds of services that can be


provided to network layers.
The Figure is a reminder of the difference between virtual
and actual communications between layers.
Delivery Mechanisms
 Connection-less follows the “Best Effort” Model
and Unacknowledged.
 Connection Oriented ensure the Reliable
Delivery and acknowledged.
 These are actually the services which Data Link
layer is providing to Network layer.
DLL Design
Unacknowledged Connection-less Service -- Best Effort:
The receiver does not return acknowledgments to the sender, so the sender
has no way of knowing if a frame has been successfully delivered.

When would such a service be appropriate?


1. When higher layers can recover from errors with little loss in performance.
That is, when errors are so infrequent.

2. For real-time applications requiring "better never than late" semantics.


Old data may be worse than no data.
DLL Design

Acknowledged Connection-less Service -- Acknowledged


Delivery:

• Receiver returns an acknowledgment frame to the sender indicating


that a data frame was properly received.

• Receiver sends received frames to higher layers in the order in which


they arrive, regardless of the original sending order.

• Each frame is assigned a unique sequence number, which the receiver


returns in an acknowledgment frame to indicate which frame the ACK
refers to. The sender must retransmit unacknowledged (e.g., lost or
damaged) frames.
DLL Design
Acknowledged Connection-Oriented Service -- Reliable
Delivery:

• Frames are delivered to the receiver reliably and in the


same order as generated by the sender.

• Connection state keeps track of sending order and which


frames require retransmission. For example, receiver state
includes which frames have been received, which ones
have not, etc.
Framing
• It is the concept used in datalink layer.
• Datalink layer gets the services from the
Physical layer and provide the services to
the Network layer.
• The bit stream that it gets from the Physical
layer is not guaranteed to be error free.
Cont…
 Bits received may be less then, equal to or more
then the bits transmitted.
 It is the task of datalink layer to detect and
sometime correct errors.
 It breaks the bit stream into frames and compute
checksum for each frame.
 Receiver also recomputed the checksum.
Cont…
 Match the newly computed checksum.
 If matching is not equal, then the frame is
discarded and sending back an error report.
 Breaking the bit stream into frames is more
difficult.
 Size of frame is not constant. Just like words in
sentence.
 Problem is how we make frames???
Methods of Framing
1. Character Count
2. Flag bytes with byte stuffing
3. Starting and ending flags with bit stuffing
4. Physical layer coding violations
Character count
 It used a field in the header to specify the
number of characters in that frame.
 Receiver easily check the character count
and knows the size of frame.
Cont…
Problem with Character count
 Count can be garbled by transmission error.
 If checksum is incorrect then the frame is
bad.
 There is no way of telling where the next
frame starts.
Flag bytes with byte stuffing
 It gets around the problem of resynchronization
after an error by having each frame start and end
with special bytes
 This special byte is called flag byte.
 It used as starting and ending delimiters.
 If receiver loses synchronization, it request for
particular frame.
 Two consecutive flag bytes indicates the end of
one frame and start of next one.
Cont…
Problem
 When binary data match the value of flag
byte.
 It may happen when the flag bytes bit
pattern occurs in the data.
Solution
 Use special ESC byte just before accidental flag
byte in the data.
 Receiver will remove ESC byte and get the original
data.
 This method is called Byte stuffing OR character
stuffing.
Again Problem
 ESC byte bit pattern also present in the data.
 Then use another ESC byte.
 Any single escape byte is part of the escape
sequence.
 Doubled ESC byte indicates that a single escape
occurred naturally in the data.
Disadvantages
 It is closely tied to use of 8 bit character.
 Not all character code use 8 bit character.
e.g. Unicode uses 16 bit character
Starting and ending flags with bit
stuffing
 Each frame begins and ends with a special bit
pattern. 01111110
 Whenever sender datalink layer sees consecutive
five 1’s, it append 0 to mismatch it from flag byte.
 It is called Bit stuffing.
 When receiver sees five consecutive incoming 1
bits, followed by a 0 bit it automatically destuffs
the 0 bit.
Cont…
Cont…
 With bit stuffing the boundary between two
frames can be unambiguously recognized by
the Flag pattern.
 Just as byte stuffing is completely
transparent to the network layer in both
computers so is bit stuffing.
Physical layer coding violation
 It is used in networks in which the encoding on the
physical medium contains some redundancy.
 Some LANs encode 1 bit of data by using 2 physical
bits.
 A 1 bit is a high-low pair and a 0 bit is low-high
pair.
 The combination high-high and low-low are not
used for data. It is used for delimiting frames.
Error Control
 How to make sure all frames are eventually
delivered to the network layer at the destination
and in the proper order.
 Unacknowledged connectionless services are not
reliable services.
 Acknowledged connection oriented services are
reliable services because feedback is sent back to
sender.
 ACK OR NACK is sent back to sender.
Cont…
 What happened when Frame is vanished
completely due to noise burst.
 Receiver will not react and why should it react.
 Sender will wait for ACK or NACK and will hang
forever if a frame is lost.
 Then the concept of TIMER is introduced.
 When the sender transmits a frame, it starts timer.
Cont…
 The timer will set to expire after specified time.
 The time includes, a frame sent to receiver,
processed there, ACK or NACK came back to
sender.
 Normally a frame is properly received and the ACK
propagate back to sender before the timer expire.
 If either the frame or the ACK is lost, the timer will
expire, sender will retransmit the frame.
 Receiver will receive same frame multiple time.
Cont…
 To prevent this problem, it is necessary to assign
sequence numbers to outgoing frames.
 Receiver can easily distinguish retransmissions
from originals.
 Each frame will ultimately received at the
destinations and exactly once is a task of datalink
layer.

You might also like