0% found this document useful (0 votes)
131 views187 pages

CNS Unit 2

The document discusses data link layer concepts including framing, error control, flow control and protocols like stop-and-wait ARQ and go-back-N ARQ. It provides algorithms and examples to explain how these protocols handle frame transmission and retransmission over noisy channels.

Uploaded by

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

CNS Unit 2

The document discusses data link layer concepts including framing, error control, flow control and protocols like stop-and-wait ARQ and go-back-N ARQ. It provides algorithms and examples to explain how these protocols handle frame transmission and retransmission over noisy channels.

Uploaded by

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

Unit 2 - Data Link Layer

Subject – CNS 2019 pattern

Unit2 - Data Link Layer


Data Link Layer Design Issues

•Services Provided to the Network Layer


•Framing
•Error Control
•Flow Control

Unit2 - Data Link Layer 4


Functions of the Data Link Layer

•Provide service interface to the network layer


•Dealing with transmission errors
•Regulating data flow
• Slow receivers not swamped by fast senders

Unit2 - Data Link Layer 5


Functions of the Data Link Layer (2)

Relationship between packets and frames.

Unit2 - Data Link Layer 6


Services Provided to Network Layer

(a) Virtual communication.


(b) Actual communication.

Unit2 - Data Link Layer 7


Types of services provided to the Network Layer

• Unacknowledged Connectionless service

• Acknowledged Connectionless service

• Acknowledged Connection-Oriented service

Unit2 - Data Link Layer 8


Unacknowledged Connectionless service

• Losses are taken care of at higher layers


• Used on reliable medium like coax cables or optical
fiber, where the error rate is low.
• Appropriate for voice, where delay is worse than
bad data.

Unit2 - Data Link Layer 9


Acknowledged Connectionless service

• Useful on unreliable medium like wireless.


• Acknowledgements add delays.
• Adding ack in the DLL rather than in the NL is just an
optimization and not a requirement. Leaving it for
the NL is inefficient as a large message (packet) has
to be resent in that case in contrast to small frames
here.

Unit2 - Data Link Layer 10


Acknowledged Connection-oriented service

• Most reliable,
• Guaranteed service –
• Each frame sent is indeed received
• Each frame is received exactly once
• Frames are received in order
• Special care has to be taken to ensure this in
connectionless services

Unit2 - Data Link Layer 11


FRAMING

The data link layer needs to pack bits into frames, so


that each frame is distinguishable from another. Our
postal system practices a type of framing. The simple
act of inserting a letter into an envelope separates
one piece of information from another; the envelope
serves as the delimiter.
Topics discussed in this section:
Fixed-Size Framing
Variable-Size Framing

Unit2 - Data Link Layer 12


Figure A frame in a character-oriented protocol

Unit2 - Data Link Layer 13


Figure Byte stuffing and unstuffing

Unit2 - Data Link Layer 14


Note

Byte stuffing is the process of adding 1


extra byte whenever there is a flag or
escape character in the text.

Unit2 - Data Link Layer 15


Figure A frame in a bit-oriented protocol

Unit2 - Data Link Layer 16


Note

Bit stuffing is the process of adding one


extra 0 whenever five consecutive 1s
follow a 0 in the data, so that the
receiver does not mistake
the pattern 0111110 for a flag.

Unit2 - Data Link Layer 17


Figure Bit stuffing and unstuffing

Unit2 - Data Link Layer 18


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

Unit2 - Data Link Layer 19


Note

Flow control refers to a set of procedures


used to restrict the amount of data
that the sender can send before
waiting for acknowledgment.

Unit2 - Data Link Layer 20


Note

Error control in the data link layer is


based on automatic repeat request,
which is the retransmission of data.

Unit2 - Data Link Layer 21


PROTOCOLS

Now let us see 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.
To make our discussions language-free, we have
written in pseudocode a version of each protocol that
concentrates mostly on the procedure instead of
delving into the details of language rules.

Unit2 - Data Link Layer 22


Figure Taxonomy of protocols discussed in this chapter

Unit2 - Data Link Layer 23


NOISELESS CHANNELS

Let us first assume we have an ideal channel in


which 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

Unit2 - Data Link Layer 24


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

Unit2 - Data Link Layer 25


Algorithm Sender-site algorithm for the simplest protocol

Unit2 - Data Link Layer 26


Algorithm Receiver-site algorithm for the simplest protocol

Unit2 - Data Link Layer 27


Example stop-and-wait

Figure on next slide shows an example of communication


using this protocol. It is very simple. The sender sends a
sequence of frames without even thinking about the
receiver. To send three frames, three events occur at the
sender site and three events at the receiver site. Note that
the data frames are shown by tilted boxes; the height of
the box defines the transmission time difference between
the first bit and the last bit in the frame.

Unit2 - Data Link Layer 28


Figure Flow diagram for Example on prev slide

Unit2 - Data Link Layer 29


Figure Design of Stop-and-Wait Protocol

Unit2 - Data Link Layer 30


Algorithm Sender-site algorithm for Stop-and-Wait Protocol

Unit2 - Data Link Layer 31


Algorithm Receiver-site algorithm for Stop-and-Wait Protocol

Unit2 - Data Link Layer 32


Example Stop-and-Wait Protocol

Figure on next slide shows an example of communication


using this protocol. It is still very simple. The sender
sends one frame and waits for feedback from the receiver.
When the ACK arrives, the sender sends the next frame.
Note that sending two frames in the protocol involves the
sender in four events and the receiver in two events.

Unit2 - Data Link Layer 33


Figure Flow diagram for Example Stop-and-Wait Protocol

