0% found this document useful (0 votes)
36 views12 pages

Outline: Data Link Layer

Uploaded by

sheerr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views12 pages

Outline: Data Link Layer

Uploaded by

sheerr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Outline

 Framing
Byte vs. bit oriented protocols
Data Link Layer:

 Data Link Control


Data Link Control  Flow control
 Error control
CS371: Computer Communication & Networks  Protocols

Dr. Anwar Ghani, Lecturer


[email protected]
https://www.researchgate.net/profile/Anwar_Ghani3
Department of Computer Science & Software Engineering
Adapted from lecture slides by Behrouz A. Forouzan International Islamic University Islamabad
© The McGraw-Hill Companies, Inc. All rights reserved 2

Framing Byte vs. Bit Oriented


 Process of wrapping data with certain info before  Framing in byte-oriented protocols
sending out

 A frame typically consists of  Framing in bit-oriented protocols


 Flag: indication for start and end of a frame
 Header: source/destination addresses, as well as other
control information
 Data from the upper layer
 Trailer: error detection/correction code

3 4

Byte Stuffing Bit Stuffing


 Process of adding extra byte whenever there is  Process of adding extra bit to ensure flag
an escape or a flag character in the data sequence does not appear in the data

01111110

5 6

1
Flow Control and Error Control Data Link Protocols
 Flow control
 A set of procedures that tells the sender how
much data can be sent before waiting for
acknowledgment
 Error control
 Includes both error detection and correction
 Allows receiver to inform sender of lost or
duplicate frames
 Mostly based on Automatic Repeat Request
(ARQ)

7 8

Protocols for Noiseless Channel "Simplest" Mechanism


 Assuming channel is error free  Assuming
 Not realistic…  Noiseless channel
 Unlimited buffer and speed for the receiver
 No need for error control

9 10

"Simplest" : Pseudo Code "Simplest": Flow Diagram


 Sender

 Receiver

11 12

2
Stop-and-Wait Mechanism Stop-and-Wait: Overview
 Still noiseless channel
 Receiver has limited buffer
 Requires flow control
 Sender sends one frame at a time and
wait for an acknowledgment

13 14

Stop-and-Wait: Pseudo Code Stop-and-Wait: Pseudo Code


 Sender side  Receiver side

15 16

Stop-and-Wait: Flow Diagram Noisy Channel


 Realistic
 Error can and will happen
 Require error control
 Mechanisms:
 Stop-and-Wait ARQ
 Go-Back-N ARQ
 Selective Repeat ARQ

17 18

3
Stop-and-Wait ARQ Stop-and-Wait ARQ
 Sender keeps a copy of sent frame until
successful delivery is ensured
 Receiver responds with an ack when it
successfully receives a frame
 Both data and ack frames must be
numbered
 When sender does not receive an ack
within certain time, it assumes frame is
lost, then retransmits the same frame.

19 20

Flow Diagram: Normal Operation  Thinking Corner


Sender Receiver  Why data frames need to be numbered?

S=0 R=0
Deliver

S=1 R=1

Deliver
R=0

Time Time

21 22

Flow Diagram: Lost Frame Flow Diagram: Lost ACK


Sender Receiver Sender Receiver

S=0 R=0 S=0 R=0


Deliver Deliver

S=1 R=1 S=1 R=1

Deliver

Timeout Timeout R=0


S=1
Frame 0 expected;
discard
Deliver
R=0 R=0
S=0

Time Time Time Time


23 24

4
 Thinking Corner Flow Diagram: Delayed ACK
Sender Receiver
 Why ACK frames need to be numbered?
S=0 R=0
Deliver

Timeout
R=1
Frame 0 expected;
discard
S=1
R=1
Timeout

Deliver
R=0
S=0
25 26

Bidirectional Transmission Example


 Data are transferred both ways  Assuming a communication system where:
Stop-and-Wait ARQ is used
 ACK are "piggybacked" with data frames 

 Bandwidth of the link is 1 Mbps


 Propagation delay is 10 ms
 One-way data flow
 Questions
 What should be an appropriate time-out value?
 What is the bandwidth-roundtrip-delay product?
 If the system data frames are 1000 bits in length,
what is the utilization percentage of the link?

27 28

