Download as pdf or txt
Download as pdf or txt
You are on page 1of 69

Data Link Layer

Faisal Karim Shaikh

DEWSNet Group
Dependable Embedded Wired/Wireless Networks
www.fkshaikh.com/dewsnet

DEWSNet MUET Jamshoro


Dependable
© Neeraj Suri Embedded Wired/Wireless Networks
EU-NSF ICT March 2006
FRAMING

The data link layer needs to pack bits into


frames, so that each frame is distinguishable
from another.

Topics discussed in this section:


Fixed-Size Framing
Variable-Size Framing

Data Link Layer 2


Data Link Layer 3
FLOW AND ERROR CONTROL

The most important responsibilities of the data


link layer are flow control and error control.
Collectively, these functions are known as data
link control.

Topics discussed in this section:


Flow Control
Error Control

Data Link Layer 4


Flow control refers to a set of procedures
used to restrict the amount of data
that the sender can send before
waiting for acknowledgment.

Data Link Layer 5


Error control in the data link layer is
based on automatic repeat request,
which is the retransmission of data.

Data Link Layer 6


PROTOCOLS

•How the data link layer can combine framing,


flow control, and error control to achieve the
delivery of data from one node to another.

•The protocols are normally implemented in


software by using one of the common
programming languages.

Data Link Layer 7


Data Link Layer 8
NOISELESS CHANNELS
• First assume an ideal channel
• no frames are lost,
• duplicated,
•or corrupted.

•We introduce two protocols for this type of


channel.
Topics discussed in this section:
Simplest Protocol
Stop-and-Wait Protocol

Data Link Layer 9


The design of the simplest protocol with no flow or error control

Data Link Layer 10


Data Link Layer 11
Design of Stop-and-Wait Protocol

Data Link Layer 12


Data Link Layer 13
NOISY CHANNELS

• noiseless channels are nonexistent.


• Stop-and-Wait Protocol gives us an idea of
how to add flow control to its predecessor

Topics discussed:
Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request

Data Link Layer 14


Error correction in Stop-and-Wait ARQ
is done by keeping a copy of the sent
frame and retransmitting of the frame
when the timer expires.

Data Link Layer 15


In Stop-and-Wait ARQ, we use sequence
numbers to number the frames.

Data Link Layer 16


In Stop-and-Wait ARQ, the
acknowledgment number always
announces the sequence number of the
next frame expected.

Data Link Layer 17


Design of the Stop-and-Wait ARQ Protocol

Data Link Layer 18


Data Link Layer 19
Send window for Go-Back-N ARQ

Data Link Layer 20


The send window is an abstract concept
defining an imaginary box of size 2m − 1
with three variables: Sf, Sn, and Ssize.

Data Link Layer 21


The send window can slide one
or more slots when a valid
acknowledgment arrives.

Data Link Layer 22


Receive window for Go-Back-N ARQ

Data Link Layer 23


The receive window is an abstract
concept defining an imaginary box
of size 1 with one single variable Rn.
The window slides
when a correct frame has arrived; sliding
occurs one slot at a time.

Data Link Layer 24


Design of Go-Back-N ARQ

Data Link Layer 25


Window size for Go-Back-N ARQ

Data Link Layer 26


In Go-Back-N ARQ, the size of the send
window must be less than 2m;
the size of the receiver window
is always 1.

Data Link Layer 27


Data Link Layer 28
Data Link Layer 29
Stop-and-Wait ARQ is a special case of
Go-Back-N ARQ in which the size of the
send window is 1.

Data Link Layer 30


Send window for Selective Repeat ARQ

Data Link Layer 31


Receive window for Selective Repeat ARQ

Data Link Layer 32


Design of Selective Repeat ARQ

Data Link Layer 33


Selective Repeat ARQ, window size

Data Link Layer 34


In Selective Repeat ARQ, the size of the
sender and receiver window
must be at most one-half of 2m.

Data Link Layer 35


Delivery of data in Selective Repeat ARQ

Data Link Layer 36


Data Link Layer 37
High Level Data Link Control (HDLC)

High-level Data Link Control (HDLC) is a bit-


oriented protocol for communication over point-
to-point and multipoint links. It implements the
ARQ mechanisms we discussed.

Topics discussed in this section:


