Download presentation
Presentation is loading. Please wait.
1
Chapter 3 The Data Link Layer
2
Data Link Layer Design Issues
Services Provided to the Network Layer Framing Error Control Flow Control
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
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)
The data link layer can be designed to offer various services: Unacknowledged connectionless service Acknowledged connectionless service Acknowledged connection-oriented service
7
Services Provided to Network Layer (3)
Placement of the data link protocol.
8
Framing data link layer must use physical layer.
physical layer accept a raw bit stream and attempt to deliver it to the destination. In destination, some bits may have different values and the number of bits received may be less than, equal to, or more than the number of bits transmitted. Data link layer must detect and, if necessary, correct errors. Framing: break up the bit stream into discrete frames and add checksum
9
Framing (2) Framing methods: Byte count Flag bytes with byte stuffing
Flag bits with bit stuffing Physical layer coding violations
10
A character stream. (a) Without errors. (b) With one error.
Framing (3) Byte count A character stream. (a) Without errors. (b) With one error.
11
PPP (Point-to-Point Protocol)
Framing (4) Flag bytes with byte stuffing (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing. PPP (Point-to-Point Protocol)
12
Framing (5) Flag bits with bit stuffing Bit stuffing
Each frame begins and ends with a special bit pattern, HDLC (High level Data Link Control) protocol 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.
13
Error Control reliable delivery Using feedback Ack (Acknowledgements)
NAck (Negative Acknowledgements) Timer sequence numbers
14
Flow Control feedback-based flow control rate-based flow control
‘‘You may send me n frames now, but after they have been sent, do not send any more until I have told you to continue.’’
15
Error Detection and Correction
Type of errors Single bit Burst Error-Correcting Codes FEC (Forward Error Correction) Error-Detecting Codes For highly reliable links, such as fiber
16
Error-Correcting Codes
n-bit Codeword: n = m + r Code rate: m/n Hamming Distance: To reliably detect d errors, you need a distance d + 1 code to correct d errors, you need a distance 2d + 1 code
17
Error-Correcting Codes
Example: , , , and Hamming distance ??? Correct and detect ??? is Received. What was original frame? we want to design a code with m message bits and r check bits that will allow all single errors to be corrected.
18
Error-Correcting Codes
Hamming code
19
Error-Correcting Codes
Use of a Hamming code to correct burst errors.
20
Error-Correcting Codes
Convolutional code are specified in terms of their rate and constraint length Are used as part of the GSM mobile phone system, in satellite communications, and in the NASA convolutional code of r = 1/2 and k = 7
21
Error-Detecting Codes
Parity Checksums Cyclic Redundancy Checks (CRCs)
22
Error-Detecting Codes
Parity Problem with burst error Using rectangular matrix n bits wide and k bits high Interleaving A burst of length n + 1 will pass undetected
23
Error-Detecting Codes
Checksums groups of parity bits
24
Error-Detecting Codes
CRC Calculation of the polynomial code checksum.
25
Error-Detecting Codes
CRC All single-bit errors will be detected. By making x + 1 a factor of G(x), we can catch all errors with an odd number of inverted bits. a polynomial code with r check bits will detect all burst errors of length ≤ r Use in Ethernet detects all bursts of length 32 or less detects all bursts affecting an odd number of bits
26
Elementary Data Link Protocols
An Unrestricted Simplex Protocol Error-free Unrestricted buffers Without delay A Simplex Stop-and-Wait Protocol Flow control protocol Acknowledgement Data traffic Simplex Half duplex
27
Elementary Data Link Protocols
A Simplex Protocol for a Noisy Channel Frames may be either damaged or lost completely Using Ack Using timer Using Sequence number How many bits are required ????? PAR (Positive Acknowledgment with Retransmission) ARQ (Automatic Repeat reQuest)
28
Link Utilization
29
Link Utilization Example:
50-kbps satellite channel with a 500-msec round-trip propagation delay Size of frames : 1000-bit The time which first frame has been completely sent: The time which first frame fully arrived: The time which first acknowledgement arrived back: t = 20 msec t = 270 msec t = 520 Sender was blocked 500/520 or 96% of the time. In other words, only 4% of the available bandwidth was used Solution : Pipelining
30
Sliding Window Protocols
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.
31
Sliding Window Protocols (2)
32
Sliding Window Enhancements
Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex, use piggybacking If no data to send, use acknowledgement frame If data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP) bandwidth-delay product of the link : BD
33
Go Back N Based on sliding window
If no error, ACK as usual with next frame expected Use window to control number of outstanding frames If error, reply with NACK Discard that frame and all future frames until error frame received correctly Transmitter must go back and retransmit that frame and all subsequent frames
34
Go Back N - Damaged Frame
Receiver detects error in frame i Receiver sends NACK-i Transmitter gets NACK-i Transmitter retransmits frame i and all subsequent
35
Go Back N - Lost Frame (1) Frame i lost Transmitter sends i+1
Receiver gets frame i+1 out of sequence Receiver send NACK i Transmitter goes back to frame i and retransmits
36
Go Back N - Lost Frame (2) Frame i lost and no additional frame sent
Receiver gets nothing and returns neither acknowledgement nor NACK Transmitter times out and sends acknowledgement frame with P bit set to 1 Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) Transmitter then retransmits frame i
37
Go Back N - Damaged Acknowledgement
Receiver gets frame i and send acknowledgement (i+1) which is lost Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i If transmitter times out, it sends acknowledgement with P bit set as before This can be repeated a number of times before a reset procedure is initiated
38
Go Back N - Damaged NACK ?
39
Go Back N - Diagram RR : Ready Receive Ack REJ : Reject Nack
40
Go Back N The maximum number of frames that may be outstanding at any instant is not the same as the size of the sequence number space The sender sends frames 0 through 7. A piggybacked acknowledgement for 7 comes back to the sender. The sender sends another eight frames, again with sequence numbers 0 through 7. Now another piggybacked acknowledgement for frame 7 comes in. Did all eight frames belonging to the second batch arrive successfully, or did all eight get lost?
41
Selective Repeat Also called Selective Reject or selective retransmission Only rejected frames are retransmitted Subsequent frames are accepted by the receiver and buffered Minimizes retransmission Receiver must maintain large enough buffer More complex logic in transmitter
42
Selective Repeat - Diagram
43
? Selective Repeat Limitation of windows size:
For K-bit sequence number ?
44
Example Data Link Protocols
HDLC – High-Level Data Link Control The Data Link Layer in the Internet
45
High-Level Data Link Control
Bit-oriented Using bit stuffing techniques for redundancy Address use for detecting command/response in P2P line Sending just flags -> idle P2P line
46
High-Level Data Link Control (2)
Control field of (a) An information frame. (b) A supervisory frame. (c) An unnumbered frame.
47
High-Level Data Link Control (3) Information frame
Using sliding window with 3-bit Seq number Next : Use for piggybacking P/F : Poll/Final
48
High-Level Data Link Control (4) Supervisory frame
Type 0 : Receive Ready (RR) Type 1 : Reject Next : First Frame which has received with error Type 2 : Receive Not Ready (RNR) Next : First Frame which has received with error. Stop sending Send RR or Reject for start Type 3 : Selective Reject
49
High-Level Data Link Control (5) Unnumbered frame
Use for control Use for Sending data in Unreliable connection-less services 5 bit for Type DIS Connect (DISC) Set Normal Response Mode (SNRM) FRaMe Reject (FRMR) : Checksum is OK Number of bit is less than 32 Wrong Ack …
50
The Data Link Layer in the Internet
A home personal computer acting as an internet host.
51
PPP – Point to Point Protocol
PPP Features Separate packets (Framing), error detection Link Control Protocol (LCP) bringing lines up, testing them, negotiating options, and bringing them down again gracefully when they are no longer needed. Network Control Protocol (NCP) negotiate network-layer options in a way that is independent of the network layer protocol to be used
52
PPP – Point to Point Protocol
PPP and HDLC PPP is character oriented PPP uses byte stuffing
53
PPP – Point to Point Protocol
is broadcast Control field indicates an unnumbered frame LCP can omit Address and Control Protocol field Codes starting with a 0 : IPv4, IPv6, IPX, AppleTalk, … Codes starting with a 1 : PPP configuration protocols (LCP, NCP) default length of Payload is 1500 bytes Padding may follow the payload if it is needed
54
PPP – Point to Point Protocol (2)
A simplified phase diagram for bring a line up and down.
55
ADSL and ATM ?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.