1 / 74

The Data Link Layer

The Data Link Layer. Chapter 3. The Model. transport layer protocol. hostA. hostB. DLL protocol. DLL protocol. node1. node2. node3. logical path. Logical path. physical path. physical path. data link/logical link = ( physical ) link + procedure.

montana
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. The Model transport layer protocol hostA hostB DLL protocol DLL protocol node1 node2 node3 logical path Logical path physical path physical path data link/logical link= (physical)link + procedure digital channel provided by DLL physical line DLL protocol

  3. Data Link Layer Design Issues(p176) • Services Provided to the Network Layer • Framing • Error Control • Flow Control

  4. Functions of the Data Link Layer(p176) • Provide service interface to the network layer • Dealing with transmission errors • Regulating data flow • Slow receivers not swamped by fast senders

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

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

  7. Services Provided to Network Layer(2) • Unacknowledged connectionless service • Low error-rate line or real-time traffic • Acknowledged connectionless service • Wireless system • Acknowledged connection-oriented service • Transfer have 3 phases: connection setup, transmit & receive, connection release

  8. Services Provided to Network Layer (3) Placement of the data link protocol.

  9. Framing method(p179) • Character count • Starting and ending characters, with character stuffing • Starting and ending flags, with bit stuffing • Physical layer coding violations

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

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

  12. Character stuffingBisync SYN SYN DLE STX A DLE DLE B DLE DLE C DLE ETX 同步字符 帧首 数据 帧尾 传输帧 填充字符

  13. 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 receiver’s memory after destuffing.

  14. Bit stuffingHDLC 帧首 数据 帧尾 01111110 01111110 01111101101111100 填充位

  15. Physical layer coding violation Manchester differential Manchester

  16. Error control(p182) • Provide sender with some feedback( positive or negative acknowledgements) • When sender transmit a frame, it starts a timer • To prevent duplicate frames accepted by receiver, sender assignssequence numbers to each frame

  17. Flow control • Fast sender could swamp the slow receiver • Throttle the sender with a kind of feedback mechanism

  18. Error Detection and Correction • Error-Correcting Codes • Error-Detecting Codes

  19. Error-Correcting Codes • Hamming distance The number of bit positions in which two codeword differ • To detect d errors, you need a distance d + 1 code • A code with a single parity bit has a distance 2, so it can be used to detect single errors • To correct d errors, you need a distance 2d + 1code • Consider n bits codeword with m bits message bits and r check bits, each 2m legal messages requires n+1 bit patterns, total number of bit patterns is 2n ,so we must have (n + 1)2m <=2n ,or (m+r+1)2m<=2n

  20. Error-Correcting Codes-1 Use of a Hamming code to correct burst errors.

  21. Error-Correcting Codes-2 • m=7, r=4, the bits that are power of 2 are check bits • Since 3=1+2, 5=1+4, 6=2+4, 7=1+2+4, 9=1+8, 10=2+8, 11=1+2+8 • Compute check bits using following equation • b1=b3+b5+b7+b9+b11 • b2=b3+b6+b7+b10+b11 • b4=b5+b6+b7 • b8=b9+b10+b11 • Hamming codes can only correct single errors, we can use interleave method to correct burst errors,

  22. Error-Detecting Codes • Generator polynomial G(x) • Algorithm for computing the checksum: • Let r be the degree of G(x). Append r zero bits to the low-order end of the frame so it now contains m+r bits and corresponds to the polynomial xrM(x). • Divide the bit string corresponding to G(x) into the bit string corresponding to xrM(x), using modulo 2 division. • Substract the remainder (which is always r or fewer bits) from the bit string corresponding to xrM(x) using modulo 2 substration. The result is the checksummed frame to be transmitted. Call its polynomial T(x).

  23. Error-Detecting Codes-1 Calculation of the polynomial code checksum.

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

  25. Protocol Definitions(p194) Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.

  26. Protocol Definitions(ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.

  27. Unrestricted Simplex Protocol 结点A 结点B 从 主 机 取 数 据 DATA1 DATA2 上 交 主 机 DATA3 DATA4  理想信道

  28. Unrestricted Simplex Protocol(p196)

  29. Simplex Stop-and-Wait Protocol 结点A 结点B 从 主 机 取 数 据 DATA1 上 交 主 机 ACK DATA2 ACK  具有简单流量控制的数据链路层协议

  30. Simplex Stop-and-Wait Protocol(p198)

  31. A Simplex Protocol for a Noisy Channel 超时 超时 发送方 frame i+2 ACKi+1 frame i ACK i+2 ACK i+3 framei+3 frame i+2 framei+3 ACKi frame I+1 ACK i+3 接收方 ACK丢失 帧丢失 重发, 丢弃重复帧 重发

  32. A Simplex Protocol for a Noisy Channel(p201) A positive acknowledgement with retransmission protocol. Continued 

  33. A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol.

  34. Sliding Window Protocols • A One-Bit Sliding Window Protocol • A Protocol Using Go Back N • A Protocol Using Selective Repeat

  35. Sliding Window Protocols (2)(p204) 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.

  36. A One-Bit Sliding Window Protocol(p205) Continued 

  37. A One-Bit Sliding Window Protocol (ctd.)

  38. A One-Bit Sliding Window Protocol (2)(p207) 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.

  39. A Protocol Using Go Back N(p208) Pipelining and error recovery. Effect on an error when (a) Receiver’s window size is 1. (b) Receiver’s window size is large.

  40. Sliding window Premise: In ARQ protocol,we must limit the maximum frames sent continuously, because sequence also take frame space Sending window: size is WT , the maximum frames can be sent before ACK frame received Receiving window: size is WR , the maximumframes can be received WT+WR<=2n WT<=2n-1

  41. Sliding window(2) Frames sent without receiving ACK and frames will be send Frames sent successfully Sending buffer 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 sequence lower upper Frames received correctly Frames will be received Receiving buffer 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 upper lower sequence

  42. Sliding window(3) 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0,1,2 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 ACK3 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 3,4,5,6 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 ACK7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

  43. Sliding window(4) T T H 0 7 0 7 6 1 6 1 5 2 5 2 4 4 3 3 H T T 0 7 0 7 6 1 6 1 H 5 2 5 2 4 4 3 3 H T 7 0 7 0 6 1 6 1 T 5 5 2 H 2 4 3 4 3 H WT = 5 WR = 1 initially Initially receive 0, send ACK0 send 0 and 1 send 2, receive ACK0 receive 1, send ACK1

  44. Sliding window(5) T 7 0 7 0 1 6 6 1 T 5 5 H 2 2 4 3 4 3 H T 7 0 7 0 6 1 6 1 T 5 5 H 2 2 4 3 4 3 H H 7 0 7 0 6 1 6 1 T 5 5 2 2 4 3 4 3 T H Receive 3, but not 2 send 3, 4 discard 3 接收到重传 的帧1 timeout, retransmit 1 discard 1, retransmit ACK1 receive 2 receive ACK1

  45. Sliding Window Protocol Using Go Back N(p210) Continued 

  46. Sliding Window Protocol Using Go Back N Continued 

  47. Sliding Window Protocol Using Go Back N Continued 

  48. Sliding Window Protocol Using Go Back N

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

  50. A Sliding Window Protocol Using Selective Repeat(p216) Continued 

More Related