The Data Link Layer Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error.

Slides:



Advertisements
Similar presentations
Chapter 3 The Data Link Layer.
Advertisements

The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
EE 4272Spring, 2003 Chapter 7 Data Link Control Objectives: Effective & reliable data communication between two directly connected transmitting-receiving.
CSE 461: Error Detection and Correction. Next Topic  Error detection and correction  Focus: How do we detect and correct messages that are garbled during.
The Data Link Layer 2 Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error.
The Data Link Layer Data Link Layer Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Example Data Link.
Transmission Errors Error Detection and Correction
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks.
The Data Link Layer Chapter 3. Position of the data-link layer.
The OSI Reference Model
1 K. Salah Module 4.0: Data Link Layer The Logical Link Control (LLC) sublayer –Framing –Flow Control –Error Control The Media Access Control (MAC) sublayer.
Computer Networks Data Link Layer.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.
20101 The Data Link Layer Chapter Design Issues Controls communication between 2 machines directly connected by “wire”-like link Services Provided.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Error Detection and Reliable Transmission EECS 122: Lecture 24 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
Transmission Errors Error Detection and Correction
18-Aug-154/598N: Computer Networks Overview Direct link networks –Error detection - Section 2.4 –Reliable transmission - Section 2.5.
Data Link Layer - 1 Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
The Data Link Layer Chapter 3. Data Link Layer Design Issues a) Services Provided to the Network Layer b) Framing c) Error Control d) Flow Control.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
Error Coding Transmission process may introduce errors into a message.  Single bit errors versus burst errors Detection:  Requires a convention that.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
Cyclic Code. Linear Block Code Hamming Code is a Linear Block Code. Linear Block Code means that the codeword is generated by multiplying the message.
جلسه هشتم شبکه های کامپیوتری به نــــــــــــام خدا.
Chapt 3 Data Link Layer1 Data Link Layer Functions –Provides services to network layer Well-defined interface –Framing –Flow control – between adjacent.
Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
The Data Link Layer. Functions of the Data Link Layer Provide service interface to the network layer Dealing with transmission errors Error detection.
Data and Computer Communications by William Stallings Eighth Edition Digital Data Communications Techniques Digital Data Communications Techniques Click.
CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful.
David Wetherall Professor of Computer Science & Engineering Introduction to Computer Networks Error Detection (§3.2.2)
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Wireless and Mobile Networks (ELEC6219) Session 3: Theories of Data Communications. Data Link Layer. Adriana Wilde and Jeff Reeve 22 January 2015.
David Wetherall Professor of Computer Science & Engineering Introduction to Computer Networks Error Coding Overview (§3.2)
The Data Link Layer Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error.
The Data Link Layer Chapter 3 1/21/2016www.ishuchita.com1.
Transmission Errors Error Detection and Correction.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Data Link Layer Chapter 3.
Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
Data Link Layer. Link Layer The data unit to be transmited at the link layer is called a frame. Why link layer? How can it know where a frame begins and.
NET 221D : COMPUTER NETWORKS FUNDAMENTALS LECTURE 4: DATA LINK LAYER Behrouz A. Forouzan” Data communications and Networking 1.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Data Link Layer Chapter 3.
Chapter 3 The Data Link Layer Computer Networks. The Data Link Layer Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D.
Distributed Systems 4. Data Link Layer Simon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano A.Y. 2015/2016.
1 The Data Link Layer A. S. Tanenbaum Computer Networks W. Stallings Data and Computer Communications Chapter 3.
Data Link Layer.
The Data Link Layer RIS 251 Dr. ir. S.S. Msanjila.
Coding and Error Control
The Data Link Layer Chapter 3
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer.
Data Link Layer What does it do?
Chapter 3 – Part 1 The Data Link Layer.
Overview Jaringan Komputer (2)
CS412 Introduction to Computer Networking & Telecommunication
EEC-484/584 Computer Networks
The Data Link Layer Chapter
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
Data Link Layer Objective: to achieve reliable and efficient communication between 2 adjacent machines Data link layer design issues services provided.
EEC-484/584 Computer Networks
CSE 461: Framing, Error Detection and Correction
UNIT-II The Data Link Layer.
Error detection: Outline
Data Link Layer. Position of the data-link layer.
Presentation transcript:

The Data Link Layer Chapter 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Data Link Layer Design Issues Error Detection and Correction Elementary Data Link Protocols Sliding Window Protocols Example Data Link Protocols Revised: August 2011

The Data Link Layer CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Responsible for delivering frames of information over a single link Handles transmission errors and regulates the flow of data Physical Link Network Transport Application

