1 Prof. Sang-Jo Yoo 7. Data Link Control. Prof. Sang-Jo Yoo 2 Data Link Layer Functions Frame...

46
1 Prof. Sang-Jo Yoo 7. D 7. D ata Link Control ata Link Control

Transcript of 1 Prof. Sang-Jo Yoo 7. Data Link Control. Prof. Sang-Jo Yoo 2 Data Link Layer Functions Frame...

1

Prof. Sang-Jo Yoo

7. D7. Data Link Controlata Link Control

2

Prof. Sang-Jo Yoo

Data Link Layer FunctionsData Link Layer Functions Frame Synchronization Flow Control

Control rate of transmission to prevent over-run

Error Control Correct transmission errors ( by retransmission )

Addressing When many nodes share transmission link

Link Management Initiation, maintenance, and termination of connections

3

Prof. Sang-Jo Yoo

Flow ControlFlow Control

Definition Technique for controlling data rate so that sender does not over-

run receiver

Method Stop-and-Wait Sliding-Window

4

Prof. Sang-Jo Yoo

Flow Control Stop-and-WaitFlow Control Stop-and-Wait

“Stop-and-Wait” flow control Sender sends a frame Receiver receives frame & acknowledge it Sender waits to receive “ack” before sending next frame.(If

receiver is not ready to receive another frame it holds back the ack)

Efficient for large blocks Many small bocks are used, because

Receiver buffer limits Error control Fair sharing of medium.

5

Prof. Sang-Jo Yoo

Flow Control Stop-and-WaitFlow Control Stop-and-Wait

T Rt0

T R

t0+a T R

T R

T R

T Rt0

T R

T R

T R

T R

t0+1

t0+1+a

t0+1+2a

t0+a

t0+1

t0+1+a

t0+1+2a

The effect of a utilization

1<a 1>a

timeonTransmissi

timenPropagatioa

6

Prof. Sang-Jo Yoo

Flow Control Sliding-WindowFlow Control Sliding-Window

“Sliding-Widow” flow control Pipeline transmission of successive frames Transmit up to “N” frames if necessary without receiving acks Wait for acks when “N” unacked frames in transit Acknowledge multiple frames For duplex transmission each station needs a sending widow &

receiving widow

7

Prof. Sang-Jo Yoo

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Frames aleady transmittedWindow of frames that

may be transmitted

Window Shrinksfrom tailing edge

as frames are sent

Window expands from leading edge as acknowledgements are

received

framesequencenumber

lastframe

transmitted

... ...

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

Frames aleady receivedWindow of frames that

may be transmitted

Window Shrinksfrom tailing edge

as frames are received

Window expandsfrom leading edge

as acknowledgements are sent

lastframe

acknowledgement

... ...

(a) Transmitter's Perspective

(b) Receiver's Perspective

Flow Control Sliding-WindowFlow Control Sliding-Window

8

Prof. Sang-Jo Yoo

Flow Control Sliding-WindowFlow Control Sliding-Window

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7

F0

F1

RR3

F2

F3

F4

F5

F6

RR4

Examples of a sliding-window protocol

9

Prof. Sang-Jo Yoo

Error DetectionError Detection

Basic principle Transmitter : For a given bit stream M, additional bits( called

error-detecting code ) are calculated as a function of M and appended to the end of M

Receiver : For each incoming frame, perform the same calculation and compares the two results. A detected error occurs iff there is a mismatch

DATA

E=f(DATA)

E DATA

E=f(DATA)

E

Transmitter

Receiver

Compare

10

Prof. Sang-Jo Yoo

Error DetectionError Detection

Two common techniques Parity checks Cyclic redundancy checks ( CRC )

Parity check One extra “parity” bit is added to each word

Odd parity : bit added so as to make # of 1 odd Even parity : bit added so as to make # of 1 even

10100101 11100101

Can detect 1 bit inversion. Single parity is very effective with white noise, but not very robust

with noise bursts

11

Prof. Sang-Jo Yoo

Error DetectionError Detection

Cyclic redundancy checks Powerful error detection method, easily implemented Message(M) to be transmitted is appended with extra frame

checksum bits(F), so that bit pattern transmitted(T) is perfectly divisible by a special “generator” pattern(P)

As destination, divide received message by the same P. If remainder is nonzero then error is occurred

Let T = (k+n) bit frame to be transmitted, n<k M = k bit message, the first k bits of T F = n bit FCS, the last n bits of T P = n+1 bits, generator pattern ( predetermined divisor )

Use modulo-2 arithmetic : no carries/borrows, add=subtract=xor

12

Prof. Sang-Jo Yoo

Error DetectionError Detection

Method Extend M with n ‘0’s to the right ( =2nM ) Divide extended message by P to get R ( 2nM/P = Q+R/P ) Add R to extended message to form T ( T= 2nM+R )

Transmit T At receiver, divide T by P. If non-zero remainder, then error

QP

RRQ

P

R

P

RQ

P

RM

P

T n

2

13

Prof. Sang-Jo Yoo

Error DetectionError Detection

Example M=110011, P=11001,

R=4bits Append 4 zeros to M, we get

1100011000 Divide 1100011000/11001 Append remainder T=1100111001

1 1 0 0 1 1 0 0 0 01 1 0 0 11 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 1

1 0 0 0 0 1

14

Prof. Sang-Jo Yoo

Error DetectionError Detection

We can view CRC generation in terms of polynomial arithmetic Any bit pattern = polynomial in dummy variable X

e.g. M=110011 M(X)=X5+X4+X+1 CRC generation in terms of polynomial

Append n ‘0’s : Modulo 2 division : Transmit : At receiver :

Commonly used polynomials, P(X) CRC-16 : CRC-CCITT : CRC-32 :

)(

)()(

)(

)(

XP

XRXQ

XP

XMX n

)(XMX n

)()()( XTXRXMX n

)(

)()(

)(

)(

)(

)(

)(

)()(

XP

XRXQ

XP

XR

XP

XMX

XP

XRXMX nn

1245781011121622232632 XXXXXXXXXXXXXX

151216 XXX

151516 XXX

15

Prof. Sang-Jo Yoo

Error DetectionError Detection

Following errors can be detectable: All single-bit errors All double-bit errors, as long as P(X) has at least three 1s. Any odd number of errors, as long as P(X) contains a factor (X+1) Any burst errors for which the length of the burst is less than the

length of the FCS Most larger burst errors.

16

Prof. Sang-Jo Yoo

Error DetectionError Detection

Implementation Implemented by a circuit consisting of exclusive-or gates and a shift

register The shift register contain n bits ( length of FCS ) There are up to n exclusive-or gates The presence or absence of a gate corresponds to the presence or

absence of a term in P(X)

17

Prof. Sang-Jo Yoo

Error DetectionError Detection

Circuits with shift registers for dividing by the

polynomial X5+X4+ X2+1

18

Prof. Sang-Jo Yoo

Error ControlError Control

Error control techniques Forward error control

Forward error correction ( FEC ) Error recovery by correction at the receiver

Backward error control Automatic repeat request ( ARQ ) Error recovery by retransmission

Error Lost frame Damaged frame

19

Prof. Sang-Jo Yoo

Error ControlError Control

Bases of ARQ Error detection Positive ACK Retransmission after timeout Negative ACK. and retransmission

20

Prof. Sang-Jo Yoo

Error ControlError Control

Class of ARQ Stop-and-Wait ARQ Continuous ARQ (sliding window flow control)

Go-Back-N ARQ Selective-reject ARQ

Stop-and-Wait ARQ Sender transmits message frame Receiver checks received frame for errors ; sends ACK/NAK Sender wait for ACK/NAK

NAK : Retransmission ACK : Next Frame

Simple and minimum buffer requirement, but inefficient

21

Prof. Sang-Jo Yoo

Error ControlError Control

Frame/ACK could be lost : Uses a timeout mechanism

Possibility of duplication : Number of frames

Only need a 1-bit frame number alternating 1 and 0

22

Prof. Sang-Jo Yoo

Error ControlError Control

Go-back-N ARQ If the receiver detects an error on a frame, it sends a NAK for that

frame. The receiver will discard all future frames until the frame in error

is correctly received The sender, when it receives a NAK or timeout, must retransmit

the frame in error plus all succeeding frames. Sender must maintain a copy of each unacknowledged frame

23

Prof. Sang-Jo Yoo

Error ControlError Control

24

Prof. Sang-Jo Yoo

Error ControlError Control

Selective-Reject ARQ The only frames retransmitted are those that receive a NAK or

which timeout Can save retransmission, but requires more buffer space and

complicated logic

Maximum window size ( with n-bit sequence number ) Go-back-N : 2n-1 Selective-reject : 2n-1

25

Prof. Sang-Jo Yoo

Error ControlError Control

Why 2n-1 instead of in 2n Go-back-N ?

S R0

1

2

7

0

ACK1

ACK1

•••

Question: Did all eight frames arrive successfully, or did all eight frames get lost (or errors)?

In both cases the receiver would send ACK1.

26

Prof. Sang-Jo Yoo

Error ControlError Control

Why 2n-1 instead of 2n-1 in selective-reject?

S R0

1 ACK1

•••

6

0

ACK2

ACK7Retransmission

frame 0

At this point receiver has already advanced its window to accept frames 7, 0, 1, 2, 3, 4, 5. Thus it assumes that frame 7 has been lost and that this is a new frame 0, so it accepts.

There should be no overlap between the sender and receiver windows. Max window size 2n/2

0 1 2 3 4 5 6 70

0 1 2 3 4 5 6 7 0 1

27

Prof. Sang-Jo Yoo

HDLC and Other HDLC and Other Data Link Layer ProtocolsData Link Layer Protocols

28

Prof. Sang-Jo Yoo

ContentsContents

Review - Data Link Layer Functions HDLC (High-level Data Link Control)

Basic Characteristics Frame Structures Operations

Other Data Link Layer Protocols LAPB LAPD LLC Frame Relay ATM

29

Prof. Sang-Jo Yoo

Review - Data Link Layer Review - Data Link Layer Functions(1)Functions(1)

Protocol View Link layer protocol must

provide the followingfunctions to the upperlayer.

(1) Initial setup of the link

(2) ordered exchange of data blocks

(3) orderly release of the link

Calling station Called station

UserSoftware

UserSoftware

LinkLayer

LinkLayer

CONNECT.request

CONNECT.confirm

CONNECT.indication

DATA.request

DATA.indication

DATA.indication

DATA.request

DISCONNECT

.indication

DISCONNECT

.request

DISCONNECT

.confirm

(1)

(2)

(3)

30

Prof. Sang-Jo Yoo

Review - Data Link Layer Review - Data Link Layer Functions(2)Functions(2)

Functional View Frame Synchronization Flow Control

Stop-and-Wait Sliding-Window

Error Control Forward error control

Forward Error Correction (FEC) : error correction at the receiver

Backward error control Automatic Repeat Request (ARQ) :error recovery by retransmission

Addressing Link Management

31

Prof. Sang-Jo Yoo

HDLC - Basic Characteristics (1)HDLC - Basic Characteristics (1)

HDLC : High-Level Data Link Control data link protocol Widely used, and basis for many other data link control protocols Connections can be point-to-multipoint or point-to-point Can be used in half-duplex or full-duplex

Three types of stations Primary station - (Mainframe) Controls the operation of the link Secondary station - (Terminal) Respond to a primary station Combined station - Can be both a primary and a secondary

Commands and Responses commands : the frames sent by primary to secondary responses : the frames sent by secondary to primary

32

Prof. Sang-Jo Yoo

HDLC - Basic Characteristics (2)HDLC - Basic Characteristics (2) Two link configurations

Unbalanced configuration - One primary and one or more secondary stations

Balanced configurations - Two combined stations Three data transfer modes

Normal Response Mode (NRM) Unbalanced config. Primary station always dictates who sends and receives used on multidrop lines (computer polls each terminal for input)

Asynchronous Balanced Mode (ABM) Either of the two combined stations may initiate transmission efficient use of point-to-point link without polling overhead

Asynchronous Response Mode (ARM) Unbalanced config. Secondary station can send at any given time, but only one

secondary can be active at a time

33

Prof. Sang-Jo Yoo

HDLC - Frame Structure (1)HDLC - Frame Structure (1) Frame format

Synchronous or Asynchronous transmission?

34

Prof. Sang-Jo Yoo

HDLC - Frame Structure (1)HDLC - Frame Structure (1)

Flag field 8 bits (01111110), for frame sync. “Bit stuffing” is used for data transparency :

whenever five 1’s are transmitted, extra zero is inserted frame split or merge by a 1-bit error

35

Prof. Sang-Jo Yoo

HDLC - Frame Structure (2)HDLC - Frame Structure (2)

Address field 8 bits. If needed longer address, the LSB can be set to zero and the

address field is then assumed to be 8 bits longer. Not needed for point-to-point links but included for uniformity All 1’s indicates a broadcast frame

36

Prof. Sang-Jo Yoo

HDLC - Frame Structure (3)HDLC - Frame Structure (3)

Control field 8 bits. If the 1st bit is 0, then “information frame”, Otherwise, 10

indicates “supervisory frame” and 11 indicates “unnumbered frame”.

37

Prof. Sang-Jo Yoo

HDLC - Frame Structure (4)HDLC - Frame Structure (4)

P/F Poll/Final In command frames: P bit

If P=1, to solicit a response frame from the peer HDLC entity. In response frames: F bit

If F=1, to indicate the response frame transmitted as a result of a soliciting command.

38

Prof. Sang-Jo Yoo

HDLC - Frame Structure (5)HDLC - Frame Structure (5)

Control field (Cont’d) Information frame

two 3 bits sequence numbers, P/F bit sequence number can be extended to 7 used to send data

Supervisory frame: bits 3 and 4 determine types 00: “Receive Ready”. Used to ACK 01: “Reject”. Essentially a NACK in Go-back-N 10: “Receive Not Ready”. Indicates busy condition 11: “Selective Reject”. Request for a single frame retransmission Bit 5 is P/F. Bits 6,7,8 are sequence number

Unnumbered frame: More control functions. Has a variety of purposes, but most often

used for establishing the link setup and disconnect. Sets up the data transfer mode, sequence number size.

Also used to reset the link and other miscellaneous stuff.

39

Prof. Sang-Jo Yoo

HDLC - Frame Structure (6)HDLC - Frame Structure (6)

Information Field must consist of an integral number of octets up to some system-defined maximum

Frame Check Sequence(FCS) Field For the remaining bits of the frame, exclusive of flags normal : 16-bit CRC CCITT optional : CRC-32, if the frame length or the line reliability

dictates this choice

40

Prof. Sang-Jo Yoo

HDLC - Operation (1)HDLC - Operation (1)

Three-Phases Initialization

Link setup command and ack response Set mode by U-frames such as SABM/E, SNRM/E, SARM/E Ack by UA

Data Transfer Data transfer by I-frame Flow and error control by I and S-frames

Disconnect Link release by DISC command and UA response

41

Prof. Sang-Jo Yoo

HDLC - Operation (2)HDLC - Operation (2) Commands and Responses

Name C/R Description

I (Information) C/R Exchange user data

S (Supervisory) C/R

RR(Receive Ready) Positive ack; ready to receive I-frame

RNR(Receive Not Ready) Positive ack; not ready to receive

REJ(Reject) Negative ack; go back N

SREJ(Selective Reject) Negative ack; selective reject

42

Prof. Sang-Jo Yoo

Name C/R Description

U (Unnumbered)

SNRM/SNRME C Set mode

SARM/SARME C Set mode

SABM/SABME C Set mode

SIM(Set Initialization Mode) C Initialize link control functions in addressed station

DISC(Disconnect) C Terminate logical link connection

UA(Unnumbered Ack) R Ack for the set mode commands

DM(Disconnected Mode) C Terminate logical link connection

RD(Request Disconnect) R Request for DISC command

RIM(Request Initialization Mode) R Request for SIM command

UI(Unnumbered Information) C/R Used to exchange control information

UP(Unnumbered Poll) C Used to solicit control information

RSET(Reset) C Used for recovery; resets N(R), N(S)

XID(Exchange Identification) C/R Used to request/report status

TEST C/R Exchange identical information fields for testing

FRMR(Frame Reject) R Reports receipt of unacceptable frame

43

Prof. Sang-Jo Yoo

HDLC - Operation (3)HDLC - Operation (3)

Examples of operation

44

Prof. Sang-Jo Yoo

HDLC - Operation (4)HDLC - Operation (4)

45

Prof. Sang-Jo Yoo

Other Data Link Control Protocols (1)Other Data Link Control Protocols (1)

LAPB (Link Access Procedure, Balanced) by ITU-T as part of X.25 packet-switching network-interface

standard subset of HDLC that provides only ABM

LAPD (Link Access Procedure, D-Channel) by ITU-T as part of set of recommendations on ISDN D-channel : logical channel at the user-ISDN interface restricted to ABM 7-bit sequence number, 16-bit CRC, 16-bit address field

46

Prof. Sang-Jo Yoo

Other Data Link Control Protocols (2)Other Data Link Control Protocols (2)

LLC (Logical Link Control) a part of the IEEE 802 family of standards of controlling operation over a

LAN. Link control functions are divided between to layers:

MAC(medium access control) layer LLC(logical link control) layer

Frame Relay provide a streamlined capability for use over high-speed packet-switched

networks; based on HDLC ATM (Asynchronous Transfer Mode)

new frame format called cell