Chapter 7 data link control protocols
1 / 80

Chapter 7: Data Link Control Protocols - PowerPoint PPT Presentation

  • Uploaded on

WK 13. COE 341: Data & Computer Communications Dr. Radwan E. Abdel-Aal. Chapter 7: Data Link Control Protocols. Where are we:. Chapter 7: Data Link: Flow and Error control. Data Link. Chapter 8: Improved utilization: Multiplexing. Physical Layer.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'Chapter 7: Data Link Control Protocols' - sasson

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Chapter 7 data link control protocols

WK 13

COE 341: Data & Computer Communications Dr. Radwan E. Abdel-Aal

Chapter 7:

Data Link Control Protocols

Where are we
Where are we:

Chapter 7: Data Link: Flow and Error control

Data Link

Chapter 8: Improved utilization: Multiplexing

Physical Layer

Chapter 6: Data Communication: Synchronization, Error detection and correction

Chapter 4: Transmission Media

Transmission Medium

Chapter 5: Encoding: From data to signals

Chapter 3: Signals and their transmission over media, Impairments


  • Flow Control

    • Stop-and-Wait flow control

    • Sliding-Window flow control

  • Error Control

    • Stop-and-Wait ARQ

    • Sliding-Window ARQ

      - Go-Back-N ARQ

      - Selective-Reject ARQ

  • High-Level Data Link (HDLC) Protocol

    • Basic Characteristics

    • Frame Structure

    • Operation

What is data link control
What is Data Link Control?

  • The logic or procedures used to convert the raw stream of bits handled by the physical layer into a “reliable” data link

  • Performed by the Data Link Control Protocol (Layer)

  • Requirements and Objectives:

    • Frame-level synchronization: Recognize frame start and end

    • Flow control: Regulate sending of frames to match the ability of RX to absorb them

    • Error control: Retransmission of damaged or unacknowledged frames

    • Addressing: Identify stations on a multipoint link

    • Allow control information to go with data on same link

    • Link management: To initiate, maintain, and terminate data exchange

Flow control
Flow Control

  • Required to avoid the TX overwhelming the RX by the flow of data it sends

  • RX does not‘absorb’ the received data instantly!

  • It buffers (temporarily stores) the data it receives in a finite-size buffer to do some processing before sending it upward to higher layers

  • Without flow control, the RX buffer may overflow and data gets lost…

Flow control over a link assume no error
Flow Control over a link (assume no error)

  • For now, assume:

    • No frames lost (loss over a single link is a kind of error in recognizing the frame start)

    • No frames arrive in error

    • Frames arrive in the same order they were sent, after a propagation delay

Model for frame transmission over a link
Model for Frame Transmission over a link

Frame lost:

(error in start flag)

Do you allow only one

Or multiple frames to

travel on the link

at any given time

Frame damaged:

(error in data)

Stop and wait
Stop and Wait

  • Frames sent and acknowledged one at a time:

    • Source transmits frame and waits for ACK

    • Destination receives frame and replies with an acknowledgement ACK

    • When source gets ACK, it sends next frame

  • Disadvantages:

    • Destination can stop the flow by not sending ACK

      (but we can use timeout to overcome this)

    • Not efficient - wastes time in waiting until short data frames arrive on long links (frame does not ‘fill’ the link)

i.e. I would like to make frames long in time (large in size for a given data rate)

Tf = LTb = L/R

Data fragmentation smaller frames
Data Fragmentation (smaller frames!)

  • However, large blocks of data are often split into several smaller frames- Why?

    • Limited frame buffer size at RX

    • To reduce frame error rate: remember? FER = 1-(1-BER)F

    • Errors are detected sooner (when frame arrives)

    • On error, we need to retransmit a smaller amount of data

    • On a shared medium, e.g. a LAN, this ensures that a transmitting station does not occupy the medium for a long time

  •  “Stop and wait” is inadequate in such situations where frames are “short”

  • Link utilization depends on the frame length in time relative to the link propagation time.

Stop and wait link utilization the a ratio
Stop and Wait Link Utilization: The ‘a’ ratio

  • Total number of bits in a frame = L bits, Tb = bit duration

  • R = Data rate, bps

  • Frame transmission time, tf sec: Time taken by the TX to emit all the frame bits into medium tf is large for large frames and low data rates

  • d = Link physical length, m

  • V = Velocity of propagation over link, m/s

  • Link Propagation time, tp sec: Time for a bit to traverse the link (link length in time)

  • Link length in bits, B bits/link: The number of bits that ‘fill’ the link if data is transmitted continuously

  • a = Propagation time / Transmission time = tp/tf

Smaller ‘a’ means better link utilization (with large frames)