TUNALI Computer Networks 1 3 Assumptions Source and destination are directly connected to each other There can be an error during the transmission The channel has finite data rate There is a nonzero propagation delay Purpose Develop algorithms for reliable and efficient communication between the source and the destination

Data Link Layer Design Issues CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Frames » Possible services » Framing methods » Error control » Flow control »

TUNALI Computer Networks 1 5 Data Link Layer Functions Providing a well defined service interface to the network layer Dealing with transmission errors Regulating the flow of data slow receivers are not swamped by fast senders

Frames CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Link layer accepts packets from the network layer, and encapsulates them into frames that it sends using the physical layer; reception is the opposite process Actual data path Virtual data path Network Link Physical

TUNALI Computer Networks 1 7 Data Link Functionality Data link layer provides services to the network layer On the source machine, there is a process that hands in bits to the data link layer for transmission to the destination. The job of data link layer is to transmit the bits so that they can be handed over to the destination network layer

TUNALI Computer Networks 1 8 Data Link Communication

Possible Services CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Unacknowledged connectionless service Frame is sent with no connection / error recovery Ethernet is example Acknowledged connectionless service Frame is sent with retransmissions if needed Example is Acknowledged connection-oriented service (rare in data link layer, usually provided at transport layer)) Connection Establishment Data Transmission Connection Release

Framing Methods CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Byte count » Flag bytes with byte stuffing » Flag bits with bit stuffing » Physical layer coding violations −Use non-data symbol to indicate frame

Framing – Byte count CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Frame begins with a count of the number of bytes in it Simple, but difficult to resynchronize after an error Error case Expected case

Framing – Byte stuffing CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Special flag bytes delimit frames; occurrences of flags in the data must be stuffed (escaped) Longer, but easy to resynchronize after error Used in PPP Stuffing examples Frame format Need to escape extra ESCAPE bytes too!

Framing – Bit stuffing CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Stuffing done at the bit level: Frame flag has six consecutive 1s (not shown) On transmit, after five 1s in the data, a 0 is added On receive, a 0 after five 1s is deleted Used in HDLC and USB Transmitted bits with stuffing Data bits

Framing – Physical Layer Coding Violations CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Recall that 4B/5B maps four bit combinations to a five bit pattern. 16 out of 32 combinations are not used Pick one of the unused ones to establish a delimiter Ethernet uses uses a 72 bit pattern called preamble

Error Control CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Error control repairs frames that are received in error Requires errors to be detected at the receiver Typically retransmit the unacknowledged frames Timer protects against lost acknowledgements Frame sequence numbers are introduced to identify the acknowledged frame Detecting errors and retransmissions are next topics.

Flow Control CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Prevents a fast sender from out-pacing a slow receiver Two approaches −Receiver gives feedback on the data it can accept −Sender is limited by a rate built into the protocol Rare in the Link layer as NICs run at “wire speed” −Receiver can take data as fast as it can be sent Flow control is a topic in the Link and Transport layers.

Error Detection and Correction CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Error codes add structured redundancy to data so errors can be either detected, or corrected. Error correction codes: Hamming codes » Binary convolutional codes » Reed-Solomon and Low-Density Parity Check codes −Mathematically complex, widely used in real systems Error detection codes: Parity » Checksums » Cyclic redundancy codes »

Error Bounds – Hamming distance CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Code turns data of n bits into codewords of n+k bits Hamming distance is the minimum bit flips to turn one valid codeword into any other valid one. Example with 4 codewords of 10 bits (n=2, k=8): − , , , and −Hamming distance is 5 Bounds for a code with distance: 2d+1 – can correct d errors (e.g., 2 errors above) d+1 – can detect d errors (e.g., 4 errors above)

TUNALI Computer Networks 1 19 Bound on the Number of Check Bits to Correct 1-bit Errors n = total number of bits in a ‘codeword’ m = number of data bits in a codeword r = number of check bits in a codeword n = m +r Each of the 2 m legal messages has n illegal codewords at a distance 1 from it. Considering the codeword itself, there are n+1 codewords associated to a particular codeword. Since n=m+r, we must have (m+r+1) 2 m  2 n or (m+r+1)  2 r

TUNALI Computer Networks 1 20 Error Correction – Hamming code 1 Position the bits as 1,2,3,… starting from left Mark the positions of 2 i, i = 0,1,2,… as control bits (1,2,4,8,16,..) The rest, 3,5,6,7,9,10,11,12,13,14,15,17,.. are filled with data Write each data bit position as the sum of control bits E.g. 11=8+2+1= To fill a control bit, consider all the data bits whose position contains the particular control bit and use parity to fill the control bit

