15 - winter 2006 ece ece 766 computer interfacing and protocols 1 data link control physical layer...

22
Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 15 - Data Link Control Data Link Control • Physical layer is only responsible for data transmission • Data link control is responsible for converting transmission to communication – Line Discipline: Who should send now? – Flow Control: How much data may be sent? – Error Control: How should the errors be detected / corrected?

Upload: louise-francis

Post on 28-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

115 -

Data Link ControlData Link Control

• Physical layer is only responsible for data transmission

• Data link control is responsible for converting transmission to communication– Line Discipline: Who should send now?– Flow Control: How much data may be sent?– Error Control: How should the errors be

detected / corrected?

Page 2: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

215 -

Line DisciplineLine Discipline

• Determine the direction of communication

• Make sure that receiver is ready to accept or signal the sender to start

• Two ways:– Enquiry / Acknowledgment (ENQ/ACK)

Dedicated line between hosts– Poll / Select

Multipoint connections

Page 3: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

315 -

ENQ/ACKENQ/ACK

• Dedicated line between hosts, no problem of addressing

• Coordinates which device may start transmission, and if the receiver is ready and enabled

• If both hosts have equal ranks, either can initiate the process

• Otherwise, only higher-ranked host is allowed to start the transmission request

• Can be run in either half-duplex or full-duplex modes

Page 4: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

415 -

ENQ/ACKENQ/ACK

• Establishment: Host B responds either with ACK or NAK

• Host A tries to send ENQ three times before concluding that Host B is down

Host A Host B

ENQ

ACK

Data

ACK

Data

ACK

EOT

…Establishment

DataTransfer

Termination

Page 5: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

515 -

Poll / SelectPoll / Select

• Multipoint connections• One primary and multiple secondary hosts• Communication between secondary devices go

over the primary• Select mode is used when primary has

something to send to a secondary (downstream)• Poll mode is used to solicit transmissions from a

secondary to the primary (upstream)• Address must be contained in all packets

Page 6: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

615 -

Poll / SelectPoll / Select

• Select mode• SEL packet

contains address of B

• B can response either by ACK or NAK

• Primary sends one or more data packets, which are ACKed by B

Primary Sec. A

SEL

ACK

Data

ACK

Sec. B

Data

ACK

Page 7: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

715 -

Poll / SelectPoll / Select

• Poll mode• Poll packet

contains address of recipient

• If the intended secondary has no data to send, replies with NAK

• Data is ACKed by the primary

• How to terminate?

Primary Sec. A

Poll

NAK

Poll

Data

Sec. B

ACK

Page 8: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

815 -

Flow ControlFlow Control

• Restrict the amount of data to send before waiting for acknowledgment

• Controls the flow of the data as not to overwhelm the receiver

• Categories:– Stop-and-Wait

Wait for an ACK before sending the next frame– Continous (Sliding Window)

Can send several windows before requiring an ACK

Page 9: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

915 -

Stop-and-WaitStop-and-Wait

• Send frame, then wait until you get ACK back

• Advantage: Simplicity

• Disadvantage: Inefficiency– l-bit frame, b bits/sec transmission speed,

R seconds roundtrip time, infinitely short ACK– Utilization = l / (l + bR)– Not suited for high bandwidth-delay product

lines

Page 10: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1015 -

Sliding WindowSliding Window

• Send multiple frames before waiting for ACK

• Several frames can be in transit at a time

• Sender window vs. receiver window

• Frames can be ACKed without waiting for the receiver window to fill up

• Frames may be sent as long as there are unsent packets in the sender window

Page 11: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1115 -

Sliding WindowSliding Window

• Sliding window scheme uses modulo-n arithmetic

• The addresses range between 0 and n-1• The size of the window is n-1 to prevent

ambiguity in ACKs, which contains sequence number of next frame expected– Assume window size is n-1– Sender can sends frames 0 to n-2 to start– Receiver ACKs frame 0– Does it mean that it is ready for the next frames?

Page 12: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1215 -

Sliding WindowSliding Window

• Sender window:– Shrink from left as frames are sent– Expand from right as you receive ACKs