Unit2 - Data Link Layer 34


NOISY CHANNELS

Although the Stop-and-Wait Protocol gives us an


idea of how to add flow control to its predecessor,
noiseless channels are nonexistent. We discuss three
protocols in this section that use error control.

Topics discussed in this section:


1. Stop-and-Wait Automatic Repeat Request (ARQ)
2. Go-Back-N Automatic Repeat Request
3. Selective Repeat Automatic Repeat Request
Unit2 - Data Link Layer 35
Note

Error correction in Stop-and-Wait ARQ is


done by keeping a copy of the sent
frame and retransmitting of the same
frame when the timer expires.

Unit2 - Data Link Layer 36


Note

In Stop-and-Wait ARQ, we use sequence


numbers to number the frames.
The sequence numbers are based on
modulo-2 arithmetic.

Unit2 - Data Link Layer 37


Note

In Stop-and-Wait ARQ, the


acknowledgment number always
announces in modulo-2 arithmetic the
sequence number of the next frame
expected.

Unit2 - Data Link Layer 38


Figure Design of the Stop-and-Wait ARQ Protocol

Unit2 - Data Link Layer 39


Algorithm Sender-site algorithm for Stop-and-Wait ARQ

(continued)
Unit2 - Data Link Layer 40
Algorithm Sender-site algorithm for Stop-and-Wait ARQ (continued)

Unit2 - Data Link Layer 41


Algorithm Receiver-site algorithm for Stop-and-Wait ARQ Protocol

Unit2 - Data Link Layer 42


Example

Figure on next slide shows an example of Stop-and-Wait


ARQ. Frame 0 is sent and acknowledged.

Frame 1 is lost and resent after the time-out. The resent


frame 1 is acknowledged and the timer stops.

Frame 0 is sent and acknowledged, but the


acknowledgment is lost. The sender has no idea if the
frame or the acknowledgment is lost, so after the time-
out, it resends frame 0, which is acknowledged.

Unit2 - Data Link Layer 43


Figure Flow diagram for Example Stop-and-Wait ARQ

Unit2 - Data Link Layer 44


Go-Back-N Protocol
Note

In the Go-Back-N Protocol, the sequence


numbers are modulo 2m,
where m is the size of the sequence
number field in bits.

Unit2 - Data Link Layer 48


Figure Send window for Go-Back-N ARQ

Unit2 - Data Link Layer 49


Note

The send window is an abstract concept


defining an imaginary box of size 2m − 1
with three variables: Sf, Sn, and Ssize.

Unit2 - Data Link Layer 50


Note

The send window can slide one


or more slots when a valid
acknowledgment arrives.

Unit2 - Data Link Layer 51


Figure Receive window for Go-Back-N ARQ

Unit2 - Data Link Layer 52


Note

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.

Unit2 - Data Link Layer 53


Figure Design of Go-Back-N ARQ

Unit2 - Data Link Layer 54


Note

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.

Unit2 - Data Link Layer 56


Algorithm Go-Back-N sender algorithm

(continued)
Unit2 - Data Link Layer 57
Algorithm Go-Back-N sender algorithm (continued)

Unit2 - Data Link Layer 58


Algorithm Go-Back-N receiver algorithm

Unit2 - Data Link Layer 59


Example1 Go-Back-N
Figure on next slide shows an example of Go-Back-N.
This is an example of a case where the forward channel is
reliable, but the reverse is not. No data frames are lost,
but some ACKs are delayed and one is lost. The example
also shows how cumulative acknowledgments can help if
acknowledgments are delayed or lost. After initialization,
there are seven sender events. Request events are
triggered by data from the network layer; arrival events
are triggered by acknowledgments from the physical
layer. There is no time-out event here because all
outstanding frames are acknowledged before the timer
expires. Note that although ACK 2 is lost, ACK 3 serves as
both ACK 2 and ACK 3.
Unit2 - Data Link Layer 60
Figure Flow diagram for Example1 Go-Back-N

Unit2 - Data Link Layer 61


Example2 Go-Back-N

Figure on next slide shows what happens when a frame is


lost. Frames 0, 1, 2, and 3 are sent. However, frame 1 is
lost. The receiver receives frames 2 and 3, but they are
discarded because they are received out of order. The
sender receives no acknowledgment about frames 1, 2, or
3. Its timer finally expires. The sender sends all
outstanding frames (1, 2, and 3) because it does not know
what is wrong. Note that the resending of frames 1, 2, and
3 is the response to one single event. When the sender is
responding to this event, it cannot accept the triggering of
other events. This means that when ACK 2 arrives, the
sender is still busy with sending frame 3.
Unit2 - Data Link Layer 62
Example2 Go-Back-N (continued)

The physical layer must wait until this event is completed


and the data link layer goes back to its sleeping state. We
have shown a vertical line to indicate the delay. It is the
same story with ACK 3; but when ACK 3 arrives, the
sender is busy responding to ACK 2. It happens again
when ACK 4 arrives. Note that before the second timer
expires, all outstanding frames have been sent and the
timer is stopped.

Unit2 - Data Link Layer 63


Figure Flow diagram for Example2 Go-Back-N

Unit2 - Data Link Layer 64


Selective Repeat ARQ

Unit2 - Data Link Layer 66


Figure 18 Send window for Selective Repeat ARQ

Unit2 - Data Link Layer 67


Figure 19 Receive window for Selective Repeat ARQ

Unit2 - Data Link Layer 68


Figure 20 Design of Selective Repeat ARQ

Unit2 - Data Link Layer 69


Algorithm 9 Sender-site Selective Repeat algorithm