TUNALI Computer Networks 1 21 Error Correction – Hamming code 2 When the codeword arrives, the receiver checks each control bit and adds it to a sum if parity does not check At the end, the sum contains the incorrect bit if it is not zero Hamming Code can correct single bit errors To correct burst errors, matrix arrangement can be used to allow only one bit error.

Error Correction – Hamming code 3 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Hamming code gives a simple way to add check bits and correct up to a single bit error: Check bits are parity over subsets of the codeword Recomputing the parity sums (syndrome) gives the position of the error to flip, or 0 if there is no error (11, 7) Hamming code adds 4 check bits and can correct 1 error

TUNALI Computer Networks 1 23 Hamming Code and Burst Errors

Error Correction – Convolutional codes CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Operates on a stream of bits, keeping internal state Output stream is a function of all preceding input bits Bits are decoded with the Viterbi algorithm Popular NASA binary convolutional code (rate = ½) used in … …

Error Correction – Reed – Solomon codes CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Operates on m – bit symbols Codewords are 2 m -1 symbols long m is usually chosen as 8 Works on the following principle −Any n - degree polynomial is uniquly identified by n+1 points −Use extra points on the polynomial −When error occurs fit the best polynomial Used in DSL and DVD s etc

Error Correction – Low Density Parity Check (LDPC) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Developed by Gallager Each output bit is formed from a fraction of input bits leading to a matrix representation Matrix is sparse

