ECEN 5032 Data Networks Data Link Layer Peter Mathys - - PowerPoint PPT Presentation

ecen 5032 data networks
SMART_READER_LITE
LIVE PREVIEW

ECEN 5032 Data Networks Data Link Layer Peter Mathys - - PowerPoint PPT Presentation

ECEN 5032 Data Networks Data Link Layer Peter Mathys mathys@colorado.edu University of Colorado, Boulder Data Networks, Data Link Layer, c 19962005, P . Mathys p.1/21 Overview A number of specific functions are carried out


slide-1
SLIDE 1

ECEN 5032 Data Networks

Data Link Layer

Peter Mathys

mathys@colorado.edu

University of Colorado, Boulder

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.1/21

slide-2
SLIDE 2

Overview

A number of specific functions are carried out by the data link layer (DLL):

  • 1. Provide well-defined service interface to network layer.
  • 2. Deal with transmission errors.
  • 3. Regulate data flow from fast transmitters to slow

receivers.

To accomplish these goals, the DLL encapsulates the data to transmit (payload) into frames by adding a header and a trailer as follows:

+--------+----------------------------+---------+ | Header | Payload (Data to transmit) | Trailer | +--------+----------------------------+---------+ : : :<------------------- Frame ------------------->:

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.2/21

slide-3
SLIDE 3

Virtual/Actual Communication

Actual path must use physical medium, but virtual path is less distracting to visualize and to think about.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.3/21

slide-4
SLIDE 4

Services for Network Layer

  • 1. Unacknowledged connectionless service. Frames

are just sent and no acknowledgement from destination is expected. Frames with errors are dropped and higher layer is responsible for error recovery.

  • 2. Acknowledged connectionless service. No logical

connection is established, but each frame is individually acknowledged by the destination and can be retransmitted in the event of errors.

  • 3. Acknowledged connection-oriented service. In this

case source and destination establish connection before any data is transferred. Data link layer guarantees that each frame sent is received exactly

  • nce and in the right order. At the end connection

needs to be released.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.4/21

slide-5
SLIDE 5

Use of Acknowledgements

Providing acknowledgements at the data link layer is just an optimization, never a requirement. The network layer can always send a packet and wait for it to be acknowledged. But a packet may consist of 20 or 30 frames. If the probability that a frame is lost is high, it may take a long time to get the entire packet through. If frames are acknowledged individually, then only the erroneous frames need to be retransmitted. In general unacknowledged service works fine and reduces overhead if the error-rate is very low, e.g, on

  • ptical fiber networks. Unacknowledged service is also

better for real-time traffic (e.g., voice over IP). If the error-rate of the transmission channel is high and/or errors occur in bursts, e.g., on a wireless channel, then acknowledged service is preferable.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.5/21

slide-6
SLIDE 6

Framing

To provide service to network layer, data link layer must use service provided by physical layer. Physical layer accepts raw bit stream and attempts to deliver it to destination. Received bit stream is not error-free and some bits might be lost (deletions) or added (insertions). The usual approach is for the data link layer to break the bit sream up into discrete frames and compute a checksum (CRC/FCS) for each frame:

:<------------------- n bits ------------------>: : : +--------+----------------------------+---------+ | Header | Payload (Data to transmit) | CRC/FCS | +--------+----------------------------+---------+ : : : :<-------------- k bits ------------->:<-- r -->:

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.6/21

slide-7
SLIDE 7

Framing

Breaking a bit stream up into frames is more difficult than it at first appears. Four possible methods are:

  • 1. Character (byte) count. Uses length field in header to

specify length of frame.

  • 2. Starting and ending flags with byte stuffing.
  • 3. Flags with bit stuffing of data that could be mistaken for

flag.

  • 4. Physical layer coding violations, e.g., consecutive

positive pulses in AMI signal.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.7/21

slide-8
SLIDE 8

Length-Based Framing

Problem if error during transmission occurs. Resynchronization virtually impossible.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.8/21

slide-9
SLIDE 9

Length-Based Framing

DECNET DDCMP (Digital Data Communications Message Protocol). If several frames are sent in succession, this is similar to a linked list. If one of the links is affected by a transmission error, resynchronization is difficult.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.9/21

slide-10
SLIDE 10

Flag-Based Framing

If synchronization is lost, receiver looks for flag byte.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.10/21

slide-11
SLIDE 11

Byte/Bit Stuffing

When arbitrary binary data is sent, occurrence of the flag in the data must be prevented. One way to solve this problem is to use an escape character (ESC) before each flag byte pattern in the

  • data. This is called byte or character stuffing.

Bit stuffing. Flag is 01111110 (

✁ ✂
  • ). If
✁ ✄
  • ccurs in

data, a 0 bit is stuffed in at the transmitter and removed at the receiver.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.11/21

slide-12
SLIDE 12

Character-Based Framing

IBM BISYNC (Binary Synchronous Communications). Three types of characters: (i) Text (keyboard) characters (A,B,C,...), (ii) Terminal control characters (CR, LF , BS, ...), (iii) Communication control characters (SYN, STX, ETX, DLE, ...). Frame boundaries are found by looking for STX, ETX that cannot occur in ASCII text.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.12/21

slide-13
SLIDE 13

Character-Based Framing

IBM BISYNC in transparent mode in which arbitrary binary data can be sent. DLE (data link escape) precedes each control

  • character. If DLE occurs in data it is repleaced by DLE

DLE (character stuffing).

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.13/21

slide-14
SLIDE 14

Bit Stuffing

Frame structure of HDLC (High-level Data Link Control). Flag is 01111110 (

✁ ✂
  • ).

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.14/21

slide-15
SLIDE 15

Bit Stuffing

Bitstuffing rule: Insert 0 after occurrence of 5 consecutive 1’s. Additional features:

✁ ✂
  • indicates normal frame termination.
✁ ✄✆☎ ☎ ☎

indicates “abort frame”.

✁ ✝✞
  • r more ones is regarded as idle link.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.15/21

slide-16
SLIDE 16

Finite State Machine

Finite state machine (FSM) representation of stop-and-wait ARQ protocol.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.16/21

slide-17
SLIDE 17

Petri Net for Stop-And-Wait

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.17/21

slide-18
SLIDE 18

Efficiency

There are two different aspects for ARQ protocols:

  • 1. Correctness: Does the protocol succeed in releasing

each packet once and only once without errors to the network layer?

  • 2. Efficiency: How much of the capacity of the physical

layer is wasted by waiting and retransmissions?

General strategy to increase efficiency is for sender to have window of frames that can be transmitted while ACKs are still outstanding. Receiver could also have window of frames that can be accepted out of order. Note: Windows require that DLL has sufficient buffer capacity.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.18/21

slide-19
SLIDE 19

Pipelining and Error Recovery

Effect of error when receiver window size is 1. This protocol is called go back

  • ARQ.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.19/21

slide-20
SLIDE 20

Go Back n ARQ Example

Go back

  • ARQ with

.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.20/21

slide-21
SLIDE 21

Pipelining and Error Recovery

Effect of error when receiver window size is

. This protocol is called selective repeat ARQ.

Data Networks, Data Link Layer, c

  • 1996–2005, P

. Mathys – p.21/21