Click here to load reader

dlc slides1

  • View
    31

  • Download
    1

Embed Size (px)

DESCRIPTION

data link layer slides info

Text of dlc slides1

  • Chapter 3

    Data Link Layer & Data Link Layer & Error Control CodingError Control Coding

  • ECE/CSC 570, NC State University

    DATA LINK CONTROL (DLC)

    DLC

    FRAMEHEADERSEQUENCENUMBERS

    TRAILERCRC

    OBJECTIVE: PROVIDE ANERROR FREE BIT PIPEPACKET

    PACKET

  • ECE/CSC 570, NC State University

    DATA LINK CONTROL (2)

    DLC

    MAC

    PHYSICAL

    DLC

    MAC

    PHYSICAL

    UNRELIABLEBIT PIPE

    RELIABLEBIT PIPE

  • ECE/CSC 570, NC State University

    Functions of the Data Link Layer (DLL)

    n Provide service interface to the network layer

    n Dealing with transmission errors error-control coding & retransmission

    n Regulating data flowslow receivers not swamped by fast sendersdone by ARQ..

  • ECE/CSC 570, NC State University

    Data Link Layer Design Issues

    n Service provided to the Network Layern Framingn Error Controln Flow Control

  • ECE/CSC 570, NC State University

    Packets vs. Frames

    Relationship between packets and frames.

  • ECE/CSC 570, NC State University

    Services Provided to Network Layer

    (a) Virtual communication.(b) Actual communication.

  • ECE/CSC 570, NC State University

    Service types

    n Unacknowledged connectionless servicen Acknowledged connectionless servicen Acknowledged connection-oriented service

  • ECE/CSC 570, NC State University

    Services

    n Unacknowledged connectionless service Source machine sends independent frames without having the

    destination machine acknowledge them No logical connection is established If a frame is lost due to noise on the link, no detection or

    recovery Appropriate for reliable links and leave the recovery to higher

    layers. (LANs)

    n Acknowledged connectionless service No logical connection is established Each frame sent is individually acknowledged Retransmit if time out Useful for unreliable channels (wireless systems!) Delay of a packet is long if many frames are retransmitted

    Regular bulk postal mail

    certified postal mail

  • ECE/CSC 570, NC State University

    Services (2)

    n Acknowledged connection-oriented service Connection is established before any data are transferred Each frame is numbered and guaranteed to be received Each frame is received only once and all frames are

    received in the right order. Provides the network layer processes with the equivalent of

    a reliable bit stream

    Reliable pipe !

  • ECE/CSC 570, NC State University

    Framing

    n How to decide the successive frames start and stop ?

    n Inserting time gaps between frames will not work. Why?

    n Three types of framing used in practiceCharacter-based countFlag bytes with byte stuffingStarting and ending flags, with bit stuffing

  • ECE/CSC 570, NC State University

    Framing: Character-based count

    A character stream. (a) Without errors. (b) With one error.

    A header to specify the no. of characters in the frame

    Even the destination knows that the frame is bad, it still has no way of telling where the next frame starts. Resending a frame back to the source

    asking for retransmission does not help either. Rarely use any more

  • ECE/CSC 570, NC State University

    Framing: Flag bytes with byte stuffing

    (a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.

    Use flag bytes to separate the frames

    What if the data has the same byte pattern as flag bytes? Insert ESC as byte stuffing, but limited to 8-bit characters.

  • ECE/CSC 570, NC State University

    Framing: Starting/ending flags with bit stuffing

    Bit stuffing

    (a) The original data.

    (b) The data as they appear on the line.

    (c) The data as they are stored in receivers memory after de-stuffing.

    a flag byte = 01111110

    Delete 0 at the receiver

    Many DLL protocols use combined method!

  • Error Control CodingError Control Coding

  • ECE/CSC 570, NC State University

    Error Detection and Correction

    n The primary function of the DLC (Data Link Control) is to convert the unreliable bit pipe into a reliable bit pipe.

    n This can be done by using FEC (Forward Error Correction) or ARQ (Automatic Repeat reQuest) for retransmission.

    n The FEC relies upon some form of Error Control Coding and the ARQ relies on Error Control Coding but also on the introduction of Sequence Number(SN) and Request Numbers (RN).

  • ECE/CSC 570, NC State University

    Error Detection and Correction

    n Error-Correcting CodesHamming Code

    n Error-Detecting CodesParity CheckCyclic Redundancy Check (CRC)

  • ECE/CSC 570, NC State University

    Properties n Errors on a link tend to be dependent and occur in

    burstsn For any reasonable code, the frequency of

    undetectable errors is very small and thus difficult to measure and difficult to model analytically.

    n The minimum distance of the coden The burst detecting capabilityn The probability that a completely random string will

    be accepted as error free

  • ECE/CSC 570, NC State University

    Definitions n Codeword : n-bit unit (n = m + r ) containing m data and

    r redundant, or check bits, is referred to as an n-bit codeword

    n The minimum distance of the code : the smallest number of errors that can convert one codeword into another

    n The length of a burst of errors : the number of bits from the first error to the last error (inclusive). The burst error detecting capability of a code is defined as the largest integer B such that a code can detect all bursts of length B or less.

  • ECE/CSC 570, NC State University

    Definitions (2)

    n Hamming Distance d: the number of bit positions in which two codewords differGiven any two codewords, exclusive OR (XOR)

    100010011011000100111000

    n It requires d single-bit errors to convert one codeword to another.

    0 for same values1 for different values

  • ECE/CSC 570, NC State University

    n The probability that all k bits in a message are received correctly is equal to ( )1- pe

    k

    0

    1

    0

    11- pe

    1- pe

    pepe

    Binary Symmetric Channel

  • ECE/CSC 570, NC State University

    Bit Error Raten A simple error correction coding method is to send every

    packet three times.n Three values are then received for each bit and the receiver

    uses a majority vote on each bit.n Evaluate the effectiveness of this method assuming that all

    the bits errors are independent. The probability that a given bit is incorrectly received two or three

    times is equal to e = 3 Pe2 (1-Pe) + Pe3

    Therefore, the probability that at least one of the N bits of the packet is received incorrectly two or three times is equal to

    PER (packet error rate) = 1 (1 e)N Ne 3N Pe2

  • ECE/CSC 570, NC State University

    Packet Error Rate (Contd)

    n Compare the PERFor N = 105 and BER =Pe= 10-7, the PER of one time

    transmission is 1- (1-BER)N N BER = 10-2.The PER of three times transmission is

    PER Ne 3N Pe2 = 3 10-9

    n Price? The useful transmission rate has been reduce by a factor

    of 3.

  • ECE/CSC 570, NC State University

    Single Parity Coder

    n Parity check append a single bit to the data. If the number of 1 bits in the codeword is even (or odd), a bit 0 (1) is appended. E.g., 1011010, a bit 0 will be added to the end and it makes

    10110100 It can be used to detect single errors. Minimum distance of the code ?

    1 2 ks s s 1 2 ks s s cCODER

    where c = s1 s2 L sk , the modulo-2 sum

  • ECE/CSC 570, NC State University

    njjjjj

    ikiiii

    ssssrssssc

    L

    L

    ==

    321

    321

    Horizontal and Vertical Parity Checksl A two-dimensional array with one parity check

    for each row and one for each column.

    s11 s12 s13 L s1k c1s21 s22 s23 L s2k c2s31 s31 s33 L s3k c3M M M M M M

    sn1 sn2 sn3 L snk cnr1 r2 r3 L rk cn +1

  • ECE/CSC 570, NC State University

    njjjjj

    ikiiii

    ssssr

    ssssc

    L

    L

    =

    =

    321

    321

    Detects all single, double and triple errors and most quadruple but not all!

    Horizontal and Vertical Parity Checks (2)

    1 0 0 1 0 1 0 10 1 1 1 0 1 0 0 1 1 1 0 0 0 1 01 0 0 0 1 1 1 00 0 1 1 0 0 1 11 0 1 1 1 1 1 0

    Horizontal checks

    Vertical checks

    1 0 0 1 0 1 0 10 1 1 1 0 1 0 0 1 1 1 0 0 0 1 01 0 0 0 1 1 1 00 0 1 1 0 0 1 11 0 1 1 1 1 1 0

    If the bit in each circle is changed, all parity checks are still satisfied

  • ECE/CSC 570, NC State University

    Observationsn To detect d errors, we need a distance d+1 code so

    that d single-bit errors cannot change a codeword to another.

    n To correct d errors, we need a distance 2d+1 code so that even d-bit errors, the original codeword is still closer than any other codewords. E.g., there are 4 valid codewords: 0000000000, 0000011111,

    1111100000, 1111111111. This code has distance of 5 (2d +1= 5). If a codeword 0000000111 arrives, the closest valid codeword is

    0000011111 (2-bit error, d = 2). Then the receiver can determine the original codeword. If there are 3-bit errors, this code is unable to correct.

  • ECE/CSC 570, NC State University

    Hamming Code (Error Correcting Code)n The bits of the codeword are numbered consecutively,

    starting from bit 1 at the left end. 1 2 3 4 5 6 7

    Original code 1 0 0 1 0 0 0n The bits that are powers of 2 (1,2,4,8) are check bits, so

    the co