DLL Sept22 23
DLL Sept22 23
The data link layer takes the data bits and “frames,” and creates packets of the data to
guarantee reliable transmission. This layer adds source and destination addresses to the
data stream as well as information to detect and control transmission errors. The data link
layer has two sublayers. One is the Logical Link Control (LLC) sublayer, which essentially
maintains the communications link between two devices on the network. The other is the
Media Access Control (MAC) sublayer which manages the transmission of data between
two devices. The [Network Interface Controller/Card (NIC), Network Adapter, LAN
Adapter or Physical Network Interface] network card on a PC has a MAC address, essentially a
unique address for every device on a local area network.
The details of the data link layer can be specified differently and are reflected in various
network types (Ethernet, token ring, etc.). Each network type has its own method of addressing, error
detection, control of network flow, and so forth.
[computernetworkingsimplified]
The data link layer functionality is usually split it into logical sub-layers, the upper sub-
layer, termed as LLC, that interacts with the network layer above and the lower sub-layer, termed
as MAC, that interacts with the physical layer below.
[com……simplified]
3.1. DATA LINK LAYER DESIGN ISSUES
The data link layer uses the services of the physical layer below it to send and receive bits
over (possibly unreliable) communication channels that may lose data. It has a number of
functions, including:
To accomplish these goals, the data link layer takes the packets it gets from the net- work
layer and encapsulates them into frames for transmission. Each frame contains a frame header, a
payload field for holding the packet, and a frame trailer. Frame management forms the heart of
what the data link layer does.
(Basic Transmission and Receipt)
When the data link layer accepts a packet from the network layer at the sender, it
encapsulates the packet in a frame by adding a data link header and trailer to it. Thus, a frame
consists of an embedded packet, some control information (in the header), and a
checksum (in the trailer). The frame is then transmitted to the data link layer on the other
1
2
machine. Assuming that there exist suitable library procedures to physical layer to send a frame and
from physical layer to receive a frame. These procedures compute and append or check the
checksum. (which is usually done in hardware.)
A frame has four fields: kind, seq, ack, and info, the first three of which contain
control information and the last of which may contain actual data to be transferred. These control
fields are collectively called the frame header
The kind field tells whether there are any data in the frame, because some of the protocols
distinguish frames containing only control information from those containing data as well. The seq
and ack fields are used for sequence numbers and acknowledgements, respectively. The info
field of a data frame contains a single packet; the info field of a control frame is not used.
The important function of the data link layer is to provide services to the network layer.
The principal service of the link layer is transferring data from the network layer on the source
machine to the network layer on the destination machine. On the source machine is an entity, call it
a process, in the network layer that passes packets to the data link layer for transmission to the
destination. The job of the data link layer is to transmit the data to the destination machine so they
can be handed over to the network layer.
The data link layer can be designed to offer various services. The actual services that are
offered vary from protocol to protocol. Three reasonable possibilities that we will consider in turn
are:
1. Unacknowledged connectionless service. (Ethernet)
2. Acknowledged connectionless service. (WiFi)
3. Acknowledged connection-oriented service.
1. Unacknowledged connectionless service consists of having the source machine send
independent frames to the destination machine without having the destination machine
acknowledge them and without connection established among source and destination machine.
LAN,Ethernet is a good example of a data link layer that provides this class of service. No
logical connection is established beforehand or released afterward. If a frame
2
3
is lost due to noise on the line, no attempt is made to detect the loss or
recover from it in the data link layer. This class of service is appropriate(real – time
traffic such as voice or video ) when the error rate is very low, so recovery is left to higher
layers. It is also appropriate for real-time traffic, such as voice or video, in which late data are worse
than bad data.
The next step up in terms of reliability is 2.acknowledged connectionless service. When this
service is offered, there are still no logical connections used, but each frame sent is
individually acknowledged. In this way, the sender knows whether a frame has arrived correctly
or been lost. If it has not arrived within a specified time interval, it can be sent again. This
service is useful over unreliable channels, such as wireless systems. 802.11 (WiFi) is a good example
of this type of link layer service.
Getting back to our services, the most sophisticated service the data link layer can provide to
the network layer is 3.connection-oriented service(Acknowledged). With this service,
the source and destination machines establish a connection before any data are transferred.
When connection-oriented service is used, transfers go through three distinct
phases. In the first phase, the connection is established by having both sides initialize variables
and counters needed to keep track of which frames have been received and which ones have not.
In the second phase, one or more frames are actually transmitted. In the third and final phase,
the connection is released, freeing up the variables, buffers, and other resources used to maintain
the connection.
Each frame sent over the connection is numbered, and the a.) data link layer guarantees
that each frame sent is indeed received. Furthermore, b.) it guarantees that each frame is received
exactly once and that all frames are received in the right order. Connection-oriented service thus
provides the network layer processes with the equivalent of a reliable bit stream. It is appropriate
over long, unreliable links such as a satellite channel or a long-distance telephone circuit. If
acknowledged connectionless service were used, it is conceivable that lost acknowledgements
could cause a frame to be sent and received several times, wasting band- width.
2. Framing: The packet received from the Network layer is known as a frame in the Data link
layer. At the sender’s side, DLL receives packets from the Network layer and divides them into
small frames, then, sends each frame bit-by-bit to the physical layer. It also attaches some
special bits (for error control and addressing) at the header and end of the frame. At the
receiver’s end, DLL takes bits from the Physical layer organizes them into the frame, and sends
them to the Network layer.
Breaking up the bit stream into frames is more difficult than it at first appears. A good design
must make it easy for a receiver to find the start of new frames while using little of the channel
bandwidth. We will look at four methods:
1. Byte count. 2. Flag bytes with byte stuffing.
3. Flag bits with bit stuffing. 4. Physical layer coding violations
To provide service to the network layer, the data link layer must use the service provided to it by
the physical layer. The physical layer accepts a raw bit stream and attempts to deliver it to the
destination. If the channel is noisy, as it is for most wireless and some wired links, the physical layer
will add some redundancy to its signals to reduce the bit error rate to a tolerable level. However, the
bit stream received by the data link layer is not guaranteed to be error-free. Some bits may have
3
4
different values, and the number of bits received may be less than, equal to, or more than the number
of bits transmitted. It is up to the data link layer to detect and, if necessary, correct errors.
The usual approach is for the data link layer to break up the bit stream into discrete frames,
compute a short token called a checksum for each frame, and include the checksum in the frame
when it is transmitted. (Checksum algorithms will be discussed later in this chapter.) When a frame
arrives at the destination, the receiver recomputes the checksum based on the received frame. If the
newly computed checksum is different from the one contained in the frame, the data link layer
knows that an error has occurred and takes steps to deal with it (e.g., discarding the bad frame and
possibly also sending back an error report).
3. Error Control: Data can get corrupted due to various reasons like noise, attenuation, etc. So,
it is the responsibility of the data link layer, to detect the error in the transmitted data and
correct it using error detection and correction techniques respectively. DLL adds error
detection bits into the frame’s header, so that receiver can check received data is correct or
not.
4. Flow Control: If the receiver’s receiving speed is lower than the sender’s sending speed,
then this can lead to an overflow in the receiver’s buffer and some frames may get lost. So, it’s
the responsibility of DLL to synchronize the sender’s and receiver’s speeds and establish flow
control between them.
5. Addressing: The data link layer encapsulates the source and destination’s MAC address/
physical address in the header of each frame to ensure node-to-node delivery. MAC address
is the unique hardware address that is assigned to the device while manufacturing.
6. Access Control: When multiple devices share the same communication channel there is a
high probability of collision, so it’s the responsibility of DLL to check which device has
control over the channel and CSMA/CD and CSMA/CA can be used to avoid collisions and
loss of frames in the channel.
7.
8. Djklsf’
9.
Protocols in Data link layer
There are various protocols in the data link layer, which are as follows:
• Synchronous Data Link Protocol (SDLC)
• High-Level Data Link Protocol (HDLC)
• Serial Line Interface Protocol (SLIP)
• Point to Point Protocol (PPP)
• Link Access Procedure (LAP)
• Link Control Protocol (LCP)
• Network Control Protocol (NCP)
3.2.
3.3.
3.4.
3.5.
3.6. Multiple Access: Random Access(ALOHA, CSMA, CSMA/CD, CSMA/CA), Controlled Access
(Reservation, Polling, Token Passing), Channelization (CDMA, FDMA, TDMA)
4
5