Understanding the Data Link Layer
Understanding the Data Link Layer
Field: SMI - S5
Pr. K. HOUSNI
Faculty of Sciences
Ibn Tofail University
Page 1
Chapter III
Definition
Definition:
The data link layer provides functional means and
necessary procedures for establishment, maintenance, and release
data link connections between network entities.
She supervises the operation of the transmission and defines the structure.
syntax of called messagesframes.
Page 4
Role of the data link layer
The frame carries the user's data but it also contains some
control information (the header) that is necessary for the protocol for the
smooth running of the dialogue.
Defining a data link protocol involves specifying:
the format of the frames,
the criterion for the start and end of frames,
the error detection technique used,
the place and meaning of the different fields in a frame,
the rules of dialogue: the procedures after error detection or
failure and the supervision of the link.
Page 5
The delimitation of data: concept of
pennant
During data transmission, it is necessary to identify the beginning and end of the data sequence.
transmit
start bit and stop bit in asynchronous transmission
In synchronous transmission, a flag is used, which is a particular sequence of bits.
Frames are blocks composed of any number of bits and we speak of a bit-oriented protocol.
A flag is used to delimit the frames.
The sequence of binary elements01111110is used as a flag in the case of HDLC protocol.
A transparency mechanism is necessary to prevent the occurrence of the flag sequence inside.
of the frame stuffing bit technique.
It consists, in broadcasting, of inserting a binary element with a value of 0 into the body of the frame after having
I encountered 5 consecutive binary elements with a value of 1.
In reception, if we encounter 5 consecutive binary elements with a value of 1, the automaton looks at the next bit.
:
if it is '1', it is the flag
If it is at '0', the '0' is removed from the sequence (it was introduced into the show)
Page 6
The delimitation of data: notion of
transparency
With such a mechanism, the emission of more than 5 binary elements of value 1 is therefore prohibited except for
for the delimitation of frames (The flags).
This method has the advantage of allowing the transmission of variable-length frames, without
limitation, but it introduces variations in the duration of user data transmission
Page 7
Control of the validity of the information
Notion of error
Page 8
The bit error rate
On a finite transmission line, noise can interfere with the signal and be a source of errors.
of transmission.
BER = Bit Error Rate
TEB = Nb bits erronés / Nb bits transmis
Example
The transmitter sends the sequence 0001110101101010
The receiver receives the sequence 0001100101111011
TEB = 3/16 = 0,1875
In practice
Local networks: TEB=10-9
TE generally represents the probability of receiving an erroneous bit.
The probability of correctly receiving a block of N bits is then:
p = (1-TEB)…(1-TEB) = (1-TEB)N
The probability of receiving an erroneous block is then:
p = 1 - (1 - TEB)N
The longer a block is, the lower the probability of correct reception!
Page 9
Error detection
Page 10
Error detection
detection by repetition
Each message sent is followed by its own reply
If the two messages are different, the receiver requests a retransmission.
Page 11
Key-based detection
ASCII characters (7 bits) are protected by the introduction of an 8emebit: the parity bit.
This technique, known as VRC (Vertical Redundancy Check), check
Vertical redundancy only allows for the detection of errors involving an odd number.
of bits.
Page 13
The detection by calculated key
A LRC character is added to the transmitted block. Each bit of the LRC character corresponds to the parity of the
bits of each character of the same rank: the first bit of the LRC is the parity of all the 1st bits of each
character, the second of all the 2nd bits...
The character thus formed is added to the message. The LRC itself is protected by a parity bit.
(VRC).
Page 14
Cross parity: efficiency
Page 15
Detection by calculated key
Cyclic redundancy codes
CRC: Cyclic Redundancy Check
They are also called polynomial codes
based on the treatment of bit sequences as a representation
polynomial with coefficients 0 and 1.
Principle:
we consider a sequence of bits for example: 110111
To this sequence, we associate the following polynomial:
(1.x5+(1.x4+(0.x3+(1.x2) + (1.x1+1 x5+x4+x2+x+1
Remark:Calculations are done in binary (modulo 2: 1+1=0; X+X=0; X=-X)
[for example, (x7+x3)+ (x3+x) = x7+ x ]
Step 1:
A polynomial known to both the transmitter and the receiver is called a polynomial.
generator, let r be its degree:
G(x) = xr+ …. +1; the terms of the two extremes must not be
nuls (xr, x0)
Standardized codes
x16+x12+x5+1 X25 Networks
Page 16
Key-based detection
Step 2:
let M be the message to be transmitted (of m bits) whose corresponding polynomial is (M(x)) of degree m-1.
We add r bits (called control bits, CRC (or FCS: Frame Check Sequence) to the message M
send a frame P of n bits
(n=m+r) where the corresponding polynomial P(x) of degree n-1 is divisible by G(x)
P(x) is calculated using the following method:
on multiple M(x) by xrwe have the polynomial xr.m(x) This is equivalent to a shift of M(X), by r positions to the
left
we divide xr.M(x) by G(x), namely:
xrM(x) = Q(x)g(x) + C(x)
C(x) is the remainder of this division. By definition, its degree is r-1.
We send the word P (of n=m+r bits) composed of m bits of the message M followed by the r bits of FCS whose
the corresponding polynomial is C(x).
Frame emitted
Page 17
Keyed detection
In reception:
The receiver performs the division of the received word by G(x). If the result is zero, he concludes that it
There is no mistake.
Problem
Errors that produce a multiple polynomial of G(x) are not detected.
CRC example:
Generator polynomial: x2+x+1Message :110111
Page 18
Error detection and correction
by code
Hamming code
Hamming Code
The Hamming code is calculated from a measure of dissimilarity between two sequences.
of bits of the same length, called Hamming distance.
Page 19
Error detection and correction
by code
Hamming code
Structure of a Hamming code
the bits of the message to transmit and the parity control bits.
total length: 2n– 1
length of messages: m = (2n- 1) – n
we talk about code x - y where x = n + m and y = m.
Code efficiency: report y/x
Page 20
Error detection and correction
by code
Hamming method:
Each data bit is controlled by the control bits that are taken into account in
its decomposition into a sum of powers of 2.
Page 21
Error detection and correction
by code
Example
1 2 3 4 5 6 7
x y AzB C D
x=a+b+d
y=a+c+d
z=b+c+d
Page 22
Error detection and correction
by code
Find the error in a Hamming word
If the reception control bits C2'C1’C0' valiant 0, there is no error otherwise the
The value of the control bits indicates the position of the error between 1 and 7.
Cibinary sum of the bits used for the calculation of Ci+ Cireceived.
Exercise: is there an error in the following word? 1 0 1 0 1 1 0
indice : 7 6 5 4 3 2 1
Correction
C2' is equal to 1 + 0 + 1 + 0 = 0 (bits at index 7, 6, 5, and 4).
C2’C1'C0' ' is worth 011, which means 3 in base 10. Therefore, there is an error in
the index 3 of the word
Page 23
Exercise
Page 24
Exchange control: mechanisms
of base
Loss of M1
Page 25
Exchange control: mechanisms
base
Problem: if the ACK is lost, the data is retransmitted even though it has
already received; the message is then duplicated at the receiver
Page 26
Exchange control: mechanisms
basic
The numbering of messages prevents duplication and allows for sequencing control.
data received
Page 27
Exchange control: mechanisms
of base
Problem:
Loss of acquittal
Page 28
Exchange control: mechanisms
basic
Is Ns > Nr possible?
Is it possible to send Mi+1 while Mi is not acknowledged?
The messages do not arrive in the correct order at the receiver.
we either reject messages such as Ns > Nr
either we store the unordered messages on the receiver
Page 29
Anticipatory protocols
In Send & Wait mode, performance is degraded due to waiting for the ACK before sending a
new message.
Solution: Protocol with anticipation
The transmitter can make several successive transmissions without waiting for the ACK of the previous messages.
All unacknowledged messages on the sender must be stored in 'buffers'.
When an ACK arrives, the sender can release the buffer corresponding to the acknowledged message(s).
If there is no free buffer, the sender must wait for the arrival of an ACK to continue transmitting.
Principle:
Page 30
The protocols for anticipation
Each block is acknowledged. Upon receiving an ACK, the sender releases a buffer and emits
the following block.
Jumping window management
The acquittal is deferred and concerns several messages.
if W=3, M0, M1 and M2 are settled in a single payment
emissions stop when the emission credits are exhausted
Page 31
Anticipatory protocols
Page 32
The protocols for anticipation
Simple rejection
All blocks received out of sequence are rejected.
the protocol is called 'Go Back N'
the transmitter resumes transmission from the
lost message
minimized receiver memory, Wreception = 1
Page 33
Anticipatory protocols
Page 34
Flow control
The number of buffers (memory buffers) on the receiver is limited, the transmitter must not
emit more data than the receiver can accept, otherwise the packets will be
lost.
It is calledissue credit (Ct)the number of blocks that the transmitter is allowed to transmit
There are two types of flow control:
Implicit flow control
. the number of credits is set once and for all;
. when the sender has exhausted their credits, they wait for the recipient's authorization to
resume the show.
Explicit or dynamic flow control
. the receiver continuously informs the transmitter about its receiving capabilities;
. the receiver's message contains the new number of available credits.
Page 35
Flow control
Page 36
Modes of communication
Page 38
The HDLC protocol
Page 39
The HDLC protocol
Frame format
Fanion=01111110
The address field spans an octet and identifies one of the ends of the
[Link] designed for multipoint lines. It can support up to 256
terminals by line.
The command field describes the type of the frame: it spans 1 byte but can
to be extended to 2 bytes in the mode called extended mode.
The information field is an optional field containing any number.
binary elements representing user data.
The FCS (Frame Check Sequence) field is a frame check sequence.
(it is obtained by a polynomial control of the generator polynomial
x16 + x12+ x5+ 1).
The left field is the first transmitted, the right field is the last.
Page 41
Structure of an HDLC frame
Page 42
Structure of an HDLC frame
Types of frames:
There are three types of frames identified by the Command field.
The information frame or frame I: allows the transmission of user data.
Supervision frames or S frames: allow acknowledgment and flow control.
They do not carry data.
Unnumbered frames or U frames: are used for all the
control functions of the link such as initialization, release... They do not
do not transport data.
The field Command:
Page 43
The command field
Page 44
The command field
I(0,0)
I(1,0)
I(0,2)
I(1,2)
I(2,2)
I(3,2)
I(4,2)
I(2,5)
Page 45
The command field
Page 46
The command field
the RR (Receiver Ready) frame the REJ (Reject) frame
I(0,0) I(0,0)
I(1,0) I(1,0)
I(2,0)
S(RR,2)
I(3,0)
I(2,0)
I(4,0)
I(3,0)
S(REJ,1)
S(RR,4) I(1,0)
I(4,0) I(2,0)
I(5,0) I(3,0)
the RNR (Receiver Not Ready) frame The SREJ (Selective Reject) frame
I(0,0) I(0,0)
I(1,0)
I(1,0)
I(2,0)
I(2,0)
S(RNR,2)
I(3,0)
S(RR,2) I(4,0)
I(2,0)
I(3,0) S(SREJ,2)
I(2,0)
I(4,0)
I(5,0)
S(RR,5)
Page 47
The command field
Page 48
The command field
P=0
Page 49
HDLC frame
Page 50
Structure of an HDLC dialogue
DISC: DISConnect
Unnumbered Acknowledgement
Page 51
Structure of an HDLC dialogue
Page 52
Structure of an HDLC dialogue
Page 53
Example of data exchange
Chronogram of a transmission
Page 54
Example of data exchange
Chronogram of a transmission
Page 55
Example of data exchange
Page 56
Example of data exchange
Page 57