Professional Documents
Culture Documents
COE341 Chapter07 T062
COE341 Chapter07 T062
= = = =
= = = =
< +
+
COE 341 Dr. Marwan Abu-Amara 47
Sliding Window Efficiency: Example
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
200-m optical fiber link
Data rate, R = 1 Gbps
Typical wave velocity, V = 2 x 10
8
m/s
Frame TX time, t
f
= L/R = 8 s
Propagation time, t
prop
= d/V = 1 s
a = t
prop
/ t
f
= 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)
Satellite link between 2 ground stations
d = 2 x 36,000 km, Data rate, R = 1 Mbps
Typical wave velocity, V = 3 x 10
8
m/s
Frame TX time, t
f
= L/R = 8 ms
Propagation time, t
prop
= d/V = 240 ms
a = t
prop
/ t
f
= 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 and buffer sizes)
For k = 3 bits, W = 7:
Utilization U = W/(2a+1) = 7/(61)
= 11.5% > 1.6% for Stop and wait.
COE 341 Dr. Marwan Abu-Amara 48
Stop-and-Wait & Sliding Window as Flow
Control Protocols
Problem:
Qualitatively explain how the Stop-and-Wait and
the Sliding Window protocols could be used for
flow control
Hint:
Think about the use of ACK and when the RX could
send it back to the TX
COE 341 Dr. Marwan Abu-Amara 49
High-Level Data Link Control Protocol (HDLC)
One of the most important data link control protocols
and it is the basis for many data link control protocols.
The job of the HDLC layer (Link Layer, Layer 2) is to
ensure that data passed up to the next layer has
been received exactly as transmitted (i.e error free,
without loss and in the correct order)
Another important job is flow control, which ensures
that data is transmitted only as fast as the receiver
can receive it.
There are two distinct HDLC implementations
HDLC NRM (see (SDLC), and
HDLC Link Access Procedure Balanced (LAPB)
Usually when referring to HDLC people mean LAPB
or some variation
COE 341 Dr. Marwan Abu-Amara 50
High-Level Data Link Control Protocol (HDLC)
To satisfy a variety of applications, HDLC defines
three types of stations, two link configurations, and
three types of data transfer modes of operation.
Station types:
Primary Station (PS):
Responsible for controlling the operation of the link
Frames issued by the PS are called commands
Secondary Station (SS): Frames issued by the SS are called
responses operates under the control of a primary station
Combined Station: issues commands and responses
Link configurations:
Unbalanced: one primary plus one or more secondary
Balanced: two combined stations
COE 341 Dr. Marwan Abu-Amara 51
High-Level Data Link Control Protocol (HDLC)
Transfer modes:
Normal Response Mode (NRM) used in
unbalanced config.; secondary may only tx data in
response to a command from primary
Asynchronous Response Mode (ARM) used in
unbalanced config.; Secondary may initiate data tx
without explicit permission; primary still retains line
control (initialization, error recovery, )
Asynchronous Balanced Mode (ABM) used in
balanced config.; either combined station may tx
data without receiving permission from other station
Animation for HDLC
COE 341 Dr. Marwan Abu-Amara 52
HDLC Applications
NRM:
Point-multipoint (multi-drop line): one computer
(primary) polls multiple terminals (secondary
stations)
number of terminals are connected to a host computer
ARM: rarely used
ABM: most widely used (no polling involved)
Full duplex point-to-point
COE 341 Dr. Marwan Abu-Amara 53
HDLC NRM
COE 341 Dr. Marwan Abu-Amara 54
HDLC ABM
COE 341 Dr. Marwan Abu-Amara 55
HDLC Frame Structure
COE 341 Dr. Marwan Abu-Amara 56
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 in Header and trailer
Address:
Size: 1 Byte (or more 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
Used for error & flow control
Information:
Size: Varies from network to network. Always fixed within a network
Contains user data from Network layer or Network Management information
FCS:
Size: 2 or 4 Bytes
Implements ITU-T CRC for error detection
COE 341 Dr. Marwan Abu-Amara 57
HDLC Frame Structure Flag Field
Flag Field: unique pattern 01111110
Used for synchronization
To prevent this pattern form occurring in data bit stuffing
procedure is used
Tx-er inserts a 0 after each 5 1s
Rx-er, after detecting flag, monitors incoming bits when a pattern of
5 1s appears; the 6
th
/7
th
bit are checked:
If 0, it is deleted
If 10, this is a flag
If 11, this is an ABORT
Pitfalls of bit stuffing: one bit errors can split one frame into two or
merge two frames into one
COE 341 Dr. Marwan Abu-Amara 58
HDLC Data Transparency
If the data field of an HDLC frame contains a
pattern identical to the flag pattern (01111110),
the RX will interpret it as end-of-frame flag
Next bits will be considered part of the next frame
This is called lack of Transparency
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
COE 341 Dr. Marwan Abu-Amara 59
HDLC Bit Stuffing & Removal
COE 341 Dr. Marwan Abu-Amara 60
HDLC Bit Stuffing
Problems: With bit stuffing, Single-bit errors could
split a frame into 2 or merge two frames into 1.
01111100
(Bit stuffed)
(Bit stuffed)
01111110
Frame
Splitting
Frame
Merging
01111110
01111100
COE 341 Dr. Marwan Abu-Amara 61
HDLC Frame Structure Address Field
Address field identifies the secondary station that
transmitted or is to receive frame
Not used (but included for uniformity) for point-to-point
links
Extendable by prior arrangement
Address = 11111111 (single octet) used by the primary
to broadcast to all secondary stations
Extended Address Field
COE 341 Dr. Marwan Abu-Amara 62
HDLC Frame Structure Control Field
Three types of frames: I, S, and U
Information frame (I): carry user data (upper layers) flow and error control info
is piggybacked on these frames as well
Supervisory frame (S): carry flow and error control info when piggybacking is not
used
Unnumbered frame (U): provide supplementary link control
First 2 bits of the control field determine the type of frame, the remaining are
organized as shown in figure 7.7.c and d (next slide)
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
COE 341 Dr. Marwan Abu-Amara 63
HDLC Frame Structure Control Field
Extension of sequence number
7-bit sequence numbers rather than 3-bit ones
Set-mode command extends control field to 16 bit
for S and I frames
Unnumbered frames always use 8-bit
COE 341 Dr. Marwan Abu-Amara 64
HDLC Frame Structure Information/FCS Fields
Information field:
Present ONLY in I-frames and some U-frames
Contains integer number of octets
Length is variable up to some system defined maximum
FCS field:
CRC error detecting code
Calculated from ALL remaining bits in frame (excluding flag
field)
Normally 16 bits (CRC-CCITT polynomial = X
16
+X
12
+X
5
+1), or
32-bit optional FCS using CRC-32
COE 341 Dr. Marwan Abu-Amara 65
HDLC Frames
HDLC uses Synchronous transmission
HDLC defines three types of frames
Information frames (I-frames)
Used to transport user data and user control information
relating to the user data (e.g. piggybacking)
Supervisory frames (S-frames)
Used to transport control information only
Unnumbered frames (U-frames)
Used in the link management
COE 341 Dr. Marwan Abu-Amara 66
HDLC Generic Frame Format
Indicates that the first
transmitted field is the Header
flag, then the address, then the
control
Header
Trailer
COE 341 Dr. Marwan Abu-Amara 67
HDLC I, S & U Frames Format
COE 341 Dr. Marwan Abu-Amara 68
HDLC I-Frames
I-frames are designed to carry user data from
Network-layer
They can include flow & error control information
(piggybacking)
The bits of the I-frame Control field are:
First bit is always 0. It means it is an I-frame
Next 3-bits, called N(S), define the sequence of the frame
So possible sequences 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
When a secondary station responds to a poll, it sets this bit to 1
Next 3-bits, called N(R), define the value of the ACK when
piggybacking is used
COE 341 Dr. Marwan Abu-Amara 69
HDLC I-Frames
COE 341 Dr. Marwan Abu-Amara 70
HDLC S-Frames
COE 341 Dr. Marwan Abu-Amara 71
HDLC U-Frames
COE 341 Dr. Marwan Abu-Amara 72
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
COE 341 Dr. Marwan Abu-Amara 73
HDLC Operation
HDLC operation consists of the exchange of I-
frames, S-frames, and U-frames between two
stations.
Table 7.1 list types of Control/Response
functions for various frame types
The operations of HDLC involve three phases:
Initialization (by either side): U-Frames
Both agree on various options
Data Transfer (by the two sides): I- and S-Frames
Exchange of user data and control info for flow and error
control
Disconnect (by either side): U-Frames
Signaling termination of operation
COE 341 Dr. Marwan Abu-Amara 74
HDLC Operation
Initialization:
(Link Setup & Disconnect)
Issue SABME command and starts timer
B responds with UA (or DM if request is
rejected)
A receives UA and initializes its variables
To disconnect: issue DISC command
Followed by UA
SABME: Set Asynchronous balanced/extended mode;7-bit sequence
COE 341 Dr. Marwan Abu-Amara 75
HDLC Operation
Data Transfer:
Once initialization is complete a logical path is
established.
Both sides start to send I-frames (Full-duplex
exchange) starting with seq. number 0
N(S), N(R) both are seq. number to support
flow and error control
N(R) is the ACK for the I-frame received; it
enables the HDLC module to indicate which
number I-frame it expect to receive next.
RR is used (S-frame) when there is no
reverse user data (I-frame) traffic
COE 341 Dr. Marwan Abu-Amara 76
HDLC Operation
Disconnect:
Either side can issue a DISC frame
to request disconnect
The remote entity MUST accept
the request by sending UA.
Any outstanding I-frame will be
lost.
Busy condition: Notice the 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 the
transmission of B
To check the readiness of A,
periodically B sends RR frame with
P set.
Once the condition of being busy is
cleared A responds with F=1
COE 341 Dr. Marwan Abu-Amara 77
HDLC Operation
Reject Recovery:
I-frame 4 was lost
B receives I-frame 5 (out of
order) responds with REJ 4
A resend I-frame 4 and all
subsequent frames (Go-back-N)
Timeout Recovery:
A sends I-frame 3 but it is lost
Timer expires before
acknowledgement arrives
A polls Node B
B responds indicating it is still
waiting for frame 3 B set the F
bit because this a response to
As solicitation
COE 341 Dr. Marwan Abu-Amara 78
HDLC Example: Piggybacking w/o Errors
Next slide shows an exchange using piggybacking when
there 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 of its own
Station Bs first I-frame is also numbered 0 [N(S) field] and
contains a 2 in its N(R) field, acknowledging the receipt of
As frames 1 and 0 and indicating that it expects frame 2 to
arrive next
Station B transmits its second and third I-frames
(numbered 1 and 2) before accepting further frames from
station A
Its N(R) information, therefore, has not changed: B frames 1 and 2
indicate that station B is still expecting As frame 2 to arrive next
COE 341 Dr. Marwan Abu-Amara 79
HDLC Example: Piggybacking w/o Errors
COE 341 Dr. Marwan Abu-Amara 80
HDLC Example: Piggybacking with Errors
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
Next slide shows the exchange
COE 341 Dr. Marwan Abu-Amara 81
HDLC Example: Piggybacking with Errors