Configurations and Transfer Modes
Frames
Control Field

Data Link Layer 38


High Level Data Link Control (HDLC)

 an important data link control protocol


 specified as ISO 33009, ISO 4335
 station types:
 Primary - controls operation of link
 Secondary - under control of primary station
 Combined - issues commands and responses
 link configurations
 Unbalanced - 1 primary, multiple secondary
 Balanced - 2 combined stations

Data Link Layer 39


Normal response mode

Data Link Layer 40


Asynchronous balanced mode

Data Link Layer 41


HDLC Transfer Modes

Normal Response Mode (NRM)


 unbalanced config, primary initiates transfer
 used on multi-drop lines, eg host + terminals

Asynchronous Balanced Mode (ABM)


 balanced config, either station initiates
transmission, has no polling overhead, widely used

Asynchronous Response Mode (ARM)


 unbalanced config, secondary may initiate transmit
without permission from primary, rarely used

Data Link Layer 42


HDLC frames

Data Link Layer 43


Flag Fields and Bit Stuffing

delimit frame at both ends with 01111110 seq


receiver hunts for flag sequence to
synchronize
bit stuffing used to avoid confusion with data
containing flag seq 01111110
 0 inserted after every sequence of five 1s
 if receiver detects five 1s it checks next bit
 if next bit is 0, it is deleted (was stuffed bit)
 if next bit is 1 and seventh bit is 0, accept as flag
 if sixth and seventh bits 1, sender is indicating
abort

Data Link Layer 44


Address Field

identifies secondary station that sent or will


receive frame
usually 8 bits long
may be extended to multiples of 7 bits
 LSB indicates if is the last octet (1) or not (0)
all ones address 11111111 is broadcast

Data Link Layer 45


Control Field

different for different frame type


 Information - data transmitted to user
• Flow and error control piggybacked on information frames
 Supervisory - ARQ when piggyback not used
 Unnumbered - supplementary link control
first 1-2 bits of control field identify frame
type

Data Link Layer 46


Control Field

use of Poll/Final bit depends on context


in command frame is P bit set to1 to solicit
(poll) response from peer
in response frame is F bit set to 1 to indicate
response to soliciting command
seq number usually 3 bits
 can extend to 8 bits as shown below

Data Link Layer 47


Information & FCS Fields
 Information Field
 in information and some unnumbered frames
 must contain integral number of octets
 variable length
 Frame Check Sequence Field (FCS)
 used for error detection
 either 16 bit CRC or 32 bit CRC

Data Link Layer 48


U-frame control command and response

Data Link Layer 49


HDLC Operation

 consists of exchange of information, supervisory and


unnumbered frames
 have three phases
 initialization
• by either side, set mode & seq
 data transfer
• with flow and error control
• using both I & S-
S-frames (RR, RNR, REJ, SREJ)
 disconnect
• when ready or fault noted

Data Link Layer 50


Example of connection and disconnection

Data Link Layer 51


Example of piggybacking without error

Data Link Layer 52


Example of piggybacking with error

Data Link Layer 53


POINT-TO-POINT PROTOCOL

Although HDLC is a general protocol that can be


used for both point-to-point and multipoint
configurations, one of the most common
protocols for point-to-point access is the Point-
to-Point Protocol (PPP). PPP is a byte-oriented
protocol.

Topics discussed in this section:


Framing
Transition Phases
Multiplexing
Multilink PPP
Data Link Layer 54
PPP frame format

Data Link Layer 55


PPP is a byte-oriented protocol using
byte stuffing with the escape byte
01111101.

Data Link Layer 56


Transition phases

Data Link Layer 57


Multiplexing in PPP

Data Link Layer 58


LCP packet encapsulated in a frame

Data Link Layer 59


Table 11.2 LCP packets

Data Link Layer 60


Table 11.3 Common options

Data Link Layer 61


PAP packets encapsulated in a PPP frame

Data Link Layer 62


CHAP packets encapsulated in a PPP frame

Data Link Layer 63


IPCP packet encapsulated in PPP frame

Data Link Layer 64


Table 11.4 Code value for IPCP packets

Data Link Layer 65


IP datagram encapsulated in a PPP frame

Data Link Layer 66


Multilink PPP

Data Link Layer 67


Data Link Layer 68
Data Link Layer 69

You might also like