Unit-5 Datalink Layer
Unit-5 Datalink Layer
Unit-5 Datalink Layer
• In the OSI model, the data link layer is a 4th layer from the top and 2nd layer from the
bottom.
• The communication channel that connects the adjacent nodes is known as links, and
in order to move the datagram from source to the destination, the datagram must be
moved across an individual link.
• The main responsibility of the Data Link Layer is to transfer the datagram across an
individual link.
• The Data link layer protocol defines the format of the packet exchanged across the
nodes as well as the actions such as Error detection, retransmission, flow control,
and random access.
• The Data Link Layer protocols are Ethernet, token ring, FDDI and PPP.
• Framing & Link access: Data Link Layer protocols encapsulate each network frame
within a Link layer frame before the transmission across the link. A frame consists of
a data field in which network layer datagram is inserted and a number of data fields.
It specifies the structure of the frame as well as a channel access protocol by which
frame is to be transmitted over the link.
• Flow control: A receiving node can receive the frames at a faster rate than it can
process the frame. Without flow control, the receiver's buffer can overflow, and
frames can get lost. To overcome this problem, the data link layer uses the flow
control to prevent the sending node on one side of the link from overwhelming the
receiving node on another side of the link.
• Half-Duplex & Full-Duplex: In a Full-Duplex mode, both the nodes can transmit
the data at the same time. In a Half-Duplex mode, only one node can transmit the
data at the same time.
Issues of Data Link Layer:
The main functions and the design issues of this layer are
• Feedback based Flow Control - In these protocols, the sender sends frames after it has
received acknowledgments from the user. This is used in the data link layer.
• Rate based Flow Control - These protocols have built in mechanisms to restrict the rate of
transmission of data without requiring acknowledgment from the receiver. This is used in the
network layer and the transport layer.
• Once the receiver receives the frame, it sends an acknowledgment frame back to the sender.
• On receiving the acknowledgment frame, the sender understands that the receiver is ready
to accept the next frame. So it sender the next frame in queue.
Sliding Window
This protocol improves the efficiency of stop and wait protocol by allowing multiple
frames to be transmitted before receiving an acknowledgment.
• Both the sender and the receiver has finite sized buffers called windows. The sender and the
receiver agrees upon the number of frames to be sent based upon the buffer size.
• The sender sends multiple frames in a sequence, without waiting for acknowledgment. When
its sending window is filled, it waits for acknowledgment. On receiving acknowledgment, it
advances the window and transmits the next frames, according to the number of
acknowledgments received.
In case of lost or corrupted frames, the receiver does not receive the correct data-frame
and sender is ignorant about the loss. Data link layer follows a technique to detect
transit errors and take necessary actions, which is retransmission of frames whenever
error is detected or frame is lost. The process is called Automatic Repeat Request
(ARQ).
Phases in Error Control
The error control mechanism in data link layer involves the following phases:
• Detection of Error − Transmission error, if any, is detected by either the sender or the
receiver.
• A timeout counter is maintained by the sender, which is started when a frame is sent.
• If the sender receives acknowledgment of the sent frame within time, the sender is
confirmed about successful delivery of the frame. It then transmits the next frame in
queue.
• If the sender does not receive the acknowledgment within time, the sender assumes
that either the frame or its acknowledgment is lost in transit. It then retransmits the
frame.
• If the sender receives a negative acknowledgment, the sender retransmits the frame.
• Go-Back-N ARQ
• The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.
• The receiver receives frames one by one. It keeps track of incoming frame’s
sequence number and sends the corresponding acknowledgment frames.
• After the sender has sent all the frames in window, it checks up to what sequence
number it has received positive acknowledgment.
• If the sender has received positive acknowledgment for all the frames, it sends next
set of frames.
• If sender receives NACK or has not receive any ACK for a particular frame, it
retransmits all the frames after which it does not receive any positive ACK.
• Both the sender and the receiver have buffers called sending window and receiving
window respectively.
• The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.
• The receiver also receives multiple frames within the receiving window size.
• The receiver keeps track of incoming frame’s sequence numbers, buffers the frames
in memory.
• It sends ACK for all successfully received frames and sends NACK for only frames
which are missing or damaged.
• The sender in this case, sends only packet for which NACK is received.
• Normal Response Mode (NRM) − Here, two types of stations are there, a primary station
that send commands and secondary station that can respond to received commands. It is
used for both point - to - point and multipoint communications.
• Asynchronous Balanced Mode (ABM) − Here, the configuration is balanced, i.e. each
station can both send commands and respond to commands. It is used for only point - to -
point communications.
HDLC Frame
HDLC is a bit - oriented protocol where each frame contains up to six fields. The
structure varies according to the type of frame. The fields of a HDLC frame are −
• Flag − It is an 8-bit sequence that marks the beginning and the end of the frame. The bit
pattern of the flag is 01111110.
• Address − It contains the address of the receiver. If the frame is sent by the primary station,
it contains the address(es) of the secondary station(s). If it is sent by the secondary station, it
contains the address of the primary station. The address field may be from 1 byte to several
bytes.
• Payload − This carries the data from the network layer. Its length may vary from one
network to another.
• FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code
used is CRC (cyclic redundancy code)
• I-frame − I-frames or Information frames carry user data from the network layer. They also
include flow and error control information that is piggybacked on user data. The first bit of
control field of I-frame is 0.
• S-frame − S-frames or Supervisory frames do not contain information field. They are used
for flow and error control when piggybacking is not required. The first two bits of control field
of S-frame is 10.
• U-frame − U-frames or Un-numbered frames are used for myriad miscellaneous functions,
like link management. It may contain an information field, if required. The first two bits of
control field of U-frame is 11.
• Defining the procedure of establishing link between two points and exchange of data.
Components of PPP
Point - to - Point Protocol is a layered protocol having three components −
• Network Control Protocols (NCPs) − These protocols are used for negotiating the
parameters and facilities for the network layer. For every higher-layer protocol supported by
PPP, one NCP is there. Some of the NCPs of PPP are:
PPP Frame
PPP is a byte - oriented protocol where each field of the frame is composed of one or
more bytes. The fields of a PPP frame are −
• Flag − 1 byte that marks the beginning and the end of the frame. The bit pattern of the flag
is 01111110.
• Protocol − 1 or 2 bytes that define the type of data contained in the payload field.
• Payload − This carries the data from the network layer. The maximum length of the payload
field is 1500 bytes. However, this may be negotiated between the endpoints of
communication.
• FCS − It is a 2 byte or 4 bytes frame check sequence for error detection. The standard code
used is CRC (cyclic redundancy code)
Byte Stuffing in PPP Frame − Byte stuffing is used is PPP payload field whenever the
flag sequence appears in the message, so that the receiver does not consider it as the
end of the frame. The escape byte, 01111101, is stuffed before every byte that contains
the same byte as the flag byte or the escape byte. The receiver on receiving the
message removes the escape byte before passing it onto the network layer.
Data transmission with SLIP is very simple: this protocol sends a frame composed only of data
to be sent followed by an end of transmission character (i.e. the END character, the ASCII
code 192). A SLIP frame looks like this: