Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11 Data Link Control and Protocols.

Similar presentations


Presentation on theme: "Chapter 11 Data Link Control and Protocols."— Presentation transcript:

1 Chapter 11 Data Link Control and Protocols

2 Flow and Error Control Flow Control Error Control

3 Note: Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. Error control in the data link layer is based on automatic repeat request, which is the retransmission of data.

4 Figure 11.5 Taxonomy of protocols discussed in this chapter

5 Figure 11.6 The design of the simplest protocol with no flow or error control

6 Algorithm 11.1 Sender-site algorithm for the simplest protocol

7 Algorithm 11.2 Receiver-site algorithm for the simplest protocol

8 Figure 11.7 Flow diagram for Example 11.1

9 Stop-and-Wait ARQ Operation: send -> stop & wait Bidirectional Transmission

10 Normal Operation stop-and-wait
Sender Send frame with the number of current frame Frame number: 0 or 1 Used to prevent the case of duplicate frame Wait for acknowledgement (ACK) Check for the correct ACK number Receiver Wait for a frame Receive a frame Check for the correct frame number Send ACK with the number of expected frame to received next Numbered acknowledgments are needed Keep track of Delay ACK and the next frame is lost.

11 Figure 11.10 Design of the Stop-and-Wait ARQ Protocol

12 Normal operation

13 Errors in transmitting frame
Frame error Lost frame Duplicate Frames Lost ACK Duplicate ACK Delay ACK

14 Frame Error After error detection process
If the frame contains errors, 1. Receiver sends NAK and sender retransmits the previous frame or 2. Receiver sends ACK with the number of error frame and sender retransmits the requested frame number 3. Sender timeouts and automatic repeat current frame

15 Lost Frame Receiver does not receive transmitted frame Sender timeouts
Retransmit the current frame

16 11.2 Stop-and-Wait ARQ, lost frame

17 Lost ACK Sender does not receive ACK frame Sender timeouts
Retransmit the current frame Receiver receives duplicate frame Discard duplicate frame Send ACK with waiting frame number

18 11.3 Stop-and-Wait ARQ, lost ACK frame

19 Delay ACK Similar to loss ACK
Sender does not receive ACK frame in time Sender timeouts Retransmit the current frame Receiver receives duplicate frame Discard duplicate frame Send ACK with waiting frame number Sender receives delay ACK Transmit next frame (frame number in ACK)

20 11.4 Stop-and-Wait ARQ, delayed ACK and lost frame

21 Sender site algorithm While (true) // repeat forever
canSend = true // allow first frame to go waitForEvent(); // Sleep until an event occurs If (Event(RequestToSend)) and canSend) GetData(); MakeFrame(Sn); StoreFrame(Sn); // load into buffer SendFrame(Sn); StartTimer(); Sn = Sn+1; canSend = false; WaitForEvent(); If (Event (ArrivalNotification) ReceiveFrame(ackNo); If (no error and ackNo == Sn) StopTimer(); PurgeFrame(Sn-1); // delete frame successfully transmitted canSend=true; If (Event(TimeOut)) ResendFrame(Sn-1);

22 Receiver Site Algorithm
Rn=0; // Frame 0 expected to arrive first While(true) waitForEvent(); If (Event(ArrivalNotification) ReceiveFrame(); If (corrupted(frame)); // frame error If (seqNo == Rn) ExtractData(); DeliverData(); Rn = Rn+1; SendFrameAck(Rn);

23 Piggybacking: Append ACK at the end of frame
when having data frame to send at the same time = Data frame + ACK

24 11.3 Go-Back-N ARQ Sending a sequence of frames
Before waiting for ACK Managing data flow (flow control) Using sliding windows Need controls on variables and times More complicated than Stop-and-Wait But higher efficiency with lower delay

25 11.6 Sender sliding window: Go-back-N
Frame number: 0 : (window size) Sliding window is used to manage frame number to be transmit without waiting for ACK ACK 2 Frame 0,1: OK Sliding window moves after receiving ACK

26 11.7 Receiver sliding window: Go-back-N
Sliding window moves after receiving the correct waiting frame

27 Control variables

28 Figure 11.14 Design of Go-Back-N ARQ

29 11.9 Go-Back-N ARQ, normal operation

30 Frame Error After error detection process
If the frame contains errors, 1. Receiver sends NAK with the number of error frame sender starts the window with frame number of NAK retransmits starting with the error frame as the first frame in the window or 2. Receiver do nothing no ACK from receiver sender timeouts and automatic repeat starting with the number of the error frame as the first frame in the window

31 Lost Frame, Out-of-Order frames
Receiver does not receive transmitted frame Sender still sends frame until complete all frames in the window or timeouts Receiver receives frames out of order Discard any unexpected frames sender timeouts, retransmit stating with the first frame in the window

32 11.10 Go-Back-N ARQ, lost frame

33 Lost ACK 1. Sender still sends frame until complete all frames in the window 2. If sender does not receive any ACK until timeout Retransmit stating with the first frame in the window 3. If sender receive the next ACK before timeout Cannot recognize the problem Normal operation

34 11.11 Go-Back-N ARQ: sender window size

35 Note: In Go-Back-N ARQ, the size of the sender window must be less than 2m; the size of the receiver window is always 1.

36 Algorithm 11.7 Go-Back-N sender algorithm
หมดใน window แล้ว หยุดส่ง ยังไม่หมดใน window ส่งต่อได้ ขยับ Sn ไปรอต่ำแหน่งต่อไป ถ้าส่งเป็นเฟรมแรกใน window ให้ตั้งนาฬิกา (continued)

37 Algorithm 11.7 Go-Back-N sender algorithm
(continued) Algorithm Go-Back-N sender algorithm

38 Algorithm 11.8 Go-Back-N receiver algorithm

39 Figure 11.17 Flow diagram for Example 11.7

40 11.4 Selective-Repeat ARQ Similar to Go-back-N
Sending a sequence of frames (> 1 frame) Before waiting for ACK Managing data flow (flow control) Using sliding windows Need more complicated controls on variables and times Select only error frames to be retransmit More complicated than Go-back-N Reduce the number of duplicated frames to be retransmitted But higher efficiency, lower traffic

41 11.12 Selective Repeat ARQ, sender and receiver windows

42 Figure 11.18 Send window for Selective Repeat ARQ

43 Figure 11.19 Receive window for Selective Repeat ARQ

44 Figure 11.20 Design of Selective Repeat ARQ

45 Normal operation Send all frames in the window
without waiting for ACK The number of Timers is equal to The window size Each timer is used to keep track of each frame

46 Frame Error After error detection process
If the frame contains errors, Receiver sends NAK with the number of error frame sender retransmits only error frame with the number of NAK frame

47 Lost Frame, Out-of-Order frames
Receiver does not receive waiting frame Receiver receives frames out of order Keep all unexpected frames in window Receiver sends NAK with the number of un-received frame Sender sends only frame with the number of NAK frame and Sender continues sending the remaining frames in the window If not done

48 11.13 Selective Repeat ARQ, lost frame

49 Lost ACK 1. Sender still sends frame until 2. Sender timeouts or
complete all frames in the window 2. Sender timeouts Retransmit stating with the first frame in the window or Sender receive the next ACK Cannot recognize the problem Normal operation

50 Algorithm 11.9 Sender-site Selective Repeat algorithm
(continued)

51 Algorithm 11.9 Sender-site Selective Repeat algorithm
(continued) Algorithm Sender-site Selective Repeat algorithm (continued)

52 Algorithm 11.9 Sender-site Selective Repeat algorithm
(continued) Algorithm Sender-site Selective Repeat algorithm

53 Algorithm 11.10 Receiver-site Selective Repeat algorithm

54 Algorithm 11.10 Receiver-site Selective Repeat algorithm

55 Note: In Selective Repeat ARQ, the size of the sender and receiver window must be at most one-half of 2m.

56 11.14 Selective Repeat ARQ, sender window size

57 Figure 11.23 Flow diagram for Example 11.8

58 Example 1 In a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps, and bit takes 20 ms to make a round trip. What is the bandwidth-delay product? If the system data frames are 1000 bits in length, what is the utilization percentage of the link? Solution The bandwidth-delay product is 1  106  20  10-3 = 20,000 bits // round trip The system can send 20,000 bits during the time it takes for the data to go from the sender to the receiver and then back again. Stop-and-wait: send 1 frame and wait (1 frame = 1000 bits) link utilization is only 1000/20,000, or 5%. not good for a link with high bandwidth or long delay, waste the capacity of the link.