If tf = 1, a = Propagation time tp

Stop and wait link utilization efficiency
Stop and Wait Link Utilization (Efficiency)

  • Let us define link utilization, U, as:

  • Will demonstrate on next slide that U is given by:

  • Where ‘a’ is

  • Utilization is high for small a: U approaches 1, i.e.  100% efficiency

    • Shorter links, Higher propagation velocities

    • Larger frames sizes, Lower data rates

  • Efficiency is poor for large a:

    • Longer links, Lower propagation velocities

    • Smaller frames sizes, Higher data rates

Stop and wait link utilization 2 cases
Stop and Wait Link Utilization: 2 cases:

Link is longer than frame: tp > tf: a > 1

Link is shorter than frame: tp < tf: a < 1

tf = 1

tp = a

Let frame transmission time tf = 1  a = Propagation time = tp

Link ‘full’ most of the time

 Better utilized

Link ‘empty’ most of the time !

 Underutilized

a < 1

a > 1

+ Overhead of an ACK frame in both cases !

tp > tf

tp < tf

Useful TX time

Elapsed time

Stop and wait efficiency example

  • Satellite link between 2 ground stations

  • d = 2 x 36,000 km, Data rate, R = 1 Mbps

  • Typical wave velocity, V = 3 x 108 m/s

  • Frame TX time, tf = L/R = 8000/(1x106) = 8 ms

  • Propagation time, tp = d/V

    = 2x36x106/(3x108) = 240 ms

  • End of first frame reaches RX after 8+240 = 248 ms from start

  • ACK takes 240 ms more to reach TX, i.e. it starts sending 2nd frame after 488 ms

  • Utilization = 8/488 = 1.6% (=1/(2a+1))

Stop and Wait Efficiency: Example

  • Compare the efficiency of stop-and-wait flow control for two links using the parameter ‘a’:

    • Fame size, L = 1000 characters of 8 bits each, = 8000 bits

Link is shorter than frame: a < 1

Link is longer than frame: a > 1

  • 200-m optical fiber link

  • Data rate, R = 1 Gbps

  • Typical wave velocity, V = 2 x 108 m/s

  • Frame TX time, tf = L/R = 8000/(1x109) = 8ms

  • Propagation time, tp = d/V

    = 200/(2x108) = 1 ms

  • End of first frame reaches RX after 8+1 = 9 ms from start

  • ACK takes 1 ms more to reach TX, i.e. it starts sending 2nd frame after 10ms

  • Utilization = 8/10 = 80% (=1/(2a+1))

Sliding windows flow control
Sliding Windows Flow Control

  • Avoids the low efficiency of Stop-and-wait when a > 1

  • Allows multiple frames to be “in transit” simultaneously on the link

  • RX keeps a buffer store (in memory) for W frames

  • So, TX can send up to W frames without waiting for ACK

  • Each frame carries a sequence number

  • ACK from RX shows the number of next expected frame

  • TX keeps a list of frames it can send

  • RX keeps a list of frames it expects to receive

  • These lists form sliding windows at TX and RX that shrink/expand as frames are sent, and ACKs are sent/received

  • Hence, Sliding Windows Flow Control

Frame sequence numbering

k = 3 bits

Frame Sequence Numbering

  • Frame sequence number is limited by the size of a corresponding field in the frame, e.g. k bits

    • Frames are numbered modulo 2k

    • e.g. for k = 3, frame sequence # is modulo 23 = 8, i.e.= 0,1,..., 7, 0,1,…

  • Window size (W) is limited to a maximum of 2k-1

    i.e. Wmax = 7 in the above example

Frame Sequence Number


HDLC Frame

Sliding window send receive cycle
Sliding Window Send/Receive Cycle

Window covers

frames to be received

Window covers

frames to be sent




(Not rigid) Windows

When you want to ACK some frames:

1. Delete ACKed frames from buffer

2. Expand Window to receive more

3. Send Acknowledgement

1. Delete ACKed frames from buffer

2. Expand Window to send more


When you want to send more:

Send frames

Shrink window past received frames


Receive Frames

Shrink window past sent frames

Acknowledging frames is a separate issue from receiving them

Sliding window diagram

Send/Receive Frames

Receive/Send ACKs

Sliding-Window Diagram




k = 3 bits, W = 7


Window covers

frames to be sent




W = 7

Max # of frames TXed without ACKed

Remove ACKed frames from buffer


Window covers

frames to be received

Example sliding window
Example Sliding Window

Max window size of 7




RR = Receiver Ready



Received up to 2

Ready to receive 7 frames starting with 3

Received up to 3

Ready to receive 7 frames starting with 4

