1 / 91

Data Link Layer Services and Protocols

Data Link Layer Services and Protocols. Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of Technology Delhi. Outline. Frame encoding Error detection and recovery Data Link Protocols Protocol analysis Performance Verification for correctness.

silvain
Download Presentation

Data Link Layer Services and Protocols

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 Layer Services and Protocols Arzad A. Kherani (alam@cse.iitd.ac.in) Dept. of Computer Sc. And Engg. Indian Institute of Technology Delhi Topics in Networking

  2. Outline • Frame encoding • Error detection and recovery • Data Link Protocols • Protocol analysis • Performance • Verification for correctness Topics in Networking

  3. Data link services • Operates between two neighboring devices • Provides a capability for higher-layer entities to send “packets” • A packet is a sequence of bits, with well-identified “start” and “end” • The packet is itself encapsulated into a “frame”, adding to it “header” and “trailer” Topics in Networking

  4. Service boundary Network layer Data link layer Physical layer Data link protocol Data link services (2) Topics in Networking

  5. Data link services (3) • There is one data link for each physical link • In a router, for instance: Topics in Networking

  6. Data link services • Connection-less service • Un-acknowledged service • Useful in case of low errors, and for real-time applications • Acknowledged service • Used in wire-less networks • Frames that are not acked may be re-sent • Connection-oriented service • acknowledged • Ensures delivery of frames Topics in Networking

  7. Framing • Link  layer  packet  =  frame • Problem:  how  to  recognize  beginning  and  end  of  frame? • Three  methods • byte  counting  (DDCMP) • bit  stuffing  (X.25  Level  2,  802.x) • byte  stuffing  (BISYNCH,  IMP-IMP) Topics in Networking

  8. Framing • Solution based on counting bits/characters Topics in Networking

  9. Framing • Solution based on flags (01111110) and bit stuffing Original bit string Bit string, suitably bit-stuffed Received, interpreted bit string Topics in Networking

  10. Bit Stuffing (2) • Frame  beginning  and  end  marked  by  special  bit  string  ( 01111110) • If    5  1's  in  data  to  be  sent,  sender  inserts  0 • If  receiver  sees  5  1's  check  next  bit(s) • if  0,  remove  it  (stuffed  bit) • if  10,  end  of  frame  marker  (01111110) • if  11,  error  (7  1's  cannot  be  in  data) Topics in Networking

  11. Framing • Solution based on flag characters, byte stuffing • Specialcharacters  used  for  control Topics in Networking

  12. Byte Stuffing Problems • Dependence  on  fixed  character  set • Must  examine  every  byte  of  data  on  sending  and  receiving  (insert  /  remove  DLE) • Was  used  widely  in  IBM  bisynch  (at  9600bps) Topics in Networking

  13. Error detection and recovery • Two approaches: • error correction codes • quick, but ineffective in several cases: • temporary dislocation • frame size is large, and error rate is high • burst errors • expensive • error detection and recovery using re-transmission • the preferred solution today • efficient Topics in Networking

  14. Error detection • Hamming distance between pair of codes let message of length m  2m distinct messages with r redundant bits, codeword is of length n = m + r hamming distance between codes x, y = no. of bits in which x and y differ • Hamming distance for a code consider n dimension space, with 2m codewords hamming distance for code (or coding scheme) = minx, y (no. of bits in which x and y differ) Topics in Networking

  15. d d Hamming codes • Hamming distance for code based on parity bit is 2 • resulting capability: detect 1 error, correct 0 errors • Result: • to detect d errors, the Hamming distance must be d+1 • to correct d errors, the Hamming distance must be at least 2d +1 Topics in Networking

  16. Hamming codes (2) • Consider 7 bit data, 4 redundancy bits, codeword is 11 bits • message bits are numbered 3, 5, 6, 7, 9, 10, 11 • redundancy bits are numbered 1, 2, 4, 8 check bit 1 checks error in bits 1, 3, 5, 7, 9, 11 check bit 2 checks error in bits 2, 3, 6, 7, 10, 11 check bit 4 checks error in bits 4, 5, 6, 7 check bit 8 checks error in bits 8, 9, 10, 11 or (it should be) 0 = b1 + b3 + b5 + b7 + b9 + b11 0 = b2 + b3 + b6 + b7 + b10 + b11 0 = b4 + b5 + b6 + b7 0 = b8 + b9 + b10 + b11 Topics in Networking

  17. Error detection using block codes • Block of data is re-written as a matrix, say 4 x 8 • last row is parity bits • bits are transmitted row-by-row, including parity bits • code is capable of detecting a burst of errors of length n Topics in Networking

  18. x Xr /G(x) M(x) Xr M(x) R(x) T(x) = Xr M(x)-R(x) - 0 Yes  no error No  error = /G(x) R(x) = T(x) + E(x) Polynomial codes • Also known as Cyclic Redundancy Codes (CRC) • Note, all arithmetic is modulo-2 Topics in Networking

  19. Polynomial codes (2) • Error detection capability depends upon G(x) • 1 bit error  R(x) = T(x) + xi R(x)/G(x) = 0 iff E(x)/G(x) = 0 E(x)/G(x)  0 if G(x) has 2 or more terms  single errors can always be detected • Similarly, two errors can always be detected if G(x) does not divide xk + 1 • Again, if G(x) is divisible by x+1 then an odd number of errors can be detected • Polynomial codes with r CRC bits will detect all bursts of length r or less • etc., etc. Topics in Networking

  20. Polynomial codes (3) • International, IEEE standards • IEEE 802 standard G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x1 + 1 it is capable of detecting bursts of length up to 32, and all odd number of errors, and even no of error with high probability Topics in Networking

  21. Error recovery • Error detection, followed by re-transmissions, etc. • Efficient • Simultaneously address problem of “flow control” Topics in Networking

  22. Network entity Network entity p1, p2, p3, .. p1, p2, p3, .. Data link entity Data link entity Physical layer Elementary data link protocols • Broad objective of data link protocol: • Error-free, loss-free, duplication-free and in-sequence transfer of user data packets between network entities • flow-controlled • transfer user data packets in both directions Topics in Networking

  23. Network entity Network entity Data link entity Data link entity Physical layer entity Physical layer entity sender receiver Full-duplex channel receiver sender Data link modules Topics in Networking

  24. Network entity Network entity Data link entity Data link entity Physical layer entity Physical layer entity sender receiver HALF-duplex channel Data link modules • We consider several protocols. But to begin with we consider moving data in one direction, only Topics in Networking

  25. Data link protocol • Assumptions: • errors during transmission • processing capacity at receiver end • buffer capacity at receiver end • whether the underlying physical channel is half- or full-duplex • we will make nice assumptions to begin with, but move towards realistic assumptions later Topics in Networking

  26. F_1 F_2 F_3 F_4 Sender, A Receiver, B Simple data link protocol: Utopia • Assume no errors, infinite processing capacity and buffer space at receiver end, and half-duplex channel Note, F_i: Data link frame, containing data packet, i Topics in Networking

  27. Simple data link protocol: Utopia (2) • The sender’s end Topics in Networking

  28. Simple data link protocol: Utopia (3) • The receiver’s end Topics in Networking

  29. Definitions of data types/structures Topics in Networking

  30. Definition of procedures Topics in Networking

  31. Network entity Network entity Physical layer Simple data link protocol: Utopia (4) Topics in Networking

  32. Rate rcvr can handle Acceptable rate time Flow control: problem and its solution • Flow control --> limit the rate at which a sender can send data to one which is consistent with the receiver’s ability to process incoming data • Two approaches to solving it: • rate-based: determine the minimum rate at which receiver can process incoming data • feedback based: send more data as when receiver can handle more data Topics in Networking

  33. F_1 ack F_2 ack F_3 ack Sender, A Receiver, B Stop and wait protocol • Assume no errors, FINITE processing capacity, FINITE buffer space at receiver end, and half-duplex channel • ? Note, F_i: Data link frame, containing data packet, i Topics in Networking

  34. Network entity Network entity Physical layer Stop-n-wait protocol (2) Topics in Networking

  35. PAR protocol for noisy channels • PAR protocol addresses: • flow control • noisy channel • based on “positive acks” and re-transmissions Topics in Networking

  36. F_1 ack F_2 F_2 Timer runs out Timer runs out ack F_3 ack F_3 ack Sender, A Receiver, B PAR protocol Topics in Networking

  37. F_0 ack F_1 F_1 Timer runs out Timer runs out ack F_0 ack F_0 ack Sender, A Receiver, B PAR protocol • Data Frames are suitably numbered 0, 1, 0, 1, … • Acks are not numbered Topics in Networking

  38. PAR protocol (sender) Topics in Networking

  39. PAR protocol (receiver) Topics in Networking

  40. Network entity Network entity Physical layer PAR protocol Topics in Networking

  41. Pkt 1 F_0 Pkt 1 ack F_0 ack Timer runs out Pkt 2 F_1 F_0 Pkt 3 ack Pkt 4 F_1 Pkt 4 ack Receiver, B Sender, A PAR protocol • If the underlying physical layer is full-duplex, then the protocol fails Topics in Networking

  42. Timer runs out Timer runs out Alternating bit protocol F_0 Pkt 1 • PAR protocol, with numbered acks Pkt 1 Ack_0 Pkt 2 F_1 F_1 Pkt 2 Ack_1 Pkt 3 F_0 Pkt 3 Ack_0 F_0 Ack_0 Sender, A Receiver, B Topics in Networking

  43. Alternating bit protocol Topics in Networking

  44. Alternating bit protocol Topics in Networking

  45. Alternating bit protocol • Two possibilities: Topics in Networking

  46. Alternating bit protocol • Use link A  B to carry data from A to B, and acks from B to A and use link B  A to carry data from B to A, and acks from A to B • Piggyback acks onto data frames, if one has data to send • Else, just an ack • Redundant acks are OK • An ack takes the form “I am waiting to receive data frame no. X” • Introduce a field for frame type, “data frame” or “ack frame” Topics in Networking

  47. Performance of PAR protocol • Link utilization Utilization = L / (L+b*R), where L = size of data frame b = data rate R is round-trip delay • For a satellite channel, let L = 10K bits, b = 100 Kbps, R=500ms Utilization is 10K / (10K + 50K) = 1/6 • For a fibre-optic channel, let L = 10K bits, b = 100 Mbps, R = 1ms Utilization is 10K / (10K + 100K) = 1/11 • Delay=BW product is the key • Let sender send many data frames before it receives an ack Topics in Networking

  48. Pipelining • Problems arise when one or more packets are lost Topics in Networking

  49. Pipelining, with error recovery • Two approaches to recover from loss of data frame: • go-back n • selective repeat Topics in Networking

  50. Pipelining, with error recovery • Go-back n scheme: Topics in Networking

More Related