DATA LINK LAYER
DATA LINK LAYER
• The data link layer is Layer 2 in the Open Systems Interconnection
(OSI) architecture model for a set of telecommunication protocols.
• Data bits are encoded, decoded and organized in the data link layer,
before they are transported as frames between two adjacent nodes on
the same LAN or WAN.
• The data link layer also determines how devices recover from collisions
that may occur when nodes attempt to send frames at the same time.
• The data link layer has two sublayers: the logical link control (LLC)
sublayer and the media access control (MAC) sublayer.
Framing in Data Link Layer
Data-link layer takes the packets from the Network Layer
and encapsulates them into frames. If the frame size
becomes too large, then the packet may be divided into
small sized frames. Smaller sized frames makes flow
control and error control more efficient. Then, it sends
each frame bit-by-bit on the hardware.
Parts of a Frame
A frame has the following parts −
Frame Header − It contains the source and the destination
addresses of the frame.
Payload field − It contains the message to be delivered.
Trailer − It contains the error detection and error correction
bits.
Flag − It marks the beginning and end of the frame.
Cyclic Redundancy Check (CRC)
CRC is a redundancy error technique used to determine the
error.
Following are the steps used in CRC for error detection:
In CRC technique, a string of n 0s is appended to the data
unit, and this n number is less than the number of bits in a
predetermined number, known as division which is n+1 bits.
Secondly, the newly extended data is divided by a divisor
using a process is known as binary division. The remainder
generated from this division is known as CRC remainder.
Thirdly, the CRC remainder replaces the appended 0s at the
end of the original data. This newly generated unit is sent to
the receiver.
The receiver receives the data followed by the CRC
remainder. The receiver will treat this whole unit as a single
unit, and it is divided by the same divisor that was used to
find the CRC remainder.
If the resultant of this division is zero which means that it has
no error, and the data is accepted.
Let's understand this concept through an example:
Suppose the original data is 11100 and divisor is 1001.
CRC Generator
A CRC generator uses a modulo-2 division. Firstly, three zeroes
are appended at the end of the data as the length of the
divisor is 4 and we know that the length of the string 0s to be
appended is always one less than the length of the divisor.
Now, the string becomes 11100000, and the resultant string is
divided by the divisor 1001.
The remainder generated from the binary division is known as
CRC remainder. The generated value of the CRC remainder is
111.
CRC remainder replaces the appended string of 0s at the end
of the data unit, and the final string would be 11100111 which
is sent across the network.
CRC Checker
The functionality of the CRC checker is
similar to the CRC generator.
When the string 11100111 is received at
the receiving end, then CRC checker
performs the modulo-2 division.
A string is divided by the same divisor, i.e.,
1001.
In this case, CRC checker generates the
remainder of zero. Therefore, the data is
accepted.