Sliding window enhancements
Sliding Window Enhancements

  • RR n: Positive receive ACK that asks for more (received up to frame n-1 and ready for n)

  • Receiver can also acknowledge receiving frames without permitting further transmission:

    (Receive Not Ready RNR)

    • Example RNR 5: “Received frames up to 4, but not ready for 5 and beyond yet”

    • When it becomes ready, RX must send a normal acknowledge (RR 5) later for TX to resume sending frames

Sliding window in a duplex system
Sliding Window in a Duplex System

  • In a Duplex System, destination also transmits data back to source

  • Piggybacking: Utilizing data frames from destination to carry ACK signals back to source to improve channel utilization

    • Additional field in the data frame for use only by +ive (RR) ACK

    • If you have no data to send now or your ACK is not RR, use a normal (dedicated) ACK frame (e.g. RR or RNR)

    • If data is to be sent but no acknowledgement needed, insert the last acknowledgement number to prevent RX from using the number existing in the ACK field of the data frame.

      (When RX station receives aduplicate ACK, it ignores it)

Sliding window protocol efficiency
Sliding Window Protocol: Efficiency

  • Much more efficient than Stop and wait for a>1

  • Treats link as a pipeline to be filled with several frames in transit simultaneously- not just one by one

  • With window size W and assuming no error, link utilization, U, is given by (Appendix 7A)

    where a = Propagation time/Frame transmission time = tp/tf

  • i.e. Sliding window protocol can achieve 100% utilization for W  (2a + 1).

  • The smaller the W needed for this the better! (Why?). This requires a small a(so small a is still advantageous!)

Sliding window efficiency example
Sliding Window Efficiency: Example

Shorter links are better (small a)

  • Compare the efficiency of Sliding Window flow control for two links using the parameter ‘a’:

    • Fame size, L = 1000 characters of 8 bits each, = 8000 bits

  • Satellite link between 2 ground stations

  • d = 2 x 36,000 km, Data rate, R = 1 Mbps

  • Typical wave velocity, V = 3 x 108 m/s

  • Frame TX time, tf = L/R = 8 ms

  • Propagation time, tp = d/V = 240 ms

  • a = tp / tf = 30

  • 100 % link utilization is achieved with window size W:

    W  (2 a+1)  (2 x 30 +1)  61

    W = 61, k = 6 bit (Large window, large buffers at TX, RX)

  • For k = 3 bits, W = 7:

    Utilization U = W/(2a+1) = 7/(61) = 11.5% > 1.6% for Stop and wait.

  • 200-m optical fiber link

  • Data rate, R = 1 Gbps

  • Typical wave velocity, V = 2 x 108 m/s

  • Frame TX time, tf = L/R = 8ms

  • Propagation time, tp = d/V = 1 ms

  • a = tp / tf = 0.125

  • 100 % link utilization is achieved with window size W:

    W  (2 a+1)  (2 x 0.125 +1)  1.25

    i.e. W = 2 (A window of just 2 frames!)

    - easily achieved in practice!

Error control
Error Control

WK 14

  • Use of retransmission to handle errors detected in frames (Backward Error Handling)

  • This process is called Automatic Repeat Request (ARQ)

  • Types of Problems:

    • Damaged frames

      (Frame arrives at RX but in error)

    • Lost frames (Noise burst damages frame header beyond recognition- so not recognized by RX)

    • For connections across a network, frames arriving too late e.g. due to network congestion- Will be ignored or dropped by time-out.

Error control techniques
Error Control Techniques:

  • Apply error check mechanism (chapter 6)

  • Send Positive acknowledgment: (for one or more frames)

    From RX for Error-free frames, e.g. RR i

  • Send Negative acknowledgement requesting retransmission of a lost or damaged frame:

    RX sends negative ACK for damaged or lost frames, requesting retransmission, e.g. REJ i

    • How does RX detect a “lost” frame? Through receiving the next frame “out of sequence” – Unexpected (frames are numbered!)

  • Retransmission after timeout:

    TX automatically retransmits a frame that has not been acknowledged following a predetermined time-out interval

Categories of error control mechanisms
Categories of Error Control Mechanisms

Main types of ARQ-based

standard error control mechanisms

Stop and wait arq possible scenarios scenario for damaged lost frame
Stop and Wait ARQ: Possible ScenariosScenario for Damaged/Lost Frame

  • TX transmits a single frame (keeping a copy)

  • Then waits for ACK from RX

  • If frame reaches RX damaged (in error):

    • RX discovers this through error detection

    • It then discards the frame, and does not send ACK

    • TX “times out” on waiting for ACK

    • … and then retransmits the frame again automatically

    • RX thus receives only one correct copy of the frame

  • From the RX side, this is identical to a lost frame scenario