59 Example 2 What is the utilization percentage of the link in Example 1 if the link uses Go-Back-N ARQ with a 15-frame sequence? Solution bandwidth-delay product is still 20,000 Go-back-N ARQ: send up to 15 frames ( 15 * 1000 = 15,000 bits ) // a round trip. Link utilization is 15,000/20,000, or 75 percent. damaged frames utilization percentage is much less because frames have to be retransmitted.

60 L2 Protocol requirement
Frame format Data frame Control frame Management frame etc. Flow and Error Control Protocol Stop-and-Wait ARQ Go-back-N ARQ Selective Repeat ARQ Media Access Protocol

61 Configurations and Transfer Modes
11.5 HDLC: High-level Data Link Control Configurations and Transfer Modes Frames Frame Format Examples Data Transparency

62 Figure 11.25 Normal response mode

63 Figure 11.26 Asynchronous balanced mode

64 NRM: Normal Response Mode
Unbalanced (Master/ Slave) Primary – Secondary Asymmetric Primary control all communications among all secondary stations in network Command Poll -> Request data from secondary Select -> Select secondary to send data

65 ARM: Asynchronous Response mode
Unbalanced (Master/ Slave) Primary – Secondary Symmetric Primary or secondary Can start communications But secondary cannot directly communicate to another secondary Command Poll -> Request data from secondary Select -> Select secondary to send data

66 11.16 Transfer Mode: ABM Balanced No Primary – Secondary
Equal priority for all stations in network Any station can start communications

67 Figure HDLC frames

68 11.17 HDLC frame: Frame format
Flag ( 8 bits): “ ”

69 Common fields in all frame types
Flag ( 8 bits ) “ ” Address (>= 1 byte) Receiving address Length 1 byte: last bit in address field = ‘1’ > 1 byte: last bit of each byte = ‘0’ except last bit of last address byte = ‘1’ FCS (Frame Check Sequence) Error detection CRC ( CRC - ITU-T: 16 bits or CRC-32) Error detection for all fields Except Flag

70 HDLC frame types 8 bits

71 Control Field: Specify Type of Frame
I-frame : Information frame S-frame : Supervisory frame U-frame : Unnumbered frames

72 I-Frame Control field 1st bit: ‘0’
N(S) (3 bits): Transmitting Frame number (0-7) Can extend to 7 bits N(R) (3 bits): ACK or NAK Frame number (0-7) P/F bit P bit (Poll bit): Poll Frame from Primary ‘1’: Poll Frame from Primary ‘0’: otherwise F bit (Final bit): Frame from Secondary ‘1’: Last I-frame from Secondary

73 S-frame Code P/F bit 00: RR (Receive ready)
01: REJ (Reject) -> NAK for Go-back-N 10: RNR (Receive not ready) 11: Selective-reject -> NAK for Selective-reject P/F bit Depend on the condition of Code field

74 Polling: Asking for data from secondary
RR: Receive Ready/ Transmit Not Ready RNR: Receive Not Ready Transmit Ready Control code N(R): Received frame number C P/F bit Receiver Addr S-frame N(R) = 0 P=1 RR A S-frame C RR F=1 N(R) =0 S-frame RR P=1 B N(R) =0 I-frame N(S)=0 F=0 N(R) =0 C N(S)=1 F=1 N(R) =0 C S-frame RR P=1 B N(R) =2

75 Select: Asking to send data to Secondary
RNR P=1 B N(R) =0 S-frame RR F=1 C S-frame N(R) =0 I-frame N(S)=0 F=0 N(R) =0 B N(S)=1 F=1 N(R) =0 B RR F=1 N(R) =2 C S-frame

76 RR: Receive Ready Use of RR (“00”) ACK (Secondary)
Positive response after receiving correct I-frame Expected frame number in N(R) RR code -> Ready to receive new data P/F bit (F bit condition) -> F = 1 ACK (Secondary: Response for Select command) Positive response after receiving Select frame RR code -> Ready to receive data from Primary NAK (Secondary) Negative response after receiving Poll frame RR -> ready to receive data / not ready to transmit Poll frame (Primary: Poll command) Polling command to request data from Secondary RR -> ready to receive data / request for data P/F bit (P bit condition) -> P = 1