(continued)

Unit2 - Data Link Layer 72


Algorithm 9 Sender-site Selective Repeat algorithm (continued)

Unit2 - Data Link Layer (continued)


73
Algorithm 9 Sender-site Selective Repeat algorithm (continued)

Unit2 - Data Link Layer 74


Algorithm 10 Receiver-site Selective Repeat algorithm

Unit2 - Data Link Layer 75


Algorithm 10 Receiver-site Selective Repeat algorithm

Unit2 - Data Link Layer 76


Figure 22 Delivery of data in Selective Repeat ARQ

Unit2 - Data Link Layer 77


Figure 23 Flow diagram for Example Selective Repeat ARQ

Unit2 - Data Link Layer 82


ERROR CORRECTION
&
ERROR DETECTION

Unit2 - Data Link Layer 84


• Data can be corrupted during transmission. For
reliable communication, errors must be detected
and corrected.

• Error detection and correction are implemented


either at data link layer or the transport layer of the
OSI model.

Unit2 - Data Link Layer 85


TYPES OF ERRORS

• Single bit error :-


- Only one bit in the data unit has changed.

• Burst error :-
- It means that two or more bits in the data unit
has changed.

Unit2 - Data Link Layer 86


Single bit Error
0 0 0 0 0 0 1 0 Sent

0 changed to 1

0 0 0 0 1 0 1 0 Received

Sent Burst Error


0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Bits corrupted by Burst Error

0 1 0 1 1 1 0 1 0 1 0 0 0 0 1 1
Received
Unit2 - Data Link Layer 87
ERROR DETECTION

• Error detecting code is to include only enough


redundancy to allow the receiver to deduce that an
error occurred, but not which error, and have it
request a re-transmission.

• Error detection uses the concept of redundancy,


which means adding extra bits for detecting error at
the destination.

Unit2 - Data Link Layer 88


Redundancy

• Instead of repeating the entire data stream, a


shorter group of bits may be appended to the end
of each unit. This technique is called Redundancy,
because the extra bits are redundant to the
information. They are discarded as soon as the
accuracy of the transmission has been determined.

Unit2 - Data Link Layer 89


Unit2 - Data Link Layer 90
• Types of redundancy checks. They are:

1. VRC (Vertical Redundancy Check).


2. LRC (Longitudinal Redundancy Check).
3. CRC (Cyclical Redundancy Check).

Unit2 - Data Link Layer 91


ERROR DETECTION

• VERTICAL REDUNDUNCY CHECK

• LONGITUDINAL REDUNDANCY CHECK

• CYCLIC REDUNDANCY CHECK

Unit2 - Data Link Layer 92


VERTICAL REDUNDANCY CHECK

• It is also known as parity check


• It is least expensive mechanism for error
detection
• In this technique, the redundant bit called
parity bit is appended to every data unit so
that the total number of 1s in the unit
becomes even (including parity bit)

Unit2 - Data Link Layer 93


VERTICAL REDUNDANCY CHECK

1100001 Data

Checking function
1100001 | 1 Even – parity
Is total number
generator
of 1s even ?

Receiver 1 VRC

Sender

Unit2 - Data Link Layer 94


VERTICAL REDUNDANCY CHECK

• Example :

1110110 1101111 1110010

-> After adding the parity bit

11101101 11011110 11100100

Unit2 - Data Link Layer 95


VERTICAL REDUNDANCY CHECK

• VRC can detect all single-bit errors


• It can detect burst errors if the total number of
errors in each data unit is odd.
• VRC can not detect errors where the total number
of bits changed is even.

Unit2 - Data Link Layer 96


LONGITUDINAL REDUNDANCY CHECK(LRC)
• In this method , a block of bits is organized in
table(rows and columns)
• Calculate the parity bit for each column and the set
of this parity bit is also sending with original data.
• From the block of parity we can check the
redundancy.

Unit2 - Data Link Layer 97


LRC Example

11100111 11011101 00111001 10101001

11100111 11011101 00111001 10101001 11100111


11011101
00111001
10101001

LRC 10101010

11100111 11011101 00111001 10101001 10101010

Original data plus LRC


LRC Example

Suppose the following block is sent :


10101001 00111001 11011101 11100111 10101010
(LRC)
However, it is hit by burst errs and some bits are corrupted
(color bits are changed) :
10100011 10001001 11011101 11100111 10101010
(LRC)
When the receiver checks the LRC, some of the bits are not
follow even parity rule and whole block is discarded (the non
matching bits are shown in color) :
10100011 10001001 11011101 11100111 10101010

Unit2 - Data Link Layer 99


Advantage :
-> LRC of n bits can easily detect burst error of n bits.

Disadvantage :
-> If two bits in one data units are damaged and two
bits in exactly same position in another data unit
are also damaged , the LRC checker will not detect
the error.

Unit2 - Data Link Layer 100


CYCLIC REDUNDANCY CHECK (CRC)

• In this method , a sequence of redundant bits, called the


CRC or the CRC remainder, is appended to the end of the
unit so that the resulting data unit become exactly divisible
by a predetermined binary number.
• At its destination, the incoming data unit is divided by the
same number. If at this step there is no remainder ,the data
unit assume to be correct and is accepted, otherwise it
indicate that data unit has been damaged in transmission
and therefore must be rejected.
• The redundancy bits is used by CRC are derived by dividing
the data unit by a predetermined divisor. The remainder is
the CRC.

Unit2 - Data Link Layer 101


Cyclic Redundancy Check
CRC

Unit2 - Data Link Layer 102


Cyclic Redundancy Check: CRC