Stop and wait arq scenario for lost ack
Stop and Wait ARQ: Scenario for Lost ACK

  • ACK from RX for a correct frame is lost (reaches TX damaged beyond recognition):

    • TX will timeout and retransmit the same frame again!

    • RX gets two good copies of that frame!

    • Without numbering the frames, RX will consider both copies as two different valid frames

      (but data duplication is not “reliable” data transport!)

    • To avoid this, TX labels frames alternately as 0, 1 (enough for Stop and Wait)  duplication detected at RX

    • RX uses ACK0 & ACK1, Similar to sliding window RRn:

      • ACK0: Received 1 and ready for 0 (better named RR 0)

      • ACK1: Received 0 and ready for 1 (better named RR 1)

Stop and wait arq
Stop and Wait ARQ

= RR 1


= RR 0

Lost Frame


Same scenario if F0 was

received damaged (in error)

but RX kept quiet about it!

Lost ACK


RX gets two good copies of F1.

Labeling frames allows RX to

detect this and discard

one of them.

Stop and wait pros and cons
Stop and Wait - Pros and Cons

  • Simple

  • Inefficient (As seen with flow control)

  • For improved efficiency, we use sliding-window based ARQ (Continuous ARQ)

Sliding window arq
Sliding Window ARQ

  • Improves line utilization by sending up to W frames before worrying about ACK

  • A form of Pipelining (several tasks started before 1st task is finished)

  • TX uses a window to mark frames to be transmitted until they are sent and acknowledged

    • The window size W should be ≤ 2k – 1, k is the size of the frame sequence field in the frame header,

    • Frame are given sequence numbers modulo 2k, i.e. for k = 3:


    • W is fixed in this protocol, but may be variable in others

  • Each time a proper ACK is received for a number of frames the TX window slides past them, hence the name Sliding Window. This:

    • Releases those frames for deletion from TX buffer memory

    • Introduces new frames for transmission

Tx sliding window
TX Sliding Window

- Window now has a fixed width (W) and slides rigidly as one piece

upon receiving ACKs.

- Within the window, frame sending is handled using a send (S) pointer

Frames already sent

but not yet ACKed

Frames that can be sent

S Pointer to next frame to be sent

F0, F1

Positively ACKed

Slide the window as a whole

(Important: Pointer is not pushed with window)

Rx sliding window error control
RX Sliding Window Error Control

  • Size of the RX window for error control is always 1

  • The RX window contains the sequence number for the frame expected to be received next

  • If a different frame arrives (i.e. out of sequence arrival), it is immediately discarded and the window does not slide

  • Once the expected frame arrives correctly, the window slides one step to point to the next expected frame

Rx sliding window
RX Sliding Window

F0 now expected

F0 Received Correctly

F1 now expected

Sliding window arq summary
Sliding Window ARQ: Summary

  • Uses sliding windows (now rigid- moves as a whole) at TX and RX to track frame movement

  • TX uses timeout on waiting for ACK

  • If no error: RX acknowledges with RR i, where i is number of the next frame expected

As you receive

expected frame

without error


As you receive ACKs

Frames received correctly

and have been or

will soon be acknowledged

Frames waiting

to be received

Frames received correctly.

Have or will soon be


As you transmit

Expected next frame to be received

Next frame to be sent

Size = 1

Size ≤ 2k-1

Sliding window arq1
Sliding Window ARQ:

  • Two main standard approaches:

    • Go Back N

    • Selective Reject

Sliding window arq go back n
Sliding Window ARQ: Go Back N

  • Error Scenarios:

    Will consider the following error scenarios

    • Damaged Frame

    • Lost Frame

    • Lost ACK

      • Lost Positive ACK (RR)

      • Lost Negative ACK (REJ)

Go back n arq error scenarios
Go Back N ARQ: Error Scenarios

  • Damaged Frame:

    RX received frame i damaged

    • RX discards frame i and all subsequent frames until frame i is received correctly

    • RX either:

      • Scenario 1.A: Sends a negative ACK (REJ i )

        • TX must go back(hence the name go back N) and retransmit that frame and allsubsequent frames that were transmitted in the mean time

      • Scenario 1.B: Does not send REJ (relies on TX time out) Handled as a lost frame (next)

        (and also as a lost negative ACK)

Go back n arq error scenarios1
Go Back N ARQ: Error Scenarios

  • Lost Frame:

    • RX expects frame i but does not get it,

    • So TX does not get any ACK for it

    • Scenario 2.A: TX can send more frames

      • TX carries on sending subsequent frames, i+1, …

      • RX gets frame (i+1)out of sequence (as it did not get frame i). This allows RX to detect the problem

        RX then either:

        • Sends REJ i (Note i, not i+1) to TX

        • Or: Takes no further action (relies on TX time out)

      • In both cases, TX goes back and retransmit frame i and allsubsequent frames transmitted in the mean time

