Title: The Data Link Layer
1The Data Link Layer
Application
Presentation
Session
Transport
Network
Data Link
Physical
2Data Link Layer Design Issues
- Services Provided to the Network Layer
- Framing
- Error Control
- Flow Control
Frame
Sending machine
Receiving machine
Packet
Packet
Header Payload field Trailer
Header Payload field Trailer
3Placement of the data link protocol
Router
Router
Data link layer process
Routing process
Data link protocol
3
3
2
2
2
2
Packets
Frames
4Framing
- Bit stream is broken into discrete frames
consists of bit - groups (fields) which have specific meaning
- Framing methods
-
5 1 2 3 4 5 1 2 3 4 7 1 2 3 4 5 6 5 1
2 3 4
Frame 1 5 characters
5- A frame delimited by flag bytes
FLAG Header Payload field
Trailer FLAG
01111110
This sequence should not appear in other
fields bit stuffing is needed
- Physical layer coding violations
1
0
SD start delimiter ED end delimiter
J
K
SD JK0JK000 ED JK1JK1xx
6Error Detection and Correction
- Two approaches to error control
- - include enough redundant information in each
frame to allow - the receiver correct errors (FEC Forward
Error Correction) - - include enough redundant information to allow
the receiver - to detect errors
- Simple parity error detection add a parity bit
00101101 0
even parity
odd parity
7Cyclic Redundancy Check (CRC)
- Based on polynomial codes
- The sender computes a checksum FCS from the data
bits and - appends it to the frame
- - the receiver performs the corresponding
computation and - compares the result to the received checksum
value
Bit string 1 1 0 0 0
1 Polynomial
x5 x4 x0
data
Receiver
Sender
data FCS
compute and append checksum
data FCS
compute checksum, compare
8- Sender and receiver agree upon a generator
polynomial G(x) - The checksum is computed for frame M(x) so that
the - checksummed frame is divisible by G(x)
- - the receiver divides the received frame with
G(x) if there - is a remainder, a there has been a
transmission error
Note - if r is the degree of G(x), r zero bits
must be appended to the low-order
end of the frame - use modulo-2 arithmetic
9An example
10Elementary Data Link Protocols
- An Unrestricted Simplex Protocol
- A Simplex Stop-and-Wait Protocol
- A Simplex Protocol for a Noisy Channel
11Simplex Stop-and-Wait Protocol
- Assumptions
- - one-directional transmission
- - error-free transmission
- - infinite buffer space and processing speed in
receiver
Sender
Receiver
packet n packet 2 packet 1
. . packet 1
Network Data Link Physical layer
- - fetch a packet
- copy into transmission
- buffer
- - transmit
- wait for
- acknowledgement
- - repeat
frames
- get a frame from buffer - pass the data to
network layer - send acknowledgement - repeat
acknowledgements
12Sliding Window Protocols
- In a two-way bidirectional (full-duplex)
connection - the acknowledgements can be sent along with the
data - (piggy-backing)
- Each frame has a sequence number
- The sender has a sending window set of sequence
numbers - of frames it is permitted to send
- - a new frame from network layer advances the
upper edge - of the window by 1
- - receiving an acknowledgement advances the
lower edge by 1 - The receiver has a receiving window set of
frames it is - permitted to receive
13A sliding window of size 1, with a 3-bit sequence
number. (a) Initially. (b) After the first frame
has been sent. (c) After the first frame has been
received. (d) After the first acknowledgement has
been received.
14- The roung-trip time can have important
implication on - the bandwidth utilization
round-trip time transmission time required for
the frame to arrive at the receiver
transmission time for the acknowledgement come
back
- Frame sent in 20 ms
- Frame at the receiver in 270 ms
- Acknowledgement back i 520 ms
- Sender is blocked 96 of time
- Pipelining use sending window 26
- in this case
R 500 ms
Frame length 20 ms
15- What if a frame in the middle of a long stream
is damaged - or lost?
- Go back n (receiver window size 1)
0
1
2
3
4
5
6
7
8
2
3
4
5
6
7
ACK0
ACK2
ACK1
ACK3
0
1
2
3
4
5
6
7
E D D D D D D
frames discarded by data link layer
- Selective repeat the receiver buffers the
received frames - and the sender retransmits the errored frame
16HDLC High Level data Link Control
- Characteristics
- Framing by delimiting flags (01111110)
- Bidirectional error-free transmission of frames
- Flow control
- Uses addresses in multi-point configuration
- Frame sequence numbering
- Retransmits a frame, if acknowledgement times out
1701111110 Address Control Data
Checksum 01111110
I Information frame S Supervisory frame U
Unnumbered frame
0 N(S) P/F N(R) 1 0 S P/F
N(R) 1 1 M P/F M
N(S) frame numbering, 3 bits (0-7) N(R) ack
numbering, sent back in reverse direction, 3
bits P/F Poll/Final bit usually command or
response
18Traffic examples
I N(S) N(R) P
Master station sending Slave station sending
Bit error
RR N(R) F
RR Receiver Ready
- Semi-duplex error-free transmission, master
sending I - frames
SNRM, P
I 0,0 I 1,0 I 2,0 P
I 3,0 I 4,0 I 5,0
Master
UA, F
RR3, F
Slave
19- Semi-duplex error-free transmission, both
sending I - frames
SNRM, P
I 0,0 I 1,0 P
I 2,2 P
Master
UA, F
I 2,3
I 0,2 I 1,2 F
Slave
- Unreliable semi-duplex connection
I 0,0 I 1,0 I 2,0 P
I 1,2 I 2,2 I 3,2
Master
I 0,1 I 1,1 F
Slave
20- Flow control in HDLC RR and RNR frames are used
RR Receiver Ready RNR Receiver Not Ready
- The slave station stops the master from sending
(congestion)
- bidirectional full-duplex transmission
I 0,0 P I 1,0 I 2,0 I 3,1
RR3
I 4,6 I 5,6
Master Slave
I 0,1 I 1,2 RNR3 I 2,3 I 3,4 I 4,4 I
5,4 RR4 I 6,4
21The Medium Access Control Sublayer
- Broadcast networks (LANs, radio networks) have
two - sublayers at the data link layer
- Logical Link Control LLC
- - provides a single interface to the network
layer (hides - different LAN implementations)
- Medium Access Control MAC
- - controls access to the medium (multiple
access)
Network
Data Link
Physical
22The Channel Allocation Problem
- Static or dynamic allocation
- General assumptions in dynamic allocation
- Station model N independent stations,
probability of - a frame being generated in an interval of
length ?t is - ? x ?t , where ? is the arrival rate of new
frames (constant) - A single channel
- Collision assumption
- Continuous or discrete time
- Carrier sense or no carrier sense
stations
shared channel
23ALOHA
- A multiple access protocol, born at the
University - of Hawaii in the 1970s
Pääte
IBM 360
OAHU
24Pure ALOHA
- Basic idea let users transmit data whenever
they have data - to be sent
- - there will be collisions and frames will be
destroyed - - by listening to the channel the sender gets
feedback - - if the frame was destroyed, the sender waits
a random - amount of time and sends it again
- Based on contention
t
vulnerable period
25Slotted ALOHA
- Time is divided into discrete intervals
- - the sender must wait for the beginning of the
next time slot - - the collision vulnerable period is halved
- The performance of ALOHA
26Carrier Sense Multiple Access / Collision
Detection
Start
Build a frame
Is the line free?
No
Send jam
Yes
Start transmission
No
Attempts left?
Yes
No
Collision ?
Count wait time
Wait
OK
Failure
27Reservation Protocols
- The channel is reserved before sending the frame
Packet Reservation Multiple Access PRMA
- A central station sends information on the
status of the channels
frame 1
A C D A B A F
frame 2
- free in next frame
- collisions, if multiple
- stations try to reserve
- at the same time
A C A B
frame 3
A B A F
frame 4
A B A F
D
frame 5
A C E E B A F D
28Multiple Access with Collision Avoidance
- Collision detection does not work always
- - wireless systems range is limited
A
B
C
29- RTS (Ready To Send)
- sender and receiver addresses, length of
transmission - CTS (Clear To Send)
- - ack for RTS
RTS
CTS
CTS
A
B
C
30ETHERNET
- IEEE 802.3 Local Area Network standard was
developed - from Ethernet network in the beginning of
1980s - - Ethernet and IEEE 802.3 are used
interchangeably - IEEE 802.3 standards
MAC CSMA/CD
Media standards
PHY
31Ethernet cabling
- In the beginning coaxial Ethernets 10BASE5
and 10BASE2
500 m
10 Mbit/s
baseband
- Twisted pair Ethernets 10BASE-T ja
100BASE-TX, 1000BASE-T
- use unshielded twisted pair
- max distance 100 m
- Optical fiber Ethernets 10BASEF ja
100BASE-FX, 1000BASE-LX/SX - - use multimode (MM) or single-mode
(SM) cable - - max distance 2 km (Half-duplex)
- 10 Gbit/s Ethernets are coming
- - standards beginning with 10G
32Ethernet frames
- Unicast traffic between two machines
- Broadcast frames to all machines in the network
- - resource advertising
- - IP/MAC address resolution
- Multicast frames to the members of a group
Multicast
Unicast
Broadcast
33Frame structure
IEEE 802.3
DIX Ethernet
Synchronization (8)
Synchronization (8)
Destination address (6)
Destination address (6)
Source address (6)
Source address (6)
Type (2)
Length (2)
Data
Data
FCS (4)
FCS (4)
34- Synchronization
- bytes 17 10101010
- byte 8 10101011
- Destination and source address
- - bytes 1 3 card manufacturer
- - bytes 4...6 card identification
- - first bit 1 in address multicast
- - all bits 1 in address broadcast
FFFFFFFFFFFF
- Type field (Ethernet)
- - protocol (e.g. IP)
- - value always bigger than 1500
-
- Length field (802.3)
- length of data field, 46-1500 bytes (sometimes
padding needed)
- FCS frame check sequence for error detection