• Given a k-bit frame or message, the transmitter


generates an n-bit sequence, known as a frame
check sequence (FCS), so that the resulting frame,
consisting of (k+n) bits, is exactly divisible by some
predetermined number.
• The receiver then divides the incoming frame by the
same number and, if there is no remainder i.e. zero
value, assumes that there was no error.
• if there is non-zero remainder value, then there is
error in received data.

Unit2 - Data Link Layer 103


Binary Division

Unit2 - Data Link Layer 104


• Data with CRC sent = 100100001
• At receiver this data with CRC gets divided by same
divisor i.e. 1101. if remainder is 0 then it is accepted
else for non-zero remainder data is rejected due to
errors.

Unit2 - Data Link Layer 105


Receiver side division

• Data with CRC


• Divisor same as sender
• Remainder is 0, so there is no
error in data (last value)

Unit2 - Data Link Layer 106


POLYNOMIAL

Unit2 - Data Link Layer 107


POLYNOMIAL AND DIVISOR

Unit2 - Data Link Layer 108


STANDARD POLYNOMIALS EX.

Unit2 - Data Link Layer 109


ERROR-DETECTING CODES EX.

Calculation of the
polynomial code checksum.

Unit2 - Data Link Layer 110


PERFORMANCE

The checksum detects all errors involving an odd


number of bits.
It detects most errors involving an even number of
bits.
If one or more bits of a segment are damaged and
the corresponding bit or bits of opposite value in a
second segment are also damaged, the sums of
those columns will not change and the receiver will
not detect a problem.

Unit2 - Data Link Layer 111


EXAMPLE 1: CALCULATION FOR
GENERATING A CRC

•Message = 110101, Polynomial = 101


•FIND CRC?

Unit2 - Data Link Layer 113


CALCULATION FOR GENERATING
A CRC : SOLUTION

Unit2 - Data Link Layer 114


EXAMPLE 2: CHECKING A MESSAGE FOR
A CRC ERROR

•Message with CRC = 11010111


• Polynomial = 101
•Check if error in the message at the
receiver side.

Unit2 - Data Link Layer 115


EXAMPLE 2 SOLUTION:
CHECKING A MESSAGE FOR A
CRC ERROR

Unit2 - Data Link Layer 116


EXAMPLE 3: CHECKING A MESSAGE FOR
A CRC ERROR

•Message with CRC = 11010011


• Polynomial = 101
•Check if error in the message at the
receiver side.

Unit2 - Data Link Layer 117


ERROR CORRECTION

It can be handled in two ways:


1) Receiver can have the sender retransmit the
entire data unit. This is known as backward error
correction.(“Automatic Repeat Request”)
2) The receiver can use an error-correcting code,
which automatically corrects certain errors. This
is known as forward error correction. (Hamming
code)

Unit2 - Data Link Layer 118


• CRC generator and checker

DATA CRC DATA 00…0

N bits

DIVISOR DATA CRC DIVIS0R

N+1 bits

REMAINDER CRC

Zero accept
N bits
Nonzero reject

Receiver Sender
Unit2 - Data Link Layer 119
Divisor
The divisor is determined according to the algebraic
polynomial.
for e.g. A polynomial is
X^7 + x^5 + x^2 + x + 1
generation of divisor from polynomial
X^7 + X^5 + X^2 + X + 1

X^6 X^4 X^3

1 0 1 0 0 1 1 1

Unit2 - Data Link Layer 120


A polynomial should be selected according to the
following rule:-
1. It should not be divisible by x.
2. It should be divisible by x+1.

Unit2 - Data Link Layer 121


111101
1101
100100
• Example :- 0 0 0
1101
• The CRC generator at sender end :
1000
1101
1010
1101
1110
1101

0110
0000

1100
1101

0Link
Unit2 - Data 0 1 Layer 122
111101
1101
100100 0 0 1
1101
The CRC checker at receiver
1000
end :
1101
1010
1101
1110
1101

0110
0000

1101
1101

Unit2 - Data
0Link
0 0 Layer 123
ERROR CORRECTION

• Error correcting code is to include enough


redundant information along with each block of
data sent to enable the receiver to deduce what the
transmitted character must have been.

• Error Correction must be handled in two ways :


- When an error is discovered, the receiver can
have the sender retransmit the entire data unit.
- Receiver can use an error correcting code,
which automatically corrects certain errors.

Unit2 - Data Link Layer 124


• There are two types of Error Correcting techniques :

1. Single bit error correction.


2. Burst error correction.

• Error Correction can be done with the help


of HAMMING CODE.

Unit2 - Data Link Layer 125


HAMMING CODE

• It is a technique developed by R. W. Hamming.


• Hamming code can be applied to data units of any
length and uses the relationship between data and
redundancy bits.
• For eg.

Unit2 - Data Link Layer 126


• A 7 bit ASCII code requires 4 Redundancy bits that
can be added to the end of the data unit or
interspersed with the original data bits.

• These bits are placed in positions 1, 2, 4 and 8. We


refer to these bits as r1, r2, r4 and r8.

Unit2 - Data Link Layer 127


Positions of Redundancy/Parity Bits in Hamming Code

d d d r d d d r d r r
11 10 9 8 7 6 5 4 3 2 1

Redundancy Bits

Unit2 - Data Link Layer 128


• In the Hamming code, each r bit is the VRC bit for one
combination of data bits :
- r1 is the one combination of data bits.
- r2 is another combination of data bits.
and so on.

• The combination used to calculate each of the four


values for a 7 bit data sequence are as follows :
- r1 : bits 1,3,5,7,9,11.
- r2 : bits 2,3,6,7,10,11.
- r4 : bits 4,5,6,7.
- r8 : bits 8,9,10,11.

