transmitted in a retransmission list using FIFO S returns an ACK for each correctly received I‐frame Each I‐frame contains a unique identifier which is returned is the On receipt of the
Trang 1Data Communication
and Networ
1
Trang 2Cont ent
Chapter 3: Data Link
2
Trang 3Framing
The data link layer needs to
pack bits into frames, that each frame is s o
Trang 4Flow and Error
Control responsibilities of the data link The most important
layer are flow control and error
control Collectively,
these functions are known as data link control.
procedures used to restrict the amount of data that the sender can send before
waiting for acknowledgment.
based on automatic repeat request, which is the retransmission of data.
can combine framing,
flow control, and error control to
achieve the delivery of data
from one node to another The
protocols are normally
4
Trang 5Error
Control Forward Error Control (FEC)Usually used in real‐time
application (e.g voice, video)
Error Detection + ARQ (Automatic Retransmission
transmission
email, file
transmission)
– Go‐back N: e.g HDLC, V.42 – Selective‐Repeat: TCP, Service Specific Connection Oriented
Request)
5
Trang 6I ‐ Notations
fram e
I frame: data/Information frame
I(N): Data frame with sequence N
sendi
response/reply sent from S back to
P, confirm receiving a good I‐frame
NAK (Negative Acknowledge) frame: response/reply sent
6
Trang 77
Trang 88
Trang 9Idle RQ
Advantages :
(Stop and Wait)
9
Trang 10U
= Tt T1+2Tix +2Tp
p /T ix 1+2a
Total average delay
per frame?Telecomm
1 0
Trang 11RQ
order to transmit 1 I‐
frame successfully, sender needs to
Probability that i transmission are
needed to deliver frame
successfully ( i‐1 transmission
in error and the
Trang 121 2
Trang 13Idle‐RQ:
Example be transmitted using A series of 1000‐bit frames is to
an idle RQ protocol Determine the link utilization for
the following types of data link
Solutio
Trang 14send and acknowledge data
Piggy back methods:
header of information frames
from a data frame and an ACKframe (addresses, CRC, etc) can be
1 4
Trang 15us RQ
Continuous RQ improves the link utilization at the expense of
increased buffer storage requirements.
transmitted in a retransmission list (using FIFO)
S returns an ACK for each correctly received I‐frame
Each I‐frame contains a unique identifier which is returned is the
On receipt of the next in‐sequence I‐frame expected, S delivers the
information content within the frame to the upper layer
1 5
Trang 161 6
Trang 17Continuous
RQ utilization of In the absent of errors, the link
continuous RQ is approximately
100%
When errors occur:
S detects and requests the retransmission of just those
frames in the sequence that are corrupted: Selective
Repeat
S detects the receipt of an out‐of‐sequence I‐frame
and requests P to retransmit all outstanding unacknowledged
Trang 18Continuous
RQ implemented in 2 ways: Selective Repeat: can be
S acknowledges correctly received frames and P
determines from the sequence of ACK‐frames
received that a frame has been lost: implicit
retransmission
for a frameseque that is missing from the
nce: expli cit requ est
1 8
Trang 19Continuous
RQ
Assume I‐frame N+1 is corrupted
S returns a ACK for each correctly received I‐frame as before
S returns ACK‐frame for I‐frames N,N+2,N+3,…
On receipt of ACK for I‐frame N+2, P detects that frame N+1 has not been acknowledged
To allow for the possibility of more than one I‐frame being corrupted,
on detecting an unacknowledged frame P enter the retransmission
state.
When in this state, the transmission of the new frames is suspended until all unacknowledged frames have been retransmitted
P removes I‐frame N+2 from the retransmission list and retransmits I‐
frame N+1 before transmitting frame N+5
On receipt of I‐frame N+1, the contents of the queued frames in the link receive list are delivered by S
Trang 202 0
Trang 21ves the frame from the retransmission list.
Trang 222 2
Trang 23 An ACK acknowledges all frames in the
retransmission list up to and
including the I‐frame with the sequence number the ACK contains
Assume I‐frame N+1 is corrupted
S returns an ACK for I‐frame N
When S receives I‐frame N+2 it detects I‐frame N+1 is missing and hence
returns a NAK containing the identifier of the
missing I‐frame N+1
On receipt of NAK N+1, P interprets this as S is still awaiting I‐frame N+1
and hence retransmits it
When S returns a NAK, it enters the
2 3
Trang 242 4
Trang 252 5
Trang 26In many application, frames must be
delivered in order Hence,
2 6
Trang 27Continuous
RQ
Go‐back‐N: the secondary detects an out‐of‐order
sequence frame, it informs
the primary to start to retransmit frames from a
specified frame number It
does this be returning a special NAK frame known
Assume I‐frame N+1 is corrupted
S receives I‐frame N+2 out of sequence
On receipt of I‐frame N+2, S returns NAK N+1
informing P to go back and
start retransmit from I‐frame N+1
On receipt of NAK N+1, P enters the
retransmission state
When in this state, it suspends sending new
frames and starts to retransmit
the frames waiting acknowledgement in the
retransmission list
S discards frames until it receives I‐frame N+1
On receipt of I‐frame N+1, S resumes accepting frames and returning
acknowledgements
A timeout is applied to NAK frames by S and a
second NAK is returned if
2 7
Trang 282 8
Trang 292 9
Trang 30Continuous
RQ Link Utilization: In general, the link utilization U
for a send window K:
Using Selective Repeat:
3 0
Trang 31•
Trang 32Example of sliding window
A series of 1000‐bit frames is to
be transmitted using
a continuous RQ protocol
Determine the link
efficiency for the following type of data link if the
velocity of propagation is 2.108
m/s and the bit error
rates of the links are all negligibly low:
3 2
Trang 33Example of link utilization
A series of 1000‐bit frames is to
Trang 34Time out
expires, the frame is retransmitted
The timeout interval must be greater than the worst‐case
propagation delay between transmitting a frame and receiving the associated ACK
S may receive multiple copies due to corrupted ACK‐frames
• With Go‐back‐N: this is not the problem The N(S) in
the duplicate frames will not equal to the current V(R) held by S and will be discarded
• With Selective Repeat: S retains a ordered list of the
last N correctly received I‐frames In this way, S can check if a received frame is a duplicate of an already correctly received frame or a new frame.
3 4
Trang 35Timeout
Trang 36 Control the data transmission rates of characters or Flow control
frames on a link so that the receiver always has
sufficient buffer storage resources to accept them prior
to processing
Two kinds: X‐ON/X‐OFF and Sliding Window
When the receive buffer at S is overflowed, S sends X‐OFF
back to P, P stops the data
transmission
When S escape the overload state, it will return X‐ON to P
to inform its ready state for receiving data P will continue
3 6
Trang 37 Sliding Flow control
window: Send window size
(K): define
the maximum number
of frames can be
transmitted Has UWE and LWE
to control the window
length Receive window: the maximum number
of frame buffers
3 7
Trang 38Sequence
Number All previous example: assuming that the next frame sequence
is simply equal to the last sequence + 1: sequence number go
to infinitive
Need to define the maximum limit on
the number of I‐frames
being transferred across a link: limit the size of the link
retransmission and receive list, and limit the range of
sequence numbers to define frames
uniquely
Idle RQ: both send and receive window are
1 Hence 2 identifiers are required to allow S to determine the last I‐
frame and the new I‐frame.
Go‐back‐N: send window is K: the identifier
must be K+1.
Selective Repeat: send and receive windows
are K Hence the
identifiers must not be less than 2K
3 8
Trang 39P times‐out each I‐frame
and retransmits them
S discards each duplicate
I‐frame and returns a
NAK
indicating I(3) is the next
frame
Since the sequence
number in the NAK is
equal to V(S), P takes this
3 9
Trang 40 In practice, since the
identifier of a frame is in
binary form, a set number of
binary digits must be
reserved for its use.
For example, with a send
window of 7 and Go‐back‐N
is
used, 2 binary digits are
required for the send and
receive sequence numbers
yielding 8 possible
identifiers:
0 7 The send and receive
sequence variables are then
4 0
Trang 41Sequence
wind ow edge
Window
wind ow edge
tx 1 frame
receive ACK0
max window size
max
window
Trang 424 2
Trang 43Data Link Control Protocols The data link control layer is concerned with the transfer of data
over a serial data link
The link can be:
point‐to‐point physical circuit (twisted‐pair
wire, coaxial cable or optical fiber),
radio‐based channel (satellite, or logical
channels over physical circuits)
Trang 44Data Link Protocol
Application DTE DTE DTE: Data Terminal EquipmentDLP: Data Link Protocol
DCE: Data Circuit Terminating Equipment
: Communication Subsystem
PSTN
Modem Modem
4 4
DLP
Trang 45Data Link Protocol
DLP
Share bus
DLP
Trang 46transmission:•• Half‐duplex protocol: BSC
Full‐duplex protocol: APRANET IMP‐to‐IMP protocol
High‐level Data Link Control: single link procedure
Link access procedure version B (LAPB): extension of LAPA, used in
X.25 networks
Multilink procedure: extension of LAPB
Link access procedure for modems (LAPM): used in error
correction modems (e.g V32)
Link access procedure for D‐channel (LAPD): used in ISDN networks
4 6
Trang 47Binary Synchronous
Communication
BSC Protocol:
Character‐oriented
Error control: Idle RQ
Synchronous transmission control
Connection‐oriented
Half‐duplex
Topology: Poin‐to‐point, Multipoint, Multi‐drop
network
(DLE/STX,
Frame formats
DLE/ETX)
Trang 484 8
Trang 49structure of
Multi-frame
Data
Last frame Data
SOH – Start of Header STX – Start of Text ETX – End of Text
ETB – End of Tranmission Block
BCC – Block (sum) Check Character
ETX BCC SYN SYN SOH Header STX
ETB BCC SYN SYN SOH Header STX
ETX BCC IBT BCC STX
SYN SYN SOH Header STX
ETX BCC SYN SYN SOH Header
ETX BCC SYN SYN STX
Trang 50one or other is returned to
a previously transmitted data block and hence
contains an sequence number.
AS a response to
a select
control message:
an ACK indicates that the selected
station is able to receive a
data block whereas a NAK
5 0
Trang 51Binary Synchronous
Communication
both Poll and Select
control frames The address of the
polled or selected slave
station is followed by either a P (for
Poll) or an S( for Select)
character, which is in turn followed by the ENQ character
message exchangesequence and clear the logical link between the 2
communicating parties
• To provides
amea
ns of resetting the link to the idle state
Trang 525 2
Trang 53performance: Low link utilization (Idle RQ),
used with multi‐
Trang 54Exam ple
A BSC protocol is to be used to control the flow of messages between a
computer (Master station) and 10 block‐mode
terminals (secondaries) over
a multipoint data link The link data rate, R, is 10
kbps and the average
length of a message, N i, is 1000 bits If a poll message and its associated ACK is 30 bits and the total time to process these messages is 1ms,
determine the average time each terminal will be polled if the average rate
at which messages are generated is:
1 message per minute
6 message per second
The bit error rate and signal propagation delay
times of the link can be
5 4
Trang 55 High‐level Data Link HDLC
Variations: LAPB, LAPD,LAPM
Used in Frame Relay, PPP
Controlled by Primary station
Send the response frames
Combined station (Both Primary
5 5
Trang 56by the master (primary) station.
The link may be point‐to‐point, multipoint (only 1 primary allowed)
•
Asynchronous
Response Mode (ARM)•• Used in unbalanced configuration
Allow a secondary to initiate a transmission without receiving permission from the primary Normally used in point‐to‐point configuration and duplex links
•
Asynchronous Balanced Mode (ABM)
• Mainly used on duplex point‐to‐point links
• Each station has an equal status and performs both primary and
5 6
Trang 57HD LC
Frame formats: both data and control messages are
carried in a standard format
determine the beginning and
the end of a frame
Receiver must hunt this value
If the next bit is bit 1, and 7th bit is bit 1: continue
to count number of bits 1–– If number of bits 1<15:
receiver stops
If number of bits 1>=15:
Trang 58HDLC
Address Field:
NRM mode, multidropline: each station has 1 unique
address If the primary
wants to connect with the slave, it will put the slave
address in this address field Certain
point) Instead, it is used
to indicate the direction of commands and their associated
responses
octet will have the first bit equal to 1
5 8
Trang 59HDLC
Control field: There are 3
frame types in HDLC: Unnumbered frames (U—frame): used for such functions as link setup
and disconnection They do not contain any
acknowledgement
information
Information frame (I‐frame): carry the actual
information I‐frames can
be used to piggyback acknowledgement
information if the operational
mode is ABM or ARM
Supervisory frame (S‐frame): are used for
error and flow control and
hence contain send and receive sequence
5 9
Trang 60HD LC
P/F: Poll or Select
depending on• • Command: bit P, request the response from a secondaryResponse: bit F, indicating this is the the context:
response to a command
0 0 1 0 0 1 1 1
6 0
Trang 61HDLC
Trang 626 2
Trang 646 4
Trang 65HD LC
Trang 666 6
Trang 67frames onto an I‐frame of its own
Node B’s first I‐
frame is also numbered 0 [N(S)
field] and contains a
2 in its N(R) field, acknowledging
the receipt of A’s
frames 1 and 0 and indicating that
it expects frame 2
to arrive next Node B transmits its
second and third
I‐frames (numbered 1 and 2)
indicate that node B is still
expecting A’s frame 2 to
arrive next Node A has sent all its
data Therefore, it
cannot piggyback an
acknowledgment onto an I‐
frame and sends an S‐frame
instead The RR code
indicates that A is still ready to
receive The number
3 in the N(R) field tells B that
frames 0, 1, and 2 have
all been accepted and that A is
6 7
Trang 68HD LC
errors: Example: an exchange in which a frame is
lost Node B sends three data
frames (0, 1,
and 2), but frame 1 is lost.
When node A receives frame
2, it discards it
and sends a REJ frame for
frame 1 Note that
the protocol being used is
Go‐Back‐N with
the special use of an REJ
frame as a NAK
frame The NAK frame does
two things here:
It confirms the receipt of
frame 0 and
declares that frame 1 and any
following
frames must be resent.
Node B, after receiving the
6 8
Trang 69 So HDLC
me other cases: