1 / 48

The Data Link Layer

The Data Link Layer. Chapter 3. Data Link Layer Design Issues. Services Provided to the Network Layer Framing Error Control Flow Control Addressing. Functions of the Data Link Layer. Provide service interface to the network layer Dealing with transmission errors Regulating data flow

tarmon
Download Presentation

The Data Link Layer

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. The Data Link Layer Chapter 3

  2. Data Link Layer Design Issues • Services Provided to the Network Layer • Framing • Error Control • Flow Control • Addressing

  3. Functions of the Data Link Layer • Provide service interface to the network layer • Dealing with transmission errors • Regulating data flow • Slow receivers not swamped by fast senders • Clearly identify receiver (link may be shared)

  4. Functions of the Data Link Layer (2) Relationship between packets and frames.

  5. Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.

  6. Services Provided to Network Layer (2) Dest = 192.168.1.8 Placement of the data link protocol. 192.169.2.4 192.167.1.5 192.168.x.x

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

  8. Framing – Byte Flag • A frame delimited by flag bytes. • Problem – how to deal with 16-bit character coding, e.g., UNICODE

  9. Framing – Binary Flag • Flag = 0111,1110 (0x7E) • Bit stuffing – preclude this pattern from ever occurring in a data frame • What if frame boundary is lost? - just scan for the flag in the incoming frames • Frame can now be of any arbitrary size. (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing.

  10. Flow Control • Sender should keep pace with the receiver • Not too fast, not too slow • Feedback based flow control • Rate based flow control (not used in link layer protocols)

  11. Error Detection and Correction • Error-Correcting Codes • Error-Detecting Codes • Hamming distance : between two binary numbers x and y • 00000,00000 00000,11111 11111,00000 11111,11111 • Hamming distance for the code book = 5 • log25 = 2 bit errors can be corrected • 00000,01010 Only these two bits could have gone wrong

  12. Error-Correcting Codes Data bits = m; Check bits = r Each code of size n = (m+r) (n+1)2m2n or (m+r+1) 2r b1 b2b3b4b5b6b7b8b9b10b11 0 01 1 0 0 1 0 0 0 0 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011 • Hamming code: 1-bit ECC • How to use Hamming code to correct burst errors? 8421

  13. Error-Detecting Codes • Polynomial code (a.k.a. CRC) checksum computation. • Binary data & generator • Polynomial representation: ith binary position = xi,i = 0,1,2,..,n • Arithmetic is done modulo 2 • Normally, T(x)/G(x) = 0 • [T(X) + E(x)]/G(x)  0 • 1-bit error E(x) = xi • 2-bit errors E(x) = xi+xj = xj(xi-j + 1) • G(x) should not be divisible by x & G(x) does not divide xk + 1 • x15 +x14+ 1 will not divide xk + 1 for k < 32768

  14. Error Correction or Error Detection? • If channel is of poor quality, use error correction • If channel is of better quality, prefer error detection + retransmission • 1000 bit frame, 10 bits for ECC = 1010 bits/frame • Versus 1001 bits for error detection • 1 Mbit payload ( 1000 frames), 10-6 BER • 1000 x 1010 (EC) versus 1000x1001 + 1001

  15. Elementary Data Link Protocols • An Unrestricted Simplex Protocol • A Simplex Stop-and-Wait Protocol • A Simplex Protocol for a Noisy Channel

  16. Protocol Definitions Continued 

  17. Protocol Definitions(ctd.) Say, frame arrival Send ack, L3 L2 L2 ED/ECC L1 L1 Frame arrival

  18. Unrestricted Simplex Protocol 3 2 sender1() recv1() 1

  19. Simplex Stop-and-Wait Protocol • L3 takes finite time to process a received packet • Or, L2 does not have infinite buffer space • As in Protocol #1: error free assumption • Main problem: Prevent sender from flooding the receiver • If receiver requires T secs. to process a frame on an average, the sender’s average frame send rate should be1/T • Main issue: Asynchronous operation

  20. A Simplex Protocol for a Noisy Channel • Main problem: Frames can be lost (due to errors, overflows, etc.) • A positive acknowledgement with retransmission protocol • What if ACK frame itself is lost? • Can a timer based solution work? • Timer solution may result in duplicate frames being delivered to L3. • L2AL2BL3B; • L2B(ack) L2A; • L2A times out, retransmits • L2AL2BL3B; (Dup) Continued 

  21. A Simplex Protocol for a Noisy Channel (ctd.) • A +ve ACK with retransmission protocol. • Receiver should be able to detect duplicate frames • Frame header – label each frame with a unique sequence number • Header is small – what is minimum size of the seq# field? • Sequence# = {0,1} i.e., 1-bit long • These are called ARQ or PAR protocols. • ACK received OK • ACK frame was damaged/DNA (*)

  22. Duplex Operation: Sliding Window Protocols • Data frames are sent both ways (AB & BA) • Simplex, Half duplex, Full duplex • Both sides ACK received frames • Data or ACK frames can get lost • Piggyback ACK frame to a data frame(delayed ACK) • Implies data frame will ready to send in a short time (?) • A One-Bit Sliding Window Protocol • A Protocol Using Go Back N • A Protocol Using Selective Repeat

  23. Sliding Window Protocols (2) • Sender maintains Swin • Receiver maintains Rwin • Frame(s) to be sent must have send_seq# within Swin • Receiver is permitted to accept frames that fall within its Rwin • After every successful send/recv, windows are incremented. • Number of frames in transit = windows size A 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.

  24. A One-Bit Sliding Window Protocol # of the last frame received OK Continued 

  25. A One-Bit Sliding Window Protocol (ctd.) receive send

  26. A One-Bit Sliding Window Protocol (2) Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet. ‘A’ is ACKing ‘1’, Whereas, ‘B’ sent seq# 1! So?

  27. A Protocol Using Go Back N 7 6 5 4 4 4 3 2 1 0 (available send window size) • Problem of “long thin pipe”, e.g., slow satellite channel • 50kpbs, 1000 bit frame, 500ms RTT • Line utilization = • l/(l+bR) • L = frame size • b = bit rate • R = RTT • If l << bR  << 50% efficiency Pipelining and error recovery. Effect on an error when (a) Receiver’s window size is 1. (However, sender has to buffer) (b) Receiver’s window size is large. (c) Window size = MAX_SEQ

  28. Sliding Window Protocol Using Go Back N Continued 

  29. Sliding Window Protocol Using Go Back N Continued 

  30. Sliding Window Protocol Using Go Back N Continued 

  31. Sliding Window Protocol Using Go Back N

  32. Sliding Window Protocol Using Go Back N (2) Simulation of multiple timers in software.

  33. A Sliding Window Protocol Using Selective Repeat Continued 

  34. A Sliding Window Protocol Using Selective Repeat (2) Continued 

  35. A Sliding Window Protocol Using Selective Repeat (3) Continued 

  36. A Sliding Window Protocol Using Selective Repeat (4)

  37. A Sliding Window Protocol Using Selective Repeat (5) 0 1 0 x 1 0 6 (a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not acknowledged. • Receive windows size should be < ½(seq # cardinality) 6 7 6 7 0 0 1 4 1 5 5 6 duplicate

  38. Protocol Verification • Finite State Machined Models • FSM is 4-tuple <S, M, I, T> • S: set of states (e.g., frame to send, expected receive frame, frame on the channel {0/1/A/-}) • M: set of frames • I: initial state • T: set of transitions • Petri Net Models • PN is a bijection of places and transitions • Places are connected to transition (and vice-a-versa) via directed arcs\ • Petri net captures concurrency very well

  39. Finite State Machined Models (a) State diagram for protocol 3. (b) Transitions. (errors not considered) Original already delivered to L3 • Reachability analysis: protocol errors can be detected • Reaching a state in which no action is specified (incompleteness) • Reaching state(s) from where no progress can be made (deadlock) • Untenable events can be easily captured (Extraneous events)

  40. Petri Net Models A Petri net with two places and two transitions.

  41. Petri Net Models (2) • BD  AC • A  AC • AD  BE • B  BE • C  • D  • E  • CF  DF • EG  DG • CG  DF • EF  DG A Petri net model for protocol 3.

  42. Example Data Link Protocols • HDLC – High-Level Data Link Control • The Data Link Layer in the Internet

  43. High-Level Data Link Control Frame format for bit-oriented protocols. • HDLC Stations & Configurations • Primary Station • Secondary Station • Combined Station • HDLC Configurations • Unbalanced Configuration (primary + stationary, full/half duplex) • Balanced Configuration (both ends are primary/secondary) • Symmetrical Configuration (both ends have primary+secondary) • HDLC Operational Modes • Normal Response Mode(NRM) (sec. only sends response, when instructed,UBC) • Asynchronous Response Mode(ARM) (sec. can send any time, no permission) • Asynchronous Balanced Mode(ABM)

  44. High-Level Data Link Control (2) Control field of (a) An information frame. (b) A supervisory frame. (c) An unnumbered frame. Type: 0 - Receive Ready 1 - NAK (Reject) 2 - Receive ~Ready 3 - Selective NAK

  45. The Data Link Layer in the Internet A home personal computer acting as an internet host.

  46. PPP – Point to Point Protocol The PPP full frame format for unnumbered mode operation. IP, IPX, XNS, Apple Talk datagram payload 0021 LCP control data C021 NCP control data 8021

  47. PPP – Point to Point Protocol (2) A simplified phase diagram for bring a line up and down.

  48. PPP – Point to Point Protocol (3) The LCP frame types.

More Related