Unit2 - Data Link Layer 129


Data to be sent : 1 0 0 1 1 0 1
Data 1 0 0 1 1 0 1

Adding r1 1 0 0 1 1 0 1 1

Adding r2 1 0 0 1 1 0 1 0 1

Adding r4 1 0 0 1 1 0 0 1 0 1

Adding r8 1 0 0 1 1 1 0 0 1 0 1
11 10 9 8 7 6 5 4 3 2 1
Hamming Code : 1 0 0 1 1 1 0 0 1 0 1
Unit2 - Data Link Layer 130
1 0 0 1 1 1 0 0 1 0 1
Sent
Error

1 0 0 1 0 1 0 0 1 0 1
Received

Unit2 - Data Link Layer 131


1 0 0 1 0 1 0 0 1 0 1
11 10 9 8 7 6 5 4 3 2 1

1 0 0 1 0 1 0 0 1 0 1
11 10 9 8 7 6 5 4 3 2 1

1 0 0 1 0 1 0 0 1 0 1
11 10 9 8 7 6 5 4 3 2 1

1 0 0 1 0 1 0 0 1 0 1
11 10 9 8 7 6 5 4 3 2 1

The bit in position 7 is in error


0 1 1 1
Unit2 - Data Link Layer 132
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.

Unit2 - Data Link Layer 134


HDLC Overview

• Defines three types of stations


• Primary
• Secondary
• Combined
• Defines three types of data transfer mode
• Normal Response mode
• Asynchronous Response mode
• Asynchronous Balanced mode
• Three types of frames
• Unnumbered
• information
• Supervisory

Unit2 - Data Link Layer 135


HDLC

• The three stations are :


• Primary station
• Has the responsibility of controlling the operation of data flow the
link.
• Handles error recovery
• Frames issued by the primary station are called commands.
• Secondary station,
• Operates under the control of the primary station.
• Frames issued by a secondary station are called responses.
• The primary station maintains a separate logical link with each
secondary station.
• Combined station,
• Acts as both as primary and secondary station.
• Does not rely on other for sending data

Unit2 - Data Link Layer 136


Figure 25 Normal response mode

Unit2 - Data Link Layer 138


Figure 26 Asynchronous balanced mode

Unit2 - Data Link Layer 139


Figure 27 HDLC frames

Unit2 - Data Link Layer 140


Figure 28 Control field format for the different frame types

Unit2 - Data Link Layer 141


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.

Unit2 - Data Link Layer 154


Point to Point Data Link Control

• One sender, one receiver, one link: easier than broadcast


link:
• No Media Access Control
• No need for explicit MAC addressing
• E.g., dialup link, ISDN line
• Popular point-to-point and high-level DLC protocols:
• PPP (point-to-point protocol)
• HDLC: High level data link control (Data link used to be considered
“high layer” in protocol stack). HDLC is also used in multi-point
links (one station many receivers)
• These protocols can often be run over other data link
technologies providing best of both worlds
• E.g., PPPoE, HDLC encapsulation by Ethernet

Unit2 - Data Link Layer 155