Error Detection – Parity (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Parity bit is added as the modulo 2 sum of data bits Equivalent to XOR; this is even parity Ex:  Detection checks if the sum is wrong (an error) Simple way to detect an odd number of errors Ex: 1 error, ; detected, sum is wrong Ex: 3 errors, ; detected sum is wrong Ex: 2 errors, ; not detected, sum is right! Error can also be in the parity bit itself Random errors are detected with probability ½

Error Detection – Parity (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Interleaving of N parity bits detects burst errors up to N Each parity sum is made over non-adjacent bits An even burst of up to N errors will not cause it to fail

Error Detection – Checksums CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Checksum treats data as N-bit words and adds N check bits that are the modulo 2 N sum of the words Ex: Internet 16-bit 1s complement checksum Properties: Improved error detection over parity bits Detects bursts up to N errors Detects random errors with probability 1-2 N Vulnerable to systematic errors, e.g., added zeros

TUNALI Computer Networks 1 30 Error Detection - CRC (1) Bit strings as representation of polynomials E.g  x 5 + x 4 + x 0 Modulo 2 Arithmetic  Polynomial Arithmetic Addition and subtraction −No carries for addition and no borrows for subtraction −  Division  Same as binary except that the binary is done in modulo 2

TUNALI Computer Networks 1 31 Error Detection - CRC (2) The sender and receiver agree on a generator polynomial G(x) of order r whose high and low order bits 1 The sender appends r zero bits to low-order end of the m- bit message M(x) to transform it to x r M(x) Modulo 2 divide x r M(x) by G(x) Modulo 2 Subtract remainder from x r M(x) to form the transmitted frame T(x)

Error Detection – CRC (3) Adds bits so that transmitted frame viewed as a polynomial is evenly divisible by a generator polynomial CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Start by adding 0s to frame and try dividing Offset by any reminder to make it evenly divisible

TUNALI Computer Networks 1 33 Error Detection – CRC (4) The receiver modulo 2 divides the received frame by G(x) If the remainder is zero, then it concludes that the frame received is correct Else, it discards the frame

Error Detection – CRC (5) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Based on standard polynomials: Ex: Ethernet 32-bit CRC is defined by: Computed with simple shift/XOR circuits Stronger detection than checksums: E.g., can detect all double bit errors Not vulnerable to systematic errors

TUNALI Computer Networks 1 35 CRC Performance 1 If an error occurs then the received polynomial is T(x) + E (x) where E(x) represents the error Each 1 in E(x) represents a bit inverted At the receiver, remainder[(T(x)+E(x))/G(x)]=remainder[E(x)/G(x)] For single bit errors, E(x)=x i, G(x) contains two or more terms and it will never divide E(x) hence all single bit errors will be detected For 2-bit errors, E(x)=x i +x j =x j (x i-j +1), assume x is not divisible by G(x), then all 2-bit errors are detected if G(x) does not divide x k +1 for any k up to a maximum of i-j (i.e. up to the maximum frame length)

TUNALI Computer Networks 1 36 CRC Performance 2 Fact: There is no polynomial with odd number of terms that has (x+1) as factor, so include x+1 in G(x) to catch all odd numbered errors G(x) will detect all burst errors of length  r Some popular polynomials CRC-12= x 12 +x 11 +x 3 +x 2 +x 1 +1 CRC-16= x 16 +x 15 +x 2 +1 CRC-CCITT= x 16 +x 12 +x 5 +1

Elementary Data Link Protocols CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Link layer environment » Utopian Simplex Protocol » Stop-and-Wait Protocol for Error-free channel » Stop-and-Wait Protocol for Noisy channel »

Link layer environment (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Commonly implemented as NICs and OS drivers; network layer (IP) is often OS software

TUNALI Computer Networks 1 39 General Assumptions Physical, data link and network layers are independent processes that communicate by passing messages back and forth Machine A has infinite data to send to machine B There are library procedures to_physical_layer and from_physical_layer to send and receive a frame respectively. The physical layer handles the CRC check Receiver waits something to happen by a procedure call wait_for _event E.g. event=cksum_err, event=frame_arrival

TUNALI Computer Networks 1 40 Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.

Link layer environment (2) Link layer protocol implementations use library functions See code ( protocol.h ) for more details CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 GroupLibrary FunctionDescription Network layer from_network_layer(&packet) to_network_layer(&packet) enable_network_layer() disable_network_layer() Take a packet from network layer to send Deliver a received packet to network layer Let network cause “ready” events Prevent network “ready” events Physical layer from_physical_layer(&frame) to_physical_layer(&frame) Get an incoming frame from physical layer Pass an outgoing frame to physical layer Events & timers wait_for_event(&event) start_timer(seq_nr) stop_timer(seq_nr) start_ack_timer() stop_ack_timer() Wait for a packet / frame / timer event Start a countdown timer running Stop a countdown timer from running Start the ACK countdown timer Stop the ACK countdown timer

Utopian Simplex Protocol CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 An optimistic protocol (p1) to get us started Assumes no errors, and receiver as fast as sender Considers one-way data transfer Receiver has infinite buffer space That’s it, no error or flow control … Sender loops blasting framesReceiver loops eating frames }

TUNALI Computer Networks 1 43 A simplex Stop-and-Wait Protocol Assumptions Drop two of the assumptions The receiver has finite buffer space The receiver does not have infinite processing speed

Stop-and-Wait – Error-free channel CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Protocol (p2) ensures sender can’t outpace receiver: Receiver returns a dummy frame (ack) when ready Only one frame out at a time – called stop-and-wait We added flow control! Sender waits to for ack after passing frame to physical layer Receiver sends ack after passing frame to network layer

TUNALI Computer Networks 1 45 A Simplex Protocol for a Noisy Channel: Assumptions Drop the assumption The communication channel can make errors Frames may be damaged or lost completely If the frame is damaged in transit, the receiver hardware is assumed to compute the checksum In case the frame is damaged and the checksum is correct, then the protocol may fail

TUNALI Computer Networks 1 46 A Simplex Protocol for a Noisy Channel: Extra Mechanisms Since acks may also get lost, sequence numbers are needed to prevent duplicates at the receiver A 1-bit sequence number (0 or 1) is sufficient Sending frame m+2 depends on receiving ack for frame m+1 Sending ack for frame m+1 implies that frame is correctly received Protocols in which the sender waits for a positive ack before advancing to next frame are called PAR (Positive Acknowledgement with retransmission) or ARQ (Automatic Repeat reQuest)

Stop-and-Wait – Noisy channel (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 ARQ (Automatic Repeat reQuest) adds error control Receiver acks frames that are correctly delivered Sender sets timer and resends frame if no ack) For correctness, frames and acks must be numbered Else receiver can’t tell retransmission (due to lost ack or early timer) from new frame For stop-and-wait, 2 numbers (1 bit) are sufficient

TUNALI Computer Networks 1 48 Protocol 3: New Variables Sender next_frame_to_send A timer starts running when a frame is sent Receiver frame_expected

Stop-and-Wait – Noisy channel (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Sender loop (p3): Send frame (or retransmission) Set timer for retransmission Wait for ack or timeout If a good ack then set up for the next frame to send (else the old frame will be retransmitted) {

Stop-and-Wait – Noisy channel (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Receiver loop (p3): Wait for a frame If it’s new then take it and advance expected frame Ack current frame

TUNALI Computer Networks 1 51 Required Reading Tanenbaum Sections

Homework CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, (3) 6 (8) 14 (16) 19 (21)