Go back n arq error scenarios2
Go Back N ARQ: Error Scenarios

  • Lost Frame, i:

    TX kept sending, RX does nothing, TX times out

LHS of TX window:

Frames sent but not yet


RX frame pointer

does not leave ‘2’

until F2 is correctly


RR 2

Slide W to


F0, F1

F3 Arriving out

of sequence

(Not the next

expected frame ),

RX ignored it, but

did nothing

Go back 1

On F2

S points to next frame to

be TXed

R points to next frame to

be RXed

Go back n arq error scenarios3
Go Back N ARQ: Error Scenarios

Lost Frame, Contd.

  • Scenario 2.B:

    • TX does not send further frames after i, and RX does not send any RR or REJ (RX could not detect the problem!. It does not know that a frame was sent and got lost)

    • TX times out waiting for RX response

      • Scenario B-1:

        • TX sends a polling command (RR with P bit = 1) to force RX to report its receiving status by sending RR i

        • When TX receives the RR i response, it retransmits frame I and all subsequently sent frames

      • Scenario B-2:

        • TX retransmits frame i after timeout

Go back n arq error scenarios4
Go Back N ARQ: Error Scenarios

  • Lost Positive ACK (RR) from RX:

    • RX gets frame i OK and sends a positive ACK: RR (i+1)

    • This RR frame is lost on its way to TX

    • Two Scenarios:

      • Scenario 3.A:

        • A later Acknowledgement from RX, e.g. RR (i+n) manages to reach TX before TX times out. This solves the problem, since ACKs are cumulative

      • Scenario 3.B:

        • TX times out before receiving any subsequent RR acks:

          • TX sends a polling command (RR with P bit = 1) to force RX to report its receiving status by sending RR i.

          • TX Repeats step above a few times, if no success it initiates a Reset procedure

Go back n arq error scenarios5
Go Back N ARQ: Error Scenarios

  • Lost Negative ACK (REJ) from RX:

    Similar to RX not sending REJ

    i.e. Scenario 1.B for Damaged Frame.

Go back n example



Go back 3

(4, 5, 6, 7) and



Go Back N Example

TX does

not wait

Got 0, 1

Ready for 2

Frame 4

lost on

the way

Got 3

Ready for 4

Got 5 not 4

 REJ 4 and beyond













Go back in window until

you meet the rejected

Frame #, and resume

transmission from there

RR 7 (+ ive ACK)

lost on the way.

TX times out

Before getting

any subsequent

RRs after lost Ack

TX polls RX

To send its

Receiving status

This is a


F bit = 1

Any corrective action

needed here at TX?


Two neighboring nodes (A and B) use a sliding-window go-back-N for error control with a 3-bit sequence number. The window size is 4. Assuming A is TX and B is RX, show the window positions at A for the following situations:

  • Before A sends any frames

  • After A sends frames 0, 1, 2 and receives RR 2 from B

  • Later, after A sends frames 3, 4, and 5 and receives RR 5 from B


Send Next

Window size limit for go back n arq

By mistake

RX gets 2

copies of F0

Window Size limit for Go-back-N ARQ

W  2k – 1

  • Size of the window must be W  2k – 1 i.e. W < 2k where “k” is the number of bits reserved (in the control field) for the sequence number

  • Let k = 2,

    i.e. W should be < 4

  • By comparing the figures opposite for W = 3 and W = 4, justify the need for this limit on window size in Go Back N



on F0

TX goes back

to send F0


on F0




TX goes back

to send F0


All happened before timeout


F0 sent twice in both cases. Mistake is detected only on the left (for the correct W size)

Selective reject selective repeat arq
Selective Reject (Selective Repeat ARQ)

  • Also called selective retransmission

  • RX requests retransmission of only the rejected frame using SREJ i

  • Subsequent frames received after the rejected frame are buffered at RX (not thrown away as in Go Back N ARQ)

  • TX retransmits only the frame that was specifically rejected and those that timed out

  •  Less retransmission traffic than Go Back N

Selective reject example
Selective Reject: Example

- Waiting for 4 - 4 is lost

5 received out of sequence, Problem detected, SREJ 4 sent

5, 6

  • Only rejected frame (4) retransmitted

  • (not 4,5,6)

  • Normal transmission resumes where left (7)

TX sends:


(complex sequencing)

Acknowledge up to 6 (5 & 6 were kept!)

+ ive ACK lost on its way!

TX times out before getting subsequent RRs to the lost ones

So it polls RX for its receiving status