PPP Design Requirements [RFC 1557]
Functionality : (similar to link layer services + extra
management functions)
• Packet framing - encapsulation of network-layer
datagram in data link frame
• Multi-protocol - carry network layer data of any network
layer protocol (not just IP) at same time ability to
demultiplex upwards
• Bit transparency - must carry any bit pattern in the data
field (even if underlying channel can't)
• Error detection - not correction

Unit2 - Data Link Layer 156


PPP Design Requirements (cont.)
The extra stuff:
• Connection liveness: detect, signal link failure to
network layer
• Network layer address negotiation: endpoint can
learn/configure each other’s network address and
other characteristics.
• Authentication: who are you?
• This information is used by traffic management software to control
bandwidth to individual subscribers
• Management features: loopback detection

Unit2 - Data Link Layer 157


PPP Services

• Defines format of the frame to be exchanged bet.


Devices
• Negotiation of link & exchange of data.
• Defines how 2 devices can authenticate each other.
• Provides connections over multiple links.
• Provides n/w address configuration.

Unit2 - Data Link Layer 159


Figure 32 PPP frame format

Unit2 - Data Link Layer 160


Note

PPP is a byte-oriented protocol using


byte stuffing with the escape byte
01111101.

Unit2 - Data Link Layer 161


Figure 33 Transition phases

Unit2 - Data Link Layer 162


Medium Access Control (MAC) Sub layer

• The data link layer is the second lowest layer.

• It is divided into two sub layers −


• The logical link control (LLC) sublayer
• The medium access control (MAC) sublayer

Unit2 - Data Link Layer 177


The following diagram depicts the position of the MAC layer:

Unit2 - Data Link Layer 178


Multiple Access Protocols

• Multiple Access Protocols:


• Pure and Slotted ALOHA,
• CSMA,
• WDMA,
• CSMA/CD,
• CSMA/CA,
• Binary Exponential Back-off algorithm

Unit2 - Data Link Layer 180


ALOHA
• It was designed for wireless LAN but is also
applicable for shared medium.
• In this, multiple stations can transmit data at the
same time and can hence lead to collision and data
being garbled.
• Types:
• Pure ALOHA
• Slotted ALOHA

Unit2 - Data Link Layer 181


Pure ALOHA
• Pure Aloha: frames transmitted at arbitrary times
• When a station sends data it waits for an acknowledgement. If the
acknowledgement doesn’t come within the allotted time then the
station waits for a random amount of time called back-off time (Tb) and
re-sends the data.
• Since different stations wait for different amount of time, the probability
of further collision decreases.
• Pure Aloha: channel efficiency
• Vulnerable period = 2 x packet time
• Packet time = time required to transmit 1 frame
• Throughput = Ge-2G
• Maximum throughput = 0.184 (when G=1/2 i.e.
G=0.5)

Unit2 - Data Link Layer 182


Figure Frames in a pure ALOHA network

2 frames sent at same time  collision


both frames destroyed
Unit2 - Data Link Layer 183
Slotted ALOHA
• It is similar to pure aloha, except that we divide
time into slots and sending of data is allowed only
at the beginning of these slots.
• If a station misses out the allowed time, it must
wait for the next slot. This reduces the probability
of collision.
• Slotted Aloha: channel efficiency
• Vulnerable Time = Frame transmission time
• Throughput = Ge-G
• Maximum throughput = 0.368 for G=1

Unit2 - Data Link Layer 184


Figure Frames in a slotted ALOHA network

12.185
CSMA
• It is a carrier sense multiple access based on media access
protocol to sense the traffic on a channel (idle or busy)
before transmitting the data.
• It means that if the channel is idle, the station can send data
to the channel. Otherwise, it must wait until the channel
becomes idle. Hence, it reduces the chances of a collision on
a transmission medium.
• Types:
• 1-persistent
• If channel is idle, a frame is transmitted
• If channel is busy, the channel is continuously checked
• Non-persistent
• If channel is idle, a frame is transmitted
• If channel is busy, a random time is waited before channel is sensed again
• p-persistent (slotted channel only)
• If channel is idle a frame is transmitted with probability p
• If channel is busy, next slot is sensed again

Unit2 - Data Link Layer 186


Figure Vulnerable time in CSMA
CSMA
• It is a carrier sense multiple access based on media access
protocol to sense the traffic on a channel (idle or busy)
before transmitting the data.
• It means that if the channel is idle, the station can send data
to the channel. Otherwise, it must wait until the channel
becomes idle. Hence, it reduces the chances of a collision on
a transmission medium.
• Types:
• 1-persistent
• If channel is idle, a frame is transmitted
• If channel is busy, the channel is continuously checked
• Non-persistent
• If channel is idle, a frame is transmitted
• If channel is busy, a random time is waited before channel is sensed again
• p-persistent (slotted channel only)
• If channel is idle a frame is transmitted with probability p
• If channel is busy, next slot is sensed again

Unit2 - Data Link Layer 188


Figure Behavior of three persistence methods
CSMA/CD
• Carrier sense multiple access with collision detection.
• It first senses the shared channel before broadcasting
the frames, and if the channel is idle, it transmits.
• checks whether the transmission was successful.
• Stations can terminate transmission of data if collision is
detected.
• Next, waits for a random time before sending a frame.
• Strategy
• Try to detect collisions asap
• Listen while transmitting
• If collision is detected, abort transmission

Unit2 - Data Link Layer 190


Figure Collision and abortion in CSMA/CD
CSMA/CA
• Carrier sense multiple access with collision avoidance.
• The process of collisions detection involves sender
receiving acknowledgement signals.
• If there is just one signal(its own) then the data is
successfully sent
• but if there are two signals(its own and the one with
which it has collided) then it means a collision has
occurred.
• CSMA/CA avoids collision by:
• Interframe space
• Contention Window
• Acknowledgement

Unit2 - Data Link Layer 193


Following are the methods used in the CSMA/CA to avoid the
collision:

• Interframe space – Station waits for medium to become


idle and if found idle it does not immediately send data
(to avoid collision due to propagation delay) rather it
waits for a period of time called Interframe space or IFS.
After this time it again checks the medium for being
idle. The IFS duration depends on the priority of station.
• Contention Window – It is the amount of time divided
into slots. If the sender is ready to send data, it chooses
a random number of slots as wait time which doubles
every time medium is not found idle. If the medium is
found busy it does not restart the entire process, rather
it restarts the timer when the channel is found idle
again.
• Acknowledgement – The sender re-transmits the data if
acknowledgement is not received before time-out.

Unit2 - Data Link Layer 194


Figure Timing in CSMA/CA

Unit2 - Data Link Layer 195


• Advantage of CSMA CA
• When the size of data packets is large, the chances of collision
in CSMA CA is less.
• It controls the data packets and sends the data when the
receiver wants to send them.
• It is used to prevent collision rather than collision detection on
the shared channel.
• CSMA CA avoids wasted transmission of data over the channel.
• It is best suited for wireless transmission in a network.
• It avoids unnecessary data traffic on the network with the help
of the RTS/ CTS extension.
• The disadvantage of CSMA CA
• Sometime CSMA/CA takes much waiting time as usual to
transmit the data packet.
• It consumes more bandwidth by each station.
• Its efficiency is less than a CSMA CD.

Unit2 - Data Link Layer 196


Binary Exponential Back-off algorithm
• BACKGROUND:
• Carrier Sense Multiple Access with Collision Detection
(CSMA/CD) is a network protocol for carrier transmission
that operates in the Medium Access Control (MAC) layer. It
senses or listens whether the shared channel for
transmission is busy or not, and defers transmissions until
the channel is free.
• When more than one stations send their frames
simultaneously, collision occurs. Back-off algorithm is a
collision resolution mechanism which is commonly used to
schedule retransmissions after collisions in Ethernet. The
waiting time that a station waits before attempting
retransmission of the frame is called as back off time.
• Means in CSMA/CD, if a collision is detected, the station
starts the binary exponential backoff algorithm.

Unit2 - Data Link Layer 197


Unit2 - Data Link Layer 198
Unit2 - Data Link Layer 199
C=0

C
(0, 2 - 1)

C++

Unit2 - Data Link Layer 200


WDMA
• Wavelength division multiple access
• Approach:
• Divide channel into sub-channels (FDM,…)
• Allocate them as needed
• 2 channels/station
• Narrow: used by other stations to signal the
station
• Wide: used by station to output data frames

Unit2 - Data Link Layer 201


WDMA

Unit2 - Data Link Layer 202


Wavelength division multiple access
• 2 transmitters & 2 receivers for each station:
• Fixed-wavelength receiver for its own control channel
• Tunable transmitter for sending on other control
channels
• Fixed wavelength transmitter for its own data
channel
• Tunable receiver for other data channels
• Support for 3 traffic classes:
• Constant data rate connection oriented traffic
• Variable data rate connection oriented traffic
• Datagram traffic

Unit2 - Data Link Layer 203


Introduction to n/w Standards

• Ethernet IEEE 802.3

• IEEE 802.11 a/b/g/n

• IEEE 802.15

• IEEE 802.16.

Unit2 - Data Link Layer 204


Ethernet 802.3
A bit of history…

• 1970 ALOHAnet radio network deployed in


Hawaiian islands
• 1973 Metcalf and Boggs invent Ethernet, random
access in wired net
• 1979 DIX Ethernet II Standard
• 1985 IEEE 802.3 LAN Standard (10 Mbps)Metcalf’s Sketch

• 1995 Fast Ethernet (100 Mbps)


• 1998 Gigabit Ethernet
• 2002 10 Gigabit Ethernet
• http://en.wikipedia.org/wiki/IEEE_802
• Ethernet is the dominant LAN standard

207
IEEE 802.3 MAC Frame
IEEE 802.3 MAC: Ethernet

• Minimum frame size


• Speed of light is about 3x108 m/s in vacuum and about
2x108 in copper
• So, max Ethernet signal prop time is about 12.5 usec, or
25 usec RTT
• With repeaters (processing delays introduced), 802.3
requires up to 51.2 usec to detect a collision
• Thus, minimum frame size is 51.2 usec * 10 Mbps = 512
bits (64 bytes)
• Maximum frame size
• 1500 byte limitation on maximum frame size
• Later we will call this the MTU (Max Transmission Unit)
• limits maximum buffers at receiver
• allows for other stations to send

209
IEEE 802.3 Physical Layer

10base5 10base2 10baseT 10baseFX


Medium Thick coax Thin coax Twisted pair Optical fiber
Max. Segment Length 500 m 200 m 100 m 2 km
Point-to-point
Topology Bus Bus Star
link
Table 6.2 IEEE 802.3 10 Mbps medium alternatives

(a) transceivers
(b)

Thick Coax: Stiff, hard to work with

T connectors flaky

210
Fast Ethernet
100baseT4 100baseT 100baseFX
Twisted pair category 3 Twisted pair category 5 Optical fiber multimode
Medium
UTPTable IEEE 802.3 100 Mbps Ethernet medium alternatives
4 pairs UTP two pairs Two strands
Max. Segment
100 m 100 m 2 km
Length
Topology Star Star Star

To preserve compatibility with 10 Mbps Ethernet:


• Same frame format, same interfaces, same protocols
• Hub topology only with twisted pair & fiber
• Bus topology & coaxial cable abandoned

211
Gigabit Ethernet
1000baseSX 1000baseLX 1000baseCX 1000baseT
Optical fiber Optical fiber Twisted pair
Shielded category 5
Medium multimode single mode
copper cable
Two strands
Table Twomedium
6.3 IEEE 802.3 1 Gbps Fast Ethernet strands
alternatives UTP
Max. Segment
550 m 5 km 25 m 100 m
Length
Topology Star Star Star Star

• Minimum frame length increased to 512 bytes


• Small frames need to be extended to 512 B
• Frame bursting to allow stations to transmit burst of short frames
• Frame structure preserved but CSMA-CD essentially abandoned

212
10 Gigabit Ethernet
10GbaseSR 10GBaseLR 10GbaseEW 10GbaseLX4
Two optical Two optical fibers Two optical fibers Two optical fibers
fibers Single-mode at Single-mode at multimode/single-
Multimode at Table 6.51310 nm
IEEE 802.3 1550 nm
10 Gbps Ethernet medium alternatives mode with four
Medium
850 nm 64B66B SONET wavelengths at 1310
64B66B code compatibility nm band
8B10B code
Max.
Segment 300 m 10 km 40 km 300 m – 10 km
Length

• Frame structure preserved


• CSMA-CD protocol officially abandoned
• LAN PHY for local network applications
• WAN PHY for wide area interconnection using SONET OC-192c

213
Typical Ethernet Deployment
Server farm

Server Server Server

Gigabit Ethernet links


Switch/router Switch/router
Gigabit Ethernet links

Ethernet
Ethernet Ethernet Server
Server switch
switch Server switch

100 Mbps links


100 Mbps links 100 Mbps links

Hub
Hub Hub

10 Mbps links
10 Mbps links 10 Mbps links

Department B Department C
Department A

214
IEEE 802.11

• WIFI
Wi-Fi - 802.11

• Wi-Fi stands for Wireless Fidelity, and it is developed by an


organization called IEEE (Institute of Electrical and
Electronics Engineers) they set standards for the Wi-Fi
system.
• Each Wi-Fi network standard has two parameters :
• Speed –
This is the data transfer rate of the network measured in Mbps (1
megabit per second).
• Frequency –
On what radio frequency, the network is carried on. Two bands of
frequency for the Wi-Fi are 2.4 GHz and 5 GHz. In short, it is the
frequency of radio wave that carries data.
Two Frequencies of Wi-Fi signal :

• Wi-Fi routers that come with 2.4 GHz and 5 GHz


• Single Band Routers ( 2.4 or 5)
• Dual Band Routers ( 2.4 and 5 Both)
• 2.4 GHz band
• Shared with other appliances like Bluetooth ,
cameras etc.
• Slower data transmission
• 5 GHz Band
• Less crowded
• Faster data transmission
Different standards of Wi-Fi :

• These are the Wi-Fi standards that evolved from


1997 to 2021.
• In 1997 IEEE created one standard and gave the
name 802.11
• 802.11
• 802.11a
• 802.11b
• 802.11g
• 802.11n
IEEE 802.11 Physical Layer Options

Frequency Bit Rate Modulation Scheme


Band
802.11 2.4 GHz 1-2 Mbps Frequency-Hopping Spread Spectrum, Direct
Sequence Spread Spectrum
802.11a 5 GHz 54 Mbps Orthogonal Frequency Division Multiplexing
802.11b 2.4 GHz 11 Mbps Complementary Code Keying & QPSK
802.11g 2.4 GHz 54 Mbps Orthogonal Frequency Division Multiplexing
& CCK for backward compatibility with 802.11b
802.11n 2.4 and 5 600 Mbps MIMO (Multiple-Input and Multiple-Output) support
GHz MIMO-OFDM (Orthogonal Frequency Division
Multiplexing)

219
IEEE 802.11 Mac Frame

• MAC layer functionality


• control medium access,
• support for roaming
• authentication,
• power conservation
• IEEE 802.11 defines two MAC sub-layers
• Distributed Coordination Function (DCF)
• Point Coordination Function (PCF)
• Current 802.11 standards specify frame types for
• use in the transmission
• management
• control of wireless links.
IEEE 802.11 MAC Frame
Upper layer data
 2048 byte max
 256 upper layer
header
Frame Subtypes

CONTROL DATA MANAGEMENT


• RTS  Data  Beacon
•  Data+CF-ACK  Probe Request & Response
CTS
 Data+CF-Poll  Authentication
• ACK  Data+CF-ACK+CF-Poll  Deauthentication
• PS-Poll
 Null Function  Association Request & Response
 
• CF-End & CF-End ACK 
CF-ACK (nodata)

Reassociation Request & Response
CF-Poll (nodata) Disassociation
 CF-ACK+CF+Poll  Announcement Traffic Indication Message
(ATIM)
IEEE 802.15

• Wireless Personal Area Network (WPAN)


WPAN : Wireless Personal Area Network

• 802.11 Typically focuses on PC-PC or PC-ISP


• 802.11 not suitable for Connecting peripherals to a
mobile device or adding components to a home
theater system.
• WPAN : Wireless Personal Area Network
• Interconnected devices are centered around a
person’s workspace and connected through
wireless medium.
• Typically the range is within about 10 meters
• Some more examples of WPAN includes Wireless
mouse, Wearable devices
WPAN Classes and Applications

1. As per IEEE, WPAN is classified into 3 classes i.e


• High-rate WPAN (HR-WPAN)
• Medium-rate WPAN (MR-WPAN)
• Low-rate WPAN (LR-WPAN)
2. Applications of WPAN
• Short range connectivity for multimedia
applications
• Hands free devices connection
• Industrial sensor applications
Technologies used in WPAN

• Bluetooth ( IEEE 802.15.1 )


• ZigBee ( IEEE 802.15.4 )
• UWB (IEEE 802.15.3 )
Comparison
IEEE 802.16

• WiMax
IEEE 802.16

• The IEEE 802.16 set of standards lays down the


specifications for wireless broadband technology.
• It has been commercialized as Worldwide
Interoperability for Microwave Access (WiMAX) that
is responsible for the delivery of last-mile wireless
broadband access.
• The IEEE 802.16 MAC sublayer is the most
important sublayer and concerned with channel
management.
• It has been designed for connection-oriented
channel management for point-to-multipoint (PMP)
broadband services.
802.16 Standards Development

• Use wireless links with microwave or millimeter wave radios


• 10-66 GHz
• 802.16a extension to 2-11 GHz
• Use licensed spectrum (unlicensed too in 802.16a)
• Metropolitan in scale
• Provide public network service to fee-paying customers
• Point-to-multipoint architecture with rooftop or tower-
mounted antennas
• Provide efficient transport of heterogeneous traffic
supporting QoS
• Capable of broadband transmissions (2-75 Mbps)
• Accommodate both continuous and busty traffic
IEEE 802.16 MAC sublayer

• The IEEE 802.16 MAC sublayer is a part of the data


link layer.
• The DDL of WiMAX is divided into three sublayers

• Service-specific convergence sublayer

• MAC common sublayer

• Security sublayer
IEEE 802.16 Services

• Digital audio/video multicast


• Digital telephony
• ATM
• Internet protocol
• Bridged LAN
• Back-haul
• Frame relay
IEEE 802.16.1 Frame Format

• Header - protocol control information


• Downlink header – used by the base station
• Uplink header – used by the subscriber to convey
bandwidth management needs to base station
• Bandwidth request header – used by subscriber to
request additional bandwidth
• Payload – either higher-level data or a MAC control
message
• CRC – error-detecting code
Frame Format of Classic Ethernet and IEEE
802.3

Unit2 - Data Link Layer 235

You might also like