77 RNR: Receive Not Ready Use of RNR (“10”) ACK (Secondary)
Positive response after receiving correct I-frame Expected frame number in N(R) RNR code -> Not ready to receive new data After ACK, busy, request to stop communication for a while Continue communication after receiving RR frame from Secondary again P/F bit (F bit condition) -> F = 1 NAK (Secondary) Negative response after receiving Select frame RNR -> Not ready to receive data Select frame (Primary) Select command to request to transmit data to Secondary RNR -> Not ready to receive data / ready to transmit P/F bit (P bit condition) -> P = 0

78 SREJ: Selective Reject Frame
REJ: Reject Frame Use of REJ (“01”) NAK (Secondary: Go-back-N ARQ) Negative response after receiving error frame Retransmit all frames since error frame REJ -> Reject frame number in N(R) P/F bit (F bit condition) -> F = 1 SREJ: Selective Reject Frame Use of SREJ (“11”) NAK (Secondary: Selective-Reject ARQ) Negative response after receiving error frame Retransmit only error frame SREJ -> Reject frame number in N(R) P/F bit (F bit condition) -> F = 1

79 11.21 U-frame control field in HDLC

80 Table 11.1 U-frame control command and response
Command/response Meaning SNRM Set normal response mode SNRME Set normal response mode (extended) SABM Set asynchronous balanced mode SABME Set asynchronous balanced mode (extended) UP Unnumbered poll UI Unnumbered information UA Unnumbered acknowledgment RD Request disconnect DISC Disconnect DM Disconnect mode RIM Request information mode SIM Set initialization mode RSET Reset XID Exchange ID FRMR Frame reject

81 Example 3 Figure shows an exchange using piggybacking where is no error. Station A begins the exchange of information with an I-frame numbered 0 followed by another I-frame numbered 1. Station B piggybacks its acknowledgment of both frames onto an I-frame ACK 2: N(R) // waiting for frame 2 & Station B’s first I-frame is also numbered 0 N(S) = 0 // sending frame 0 Station B transmits its second and third I-frames numbered 1 and 2 before ACK from station A Station A transmit S-frame (ACK) with no data ACK 3 (RR): N(R) = 3 .

82 (Full duplex) 11.22 Example 3: Go-back-N I-frame S-frame
Frame Type S-frame 0 1 2 Frame 0, ACK 0 0 1 2 N(R) N(S) 0 1 2 Frame 1, ACK 0 0 1 2 1 Frame 0, ACK 2 2 3 0 0 1 2 2 Frame 1, ACK 2 2 3 0 1 0 1 2 2 Frame 2, ACK 2 2 3 0 2 0 1 2 2 2 3 0 3 2 3 0 2 ACK 3

83 Example 4 In Example 3, suppose frame 1 sent from station B to station A has an error. Station A informs station B to resend frames 1 and 2 (the system is using the Go-Back-N mechanism). Station A sends a reject supervisory frame to announce the error in frame 1. Figure shows the exchange.

84 11.23 Example 4: Go-back-N ARQ
Frame 0, ACK 2 2 3 0 0 1 2 2 Frame 1, ACK 2 Frame 2, ACK 2 NAK 1 Frame 1, ACK 2 Frame 2, ACK 2 ACK 3

85 Example 11.9 Figure shows how U-frames can be used for connection establishment and connection release. Node A asks for a connection with a set asynchronous balanced mode (SABM) frame; node B gives a positive response with an unnumbered acknowledgment (UA) frame. After these two exchanges, data can be transferred between the two nodes (not shown in the figure). After data transfer, node A sends a DISC (disconnect) frame to release the connection; it is confirmed by node B responding with a UA (unnumbered acknowledgment).

86 Figure 11.29 Example of connection and disconnection

87 Note: Bit stuffing is the process of adding one extra 0 whenever there are five consecutive 1s in the data so that the receiver does not mistake the data for a flag.

88 11.24 Bit stuffing and removal

89 11.25 Special Pattern: Bit stuffing in HDLC
= 15 > 15


Download ppt "Chapter 11 Data Link Control and Protocols."

Similar presentations


Ads by Google