• Receiver window:– Shrink from left as frames are received– Expand from right as ACKs are sent

01234567012345670123456701234567

Page 13: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1315 -

Error ControlError Control

• Error control in data link layer is based on retransmissions (backward Error Control)

• Any time an error is detected, a NAK is returned to sender

• Automatic Repeat Request (ARQ)– Retransmission in case of damaged frame, lost frame,

and lost ACK

• Stop-and-Wait ARQ• Sliding Window ARQ

– Go-Back-n– Selective Repeat

Page 14: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1415 -

Stop-and-Wait ARQStop-and-Wait ARQ• Number frames as 0 and 1 alternately• Keep a copy of the last sent frame• Receiver ACKs the receipt of frame 0 by sending

ACK 1 (waiting for frame 1)• If NAK is received, resend the last frame (no

numbering necessary)– Takes care of damaged data frames

• Start a timer for every frame sentIf it expires before an ACK is received, resend the frame– Takes care of lost data frame and lost ACKs / NAKs– Receiver discards duplicate frames in case ACK is lost

Page 15: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1515 -

Sliding Window ARQSliding Window ARQ

• Number frames modulo n• Keep a copy of all unACKed frames• Single ACK for multiple frames

– If last ACK was for 2 (waiting for 3) and new ACK is for 6, frames 3, 4, 5, and 6 are ACKed

• Timers are used to signal retransmissions• Response to NAKs and expiring timers

determine the style of ARQ– Go-Back-n– Selective Repeat

Page 16: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1615 -

Go-Back-n ARQGo-Back-n ARQ

• All frames after damaged or lost frame are discarded

• Damaged Frames:– Say, frames 0-5 are sent and all but frame # 3 is

correctly received– Receiver sends NAK 3 and discards subsequent

frames– This signals to sender that frames 0, 1, and 2 are

correctly received and frame 3 is damaged– Sender retransmits frames 3, 4, and 5– Same procedure for lost data frames

Page 17: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1715 -

Go-Back-n ARQGo-Back-n ARQ

Host A Host B

Data 0

NAK 3

Data 1

Data 2

Data 3

Data 4

Data 5Error, discard

Data 3

Data 4

Data 5

Discard

Discard

Window size 7

Error in data frame 3

Page 18: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1815 -

Go-Back-n ARQGo-Back-n ARQ

• Lost ACK:– When sender reaches window capacity, it

starts a timer– If timer expires, it resends all outstanding

(unACKed) frames– The receiver discards possible duplicate

frames and sends another ACK

Page 19: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

1915 -

Go-Back-n ARQGo-Back-n ARQ

Host A Host B

Data 0

ACK 3

Data 1

Data 2

Data 0

Data 1

Data 2

Lost

Window Size 3

Lost ACK case

Tim

er

exp

ires

Page 20: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

2015 -

Selective Repeat ARQSelective Repeat ARQ

• Only damaged and lost frames are retransmitted• ACK numbers refer to the last correctly received

frame, not next frame expected!• If go-back-n window size is n-1, SR widow size

must be at most n/2 (why?)• Damaged Frames:

– After receiving a damaged frame, receiver sends a NAK and continues accepting other frames

– Sender only retransmits the missing frame

Page 21: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

2115 -

Selective Repeat ARQSelective Repeat ARQ

Host A Host B

Data 0

NAK 3

Data 1

Data 2

Data 3

Data 4

Data 5Error, discard

Data 3

Window size 7

Error in data frame 3

Data 6

Page 22: 15 - Winter 2006 ECE ECE 766 Computer Interfacing and Protocols 1 Data Link Control Physical layer is only responsible for data transmission Data link

Winter 2006

ECE

ECE 766Computer Interfacing and Protocols

2215 -

Selective Repeat ARQSelective Repeat ARQ

• Lost Data Frames:– Out-of-sequence delivery is permitted, but

out-of-sequence ACK is not– When a lost frame is detected, NAK is sent– If last frame is lost, then receiver does nothing

• Lost ACK:– Handled the same way as in go-back-n