F bit = 1

Things turned out OK

Selective reject pros and cons
Selective Reject: Pros and Cons

  • Minimizes retransmission  Better link utilization

    (Useful where link utilization is poor- sending a frame is an inefficient process) e.g. short frames on long (e.g. satellite) links

  • But more complex: (so, less common than Go back N)

  • Receiver:

    • Must maintain large enough buffer to save post-SREJ frames until missing frame arrives

    • Needs logic for inserting requested frame in place when it arrives later

  • Transmitter:

    • Needs logic to allow sending the requested frame out of normal sending sequence

  • Also, more restricted window size, W:

    • With k bits, max window size is 2(k-1) (vs 2k-1 for Go Back N),

      e.g. for k = 3: Wmax = 4 for SREJ, Wmax = 7 for GO Back N

How are such flow and error mechanisms implemented high level data link control protocol hdlc
How are such flow and error mechanisms implemented:High-Level Data Link Control Protocol (HDLC)

  • HDLC is the most common data link control protocol and forms the basis for many others

  • Runs in the Data Link Layer (Layer 2 in OSI)

  • Main Functions:

    • Flow Control: Data is transmitted by TX- only as fast as RX can absorb it.

    • Error Control: Objective: Pass data up to higher layer exactly as transmitted, i.e.:

      • Without error,

      • Without loss,

      • Without duplication,

      • and in the correct order

High level data link control protocol hdlc
High-Level Data Link Control Protocol (HDLC)

  • To satisfy various applications, HDLC defines:

    • Three types of communicating stations

    • Two types of link configurations, and

    • Three data transfer modes of operation.

High level data link control protocol hdlc1
High-Level Data Link Control Protocol (HDLC)

Station types:

  • Primary Station (PS):(e.g. computer)

    • Responsible for controlling link operation

    • Control frames issued by the PS are called commands

  • Secondary Station (SS): (e.g. terminal, sensor)

    • Operates under the control of a primary station

    • Control frames issued by the SS are called responses

  • Combined Station (CS):

    • Issues both commands and responses

High level data link control protocol hdlc2
High-Level Data Link Control Protocol (HDLC)

Link configurations:

Determined by the types of stations on the link

  • Unbalanced (different status): e.g. One primary station plus one or more secondary stations

  • Balanced (same status): e.g. Two combined stations

High level data link control protocol hdlc3
High-Level Data Link Control Protocol (HDLC)

Data Transfer modes: (Who can send?, what? and when?)

  • For unbalanced link configuration: (Response Modes)

    • Normal Response Mode (NRM)

      Secondary may send data only in response to a command from primary

      e.g. Computer (PS) connected to a number of terminals (SS) over a multi drop line. Computer polls terminals for data

    • Asynchronous Response Mode (ARM) Secondary may send data without explicit permission from primary. Primary still retains link control (initialization, error recovery, logical disconnection, …)

      (Rarely used)

High level data link control protocol hdlc4
High-Level Data Link Control Protocol (HDLC)

Data Transfer modes: (Who can send?, what? and when?)

  • For balanced link configuration

    • Asynchronous Balanced Mode (ABM) Either combined stations may send data without obtaining permission from the other station

      Most widely used (no polling involved)

      e.g. full duplex point-to-point

Hdlc frame structure
HDLC – Frame Structure

  • HDLC Uses Synchronous Transmission, i.e. large frames

  • Frame consists of the following ‘fields’:

    • Flag fields at start and end: for frame-level sync

    • Address field: for addressing in multi-point links

    • Control field: for Flow and Error control

    • Information field: (payload data or link management data)

    • FCS field: for error detection

Hdlc frame structure1
HDLC – Frame Structure


Address Field

k = 3 bits

Control Field

k = 7 bits

Hdlc frame format
HDLC Frame Format

  • Flag:

    • Size: 1 Byte

    • Special pattern 0 1 1 1 1 1 1 0 used as frame begin/end and synch.

    • Used for Header and trailer

  • Address:

    • Size: 1 Byte (or extendible to more bytes for larger networks)

    • If primary station created the frame, the address is that of the destination secondary station

    • If secondary station created the frame, the address is that of the source secondary station

    • Networks not using “primary/secondary” (e.g. Ethernet) use 2-Byte address (source/destination)

  • Control:

    • Size: 1 or 2 Bytes

    • Identifies frame type (I, S, U)

    • Used for error & flow control functions

  • Information: Payload of user data (I Frames) or link management data (U)

    • Size: Varies (as multiple bytes) from network to network. Always fixed within a network

    • I frames contains user data received from the higher layer (Network layer)

  • FCS:

    • Size: 2 or 4 Bytes (depending on the divisor P used)

    • Implements CRC error detection

Hdlc frame structure flag field
HDLC – Frame Structure: Flag field

  • Flag Field: unique pattern 01111110 at both start and end of frame

    • Used for frame-level synchronization

    • This pattern should not exist in any other part of the frame

    • Two ways to ensure this:

      • Ensure that higher layers avoid using these pattern in the data they generate (causes lack of data transparency)

      • TX uses bit stuffingfor data (inserts a 0 after each consecutive five 1s) to ensure data transparency at higher layers

Hdlc bit stuffing
HDLC Bit Stuffing:

  • At TX:

    Inserts a 0 after each consecutive five 1s of non-flag data

    (e.g. 01111100….or 01111101)

  • At RX:

    After detecting the preamble flag, RX monitors incoming bits – when a pattern of five 1s appears; the 6th and the 7th bit are checked:

    • If 00 or 01  Bit 6 is a stuffed 0  Remove it

    • If 10  This is the postamble flag  end of frame

    • If 11  ABORT (Error- there must have a 0 after every five 1’s)

Hdlc bit stuffing removal
HDLC Bit Stuffing & Removal

Data handed in for transmission

Would this data have

caused any

frame sync problem?

TX ensures that the flag pattern

does not occur in non-data fields

Hdlc bit stuffing1
HDLC Bit Stuffing

  • Problems: Single-bit errors could split a frame into 2 or merge two frames into 1.




(Bit stuffed)


“lost” frame




(Bit stuffed)


Hdlc frame types
HDLC Frame Types

  • HDLC defines three types of frames

  • Frame type determined by first bits in the control field

    • User Information frames (I-frames): 8 or 16 bit control field

      • Used to transport user data

      • In a duplex system, they can also carry control messages regarding previously received data to be carried along with data TXed (piggybacking)

    • Supervisory frames (S-frames): 8 or 16 bit control field

      • Used to transport control information for the data transfer (ACKs) only- Short frame, Carries No Data

    • Unnumbered frames (U-frames): 8 bit control field

      • Convey link management functions

      • Does not contain a frame sequence number (N or S) (unnumbered)

      • Can carry Management data

Hdlc i s u frames format
HDLC I, S & U Frames Format

Arrow indicates that the first transmitted field is the Header flag, then the address, then the control…

RR j




Hdlc i frames
HDLC I-Frames

  • Designed to carry user data delivered from the Network layer

  • They can also include limited flow & error control information (piggybacking in duplex links)

  • Their Control field can be either 8 bits or 16 bits (Defined at link initialization)

  • An 8-bit Control field consists of:

    • First bit identifies the frame type: “0”: I-frames “1”: Non I-frames

    • Next 3-bits, called N(S), indicate the sequence number of the transmitted frame

      • So frame sequence numbers are 0,1,2,3,4,5,6,7

    • Next bit is called P/F (Poll or Final)

      • When a primary station polls other stations, it sets this bit to 1 (P bit)

      • When a secondary station responds to a poll, sets this bit to 1 (F bit)

      • i.e. same bit has different meanings depending on source

    • Next 3-bits, called N(R), define the frame sequence number for a default RR N(R) ACK carried when piggybacking is used (next expected frame)

  • Only difference in 16-bit Control field: k = 7 bits for N(S) and N(R) instead of 3 bits

Hdlc i frames1

Duplex Link

HDLC I-Frames



Carries 2 sequence numbers

8-bit Control filed

With Piggybacking

# of next Frame expected

Positive ACK: = RR N(R)

# of Frame sent

(This frame)

  • 16-bit control field: Extends N(S) and N(R) to 7 bits each instead of 3 bits, allowing larger windows to be used

  • Note: Control field contains no ‘Function’ part - So, only the + ive ACK function (RR) can be sent as a default by piggybacking!

Frame sequence

Numbering is modulo ?

Hdlc supervisory s frames s is also for short
HDLC Supervisory (S)-Frames (S is also for short!)

  • The workhorse for sending separate ACKs. Used when:

    • - No user data to send, or - ACK is not RR, i.e. (RNR, REJ, SREJ)

  • This is the only method to send ACKs that are different from RR

Example: RNR 6











Carries only 1 sequence number

First 2 bits:

’10’ identifies frame as an S-Frame





Hdlc u frames no frame sequence number
HDLC U-Frames (no frame sequence number)

Used for Link management operations

Examples of

Link Management


(up to 32)

As a

As a

Hdlc u frames
HDLC U-Frames

Examples of

Network Management


As a

As a

Hdlc frame structure address field
HDLC Frame Structure – Address Field

  • Address field identifies the secondary destination station transmitting the frame or intended to receive the frame

  • Not needed for point-to-point links (only one source and one destination) - but included for uniformity

  • Extendable – in multiples of 7 bits

  • The unique address (11111111) (single octet) is used by the primary to broadcast to all secondary stations

Extended Address Field

‘1’ marks last octet of extendible address

Hdlc frame structure control field
HDLC Frame Structure – Control Field

Frame Type:

Extended frame sequence #s

(7 instead of 3 bits)

  • Poll/Final (P/F) bit:

    • In command frames (P): used to solicit response from peer entity

    • In response frames (F): indicate response is the result of soliciting command


Allows Piggybacking

Why N(R) on an I frame?

ACKs such as:


Additional link

control functions

I or not

S or U

Hdlc frame structure information fcs fields
HDLC Frame Structure – Information/FCS Fields

  • Information field: (in I and U frames only)

    • Present ONLY in I-frames (user data) and some U-frames (link management data)

    • Contains an integer number of octets (bytes)

    • Variable number of octets – up to some system defined maximum

m bytes

Hdlc frame structure information fcs fields1
HDLC Frame Structure – Information/FCS Fields

  • FCS field:

    • CRC Error detection code

    • Calculated from ALL remaining bits in frame (excluding the two flags)

    • Normally 16 bits: (F is 1-bit shorter than P)

      - (CRC-CCITT polynomial = X16+X12+X5+1), or

      - 32-bit optional FCS using CRC-32

Hdlc operation
HDLC – Operation

  • HDLC Operation: Exchange of I-frames, S-frames, and U-frames between two stations

  • Table 7.1 (slide 69) lists types of Control/Response functions for various frame types

  • The operations of HDLC involve three phases:

    • Link Setup or Initialization (by either side):U-Frames

      • Both agree on various options

    • Actual Data Transfer (by the two sides): I- and S-Frames

      • Exchange of user data and control info for flow and error control

    • Link Disconnect (by either side): U-Frames

      • Indicating termination of operation

Hdlc operation1
HDLC – Operation

1. Initialization (Link Setup)

2. Data Transfer,

3. Link Disconnect

  • “A” issues one of 6 set mode commands: and sets a timer:

    SNRM, SARM, SABM (k = 3 bits: Modulo 8 frame sequencing)  8-bit control field


    SNRME, SARME, SABME (k = 7 bits: Modulo 128 frame sequencing)  16-bit control field

  • B responds with either:

    • UA (Unnumbered ACK) (if it agrees), or:

    • or DM (Disconnect mode) (if request is rejected)

  • A receives the UA, initializes its variables for data exchange, and data exchange begins

  • After finishing: to disconnect, A or B send DISC command

  • B responds with UA. Any outstanding unACKed I-frames may be lost. These can be recovered by higher layers

1. Link Setup

2. DataTransfer

3. Link Disconnect

SABME: Set Asynchronous balanced/extended mode;7-bit frame sequence

Hdlc operation2
HDLC – Operation

Normal Data Transfer:

  • Once initialization is complete, a logical path is established.

  • Both sides start sending I-frames (Full-duplex exchange) starting with sequence number 0

  • N(S), N(R) are sequence numbers to support flow and error control in the send and receive directions, respectively

  • N(R) is the ACK for the I-frame received; it allows the HDLC module to indicate the I-frame number it expects to receive next (Note: No control function used for this positive ACK- understood by default as RR)

  • When no reverse user data (I-frame) needs to be sent, a dedicated RR should be sent on an S-frame

  • If no new acknowledgement needs to be sent, the last N(R) value is repeated


Repeat N(R)

if no new Fs






Hdlc operation3
HDLC – Operation


  • Busy condition: Note use of P/F bit

    • When A is unable to keep up with the speed of the transmitter “B” or buffer is full

    • A sends RNR, to halt transmission from B

    • To check the readiness of A, B periodically sends RR frame with P set

    • Once the busy condition is cleared at A, it responds with an RR and F=1

    • An RR with F set indicates it is a response to a previous polling using RR, P

At last !!

B sending 4 and

waiting for 0

Hdlc operation4
HDLC – Operation

  • Reject Recovery:

    • I-frame 4 was lost

    • B receives I-frame 5 (out of order) – responds with REJ 4

    • A resends I-frame 4 and all subsequent frames previously sent


For any – ive ACK must use an S-Frame!

Hdlc operation5
HDLC – Operation

  • Timeout Recovery:

    • A sends I-frame 3 – but it is lost

    • Timer expires before acknowledgement arrives

    • A polls B with RR, P = 1

    • B responds with RR, F =1, indicating it is still waiting for frame 3

    • A responds by retransmitting I-frame 3

    • This time it gets a + ive ACK from B