Improving Link Utilization Go-Back-N ARQ


 Previous example demonstrates major  Allows multiple frames to be sent before
disadvantage of Stop-and-Wait ARQ waiting for ACK
 Prefer to send more frames before waiting  These frames must be numbered differently
for ACK  Frame numbers are called Sequence numbers
 Example:  Frames must be received in the correct
 Recalculate the link utilization if we allow up order
to 15 frames to be sent before waiting for an  If a frame is lost, the lost frame and all of
ACK the following frames must be
retransmitted

29 30

5
Sequence Numbers Sending Window
 Frame header contains m bits for  Sending more than one frame at once requires
sequence number sender to buffer multiple frames
 Known as "sending window"
 That allows up to 2m different frame  Any of these frames in the window can be lost
numbers
 How big should m be?

31 32

"Sliding" Window Receiving Window


 Once the first frames in the window is ACKed  Receiver expects one frame at a time
 ACKed frames are removed from the buffer
 More frames are transmitted
 Result: The window slides to the right

33 34

Send vs. Receive Windows Go-Back-N: Window Sizes


 For m-bit sequence numbers
 Send window size: at most 2m-1
 Up to 2m-1 frames can be sent without ACK
 Receive window size: 1
 Frames must be received in order

35 36

6
Go-Back-N: Normal Operation Go-Back-N: Lost Frame

ACKs are
cumulative

37 38

Lost ACK: Window Size < 2m  Thinking Corner


 What is a problem if send window is
greater than 2m-1?

39 40

Lost ACK: Window Size = 2m  Thinking Corner


 Stop-and-Wait is a special case of Go-
Back-N.
 What is the send window size in Stop-and-
Wait?

41 42

7
Selective Repeat ARQ Send and Receive Windows
 Go-Back-N always discards out-of-order  Sender and receiver share window space
frames equally
 Losing one frame may result in retransmission  For m-bit sequence numbers
of multiple frames  Send window: up to 2m-1
 Very inefficient in noisy link  Receive window: up to 2m-1
 Selective Repeat ARQ allows frames to be
received out of order
 Therefore, receive window > 1

43 44

Send Window Receive Window

45 46

Negative ACK Selective Repeat: Window Size


 Used by receiver to indicate missing frame

47 48

8
HDLC
 High-level Data Link Control
Bit-oriented protocol
Data Link Control Protocols: 

Support both
HDLC and PPP 
 Point-to-point links
 Multipoint links

50

Normal Response Mode Asynchronous Balance Mode


 "NRM" mode  "ABM"
 Used in both point-to-point and multi-point link  Supports only point-to-point links
 Each station is both primary and
secondary

51 52

HDLC Frames Control Field Format


 Information frame (I-frame)

 Supervisory frame (S-frame)


Frame Check Sequence
(error detection code)

 N(S) – Frame sequence number


 Unnumbered frame (U-frame)  N(R) – Ack sequence number
 P/F
 Poll (primary  secondary)
 Final (secondary  primary)

53 54

9
U-Frame Codes Connection and Disconnection

55 56

Data Transfer: No Error Data Transfer: With Error

57 58

PPP PPP Frame Format


 Point-to-Point Protocol
 Byte-oriented protocol
 Most common protocol for point-to-point
access
 Dial-up access  Escape byte: 01111101
ADSL

 Control field uses HDLC's U-frame format
 GPRS/EDGE/3G
 No flow or error control

59 60

10
PPP Transition States Multiplexing in PPP

61 62

PPP Stack LCP: Link Control Protocol


 Link Control Protocol (LCP)  Responsible for establishing, maintaining,
 Authentication Protocol (AP) configuring, and terminating links
 Network Control Protocol (NCP)

63 64

PPP Authentication PAP


 Two protocols are supported:
 Password Authentication Protocol (PAP)
 Challenge Handshake Authentication Protocol
(CHAP)

65 66

11
CHAP NCP: Network Control Protocol
 A set of control protocols to allow data from the
network layer to be encapsulated into a PPP
frame
 One common protocol: IPCP
(Internetwork Protocol Control Protocol)
 Allow negotiation at the network layer

67 68

Data Encapsulation Example: PPP Session

69 70

Example: PPP Session (cont'd)

Questions ?

71 72

12

You might also like