1 / 35

Data Link Layer What does it do?

Data Link Layer What does it do?. What functions it performs? Typically: Handling transmission errors. Error control. Flow control. Framing. Framing. The DDL and PHY. The Physical Layer delivers raw sequence of bits. Unreliable service.

ewa
Download Presentation

Data Link Layer What does it do?

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Link LayerWhat does it do? What functions it performs? Typically: Handling transmission errors. Error control. Flow control. Framing.

  2. Framing

  3. The DDL and PHY • The Physical Layer delivers raw sequence of bits. • Unreliable service. • The Data Link Layer must detect and, in some cases, correct errors.

  4. DLL’s Error Control • Break bit stream into frames. • Check if frames arrived correctly. • If not: • Discards frame. • In some cases also request retransmission.

  5. Framing: Using Counters (a) Without errors. (b) With one error.

  6. Framing: Flag Byte • Each frame starts and ends with special bytes: flag bytes. • Two consecutive flag bytes indicate end of frame and beginning on new frame. • What if flag bit pattern occurs in data?

  7. Byte Stuffing

  8. Byte Stuffing (Cont’d) • Single ESC: part of the escape sequence. • Doubled ESC: single ESC is part of data. • De-stuffing. • Problem: • What if character encoding does not use 8-bit characters?

  9. Bit Stuffing • Allows character codes with arbitrary bits per character. • Each frames begins and ends with special pattern. • Example: 01111110. • When sender’s DLL finds 5 consecutive 1’s in data stream, stuffs 0. • When receiver sees 5 1’s followed by 0, de-stuffs.

  10. Bit Stuffing: Example • (a) Original data. • (b) Data as they appear on the line. • (c) Data after de-stuffing.

  11. Error Control • Reliable delivery. • Hop-by-hop! • Detecting errors. • Detecting and correcting errors.

  12. Acknowledgments • Special control info (in the case of the DLL, control frame) acknowledging receipt of data. • Positive and negative ACKs. • ACKs. • NACKs. • Are ACKs sufficient?

  13. Reliable Delivery • Timers. • Retransmission. • Duplicate detection

  14. Flow Control • Handles mismatch between sender’s and receiver’s speed. • Receiver’s buffer limitation. • Feedback-based flow control. • Explicit permission from receiver. • Rate-based flow control. • Implicit mechanism for limiting sending rate. • DLL typically uses feedback-based flow control.

  15. Error Detection and Correction • Add control information to the original data being transmitted. • Error detection: enough info to detect error. • Need retransmissions. • Error correction: enough info to detect and correct error. • forward error correction (FEC).

  16. What’s an error? • Frame = m data bits + r bits for error control. n = m + r. • Given the original frame f and the received frame f’, how many corresponding bits differ? • Hamming distance (Hamming, 1950).

  17. Hamming Distance: Examples

  18. Parity Bit • Simple error detecting code. • Even- or odd parity. • Example: • Transmit 1011010. • Add parity bit 1011010 0 (even parity) or 1011010 1 (odd parity). • Code with single parity bit has Hamming distance of 2! • Any single bit error produces frame with wrong parity.

  19. Hamming Code • Bits in positions that are power of 2 are check bits. The rest are data bits. • Each check bit used in parity (even or odd) computation of collection of bits. • Example: check bit in position 11, checks for bits in positions, 11 = 1+2+8. Similarly, bit 11 is checked by bits 1, 2, and 8.

  20. Hamming Code: Example

  21. Error Detecting Codes • Typically used in reliable media. • Examples: parity bit, polynomial codes (CRC, or Cyclic redundancy Check).

  22. CRC • Checksum appended to frame being transmitted. • Resulting polynomial divisible by G(x). • When receiver gets checksummed frame, it divides it by G(x). • If remainder, then error!

  23. Cyclic Redunancy Check T = 2rM + R [note G starts and ends with “1” ] At Transmitter, with M = 1 1 1 0 1 1, compute 2rM= 1 1 1 0 1 1 0 0 0 with G = 1 1 0 1  R = 1 1 1 Transmit T= 1 1 1 0 1 1 1 1 1

  24. Cyclic Redundancy Check At the Receiver, compute Note remainder = 0  no errors detected

  25. Flow + Error Control • How do Layer 2 protocols implement them? • What’s a frame? • F H Payload T F What’s F? . What’s in T? . What’s in H?

  26. Header and Trailer • Trailer typically has checksum. • How is it used/processed? • Header has: type, sequence number, and ack.

  27. Stop-and-Wait • Simplest form of flow control. • How does it work? (assume error-free channel) • (1) Send 1 frame; • (2) Wait for ACK. • (3) Go to 1. • Poor link utilization. • High data rates. • Long propagation delay.

  28. ARQ Protocols • Automatic Repeat Request. • Protocols that wait for ACK before sending more data. • ACKs now are used for flow AND error control. • What can happen? • At receiver: frame arrives correctly, frame arrives damaged, frame does not arrive. • At sender: ACK arrives correctly, ACK arrives damaged, ACK does not arrive.

  29. ARQ Protocols • Receiver: • **Waits for frame. • If frame arrives, check if correct sequence number. • Then send ACK for that frame. • Go to (**) • Sender: • Send frame 0. • Start timer. • If ACK 0, arrives, send frame 1. • If timeout, re-send frame 0.

  30. Simplex versus Duplex Transmission • Simplex: • Send data in one channel and control in another channel. • Duplex: • Send data and control on the same chanel.

  31. Can we do better? • Can we do better? • Piggybacking. • Bi-directional transmission. • Wait for data packet and use that to piggyback the ACK. • Use ACK field: only a few additional bits in the header. • But, how long should Layer 2 wait to send an ACK? • ACK timers!

  32. Sliding Window Protocols • Window: number of “outstanding” frames at any given point in time. • Every ACK received, window slides…

  33. Sliding Window: Basics • Allows multiple frames to be in transit at the same time. • Receiver allocates buffer space for n frames. • Transmitter is allowed to send n (window size) frames without receiving ACK. • Frame sequence number: labels frames.

  34. Sliding Window: Receiver • Receiver ack’s frame by including sequence number of next expected frame. • Cumulative ACK: ack’s multiple frames. • Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack’s receipt of 2, 3, and 4.

  35. Pipelining Go Back N Selective Repeat

More Related