5/15/2015© 2008 raymond p. jefferis iiilect 04 - 1 the data link layer

73
03/25/22 © 2008 Raymond P. Jefferis III Lect 04 - 1 The Data Link Layer

Upload: brooke-henry

Post on 17-Dec-2015

218 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 1

The Data Link Layer

Page 2: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 2

Link Layer in OSI Model

Page 3: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 3

Functions

• Packet transfer services for network layer

• Handles network uncertainties– errors (error control)– channel capacity limitations (flow control)– transfer delays (protocols)

Page 4: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 4

Services• Connection-Oriented

– open and close (virtual) channel– send and receive numbered frames– detect/correct errors and ACK/NAK frames

• Connectionless– send and receive frames– detect/correct errors– ACK good frames (if acknowledged service)

Page 5: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 5

Connection-Oriented Services

Services to open and close virtual data channel connection

Page 6: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 6

Initiating a Connection

• Request – sender requests channel

• Indication– to recipient that channel needed

• Response– from recipient to accept/reject

• Confirm– acceptance/rejection of request

Page 7: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 7

Error Control• Data to be transmitted is embedded in frames• Error control bits (redundancy) are computed from

the data and added to each frame• Computations upon reception detect (and possibly

correct) errors• Protocol deals with acknowledgement or

retransmission of unacknowledged frames

Page 8: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 8

Synchronization of Frames

• Asynchronous– transmitter clock is free running– receiver clock is free running– synchronized on each character transmission

• Synchronous– transmitter clock is free running– receiver clock is derived from bit stream

(synchronous)

Page 9: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 9

Start/Stop Framing (RS232C)• each character is a “frame” of 10 bits

• start pulse synchronizes clock for frame

• clock drifts over frame interval

• stop pulse terminates frame

• excessive drift produces frame error (too few bits) or overrun error (too many bits)

• 2-bit framing overhead per character

• error control: parity bit possible

Page 10: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 10

RS232C Framing

Page 11: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 11

Character-based Framing• Special control characters delimit frame

– DLE STX (Start of TeXt) DLE ETX (End of TeXt)

– or 01111110 for start + frame character count

• Error control bits grouped at end of frame

• Extra bits/characters “stuffed” into data stream upon arrival of special character in data (removed upon reception)

• Burdened by 2-bit overhead per character

• Advantage: error control by frames

Page 12: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 12

Synchronous Framing

• Clock transmitted with data(Ethernet Manchester encoding uses XOR with data)

• Synchronous receiving clock generated from bit stream– permits long frames without clock drift– eliminates start/stop pulse overhead

• Bit pattern flags start of frame (7x 10101010)

• Frame length field specifies end of frame

Page 13: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 13

Error Control• Channel noise: random XOR with data bits

• Error occurs if result is valid code word

• Code word = data bits + check bits

• For Hamming distance d (Number of differing bits) between code words, d 1-bit errors will produce an undetected error

• distance 2d+1 needed to correct d errors

Page 14: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 14

Polynomial Error Detecting Codes

• IEEE 802.3 (Ethernet) error correction is by means of Cyclic Redundancy Check (CRC) detection

• Use of these codes can result in a very low probability of undetected error, and many errors can be corrected without retransmission (forward error correction).

Page 15: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 15

CRC-16 (not Ethernet standard)• Detects all odd and double errors, 16-bit

bursts, 99.997% of 17-bit bursts, 99.998% of bursts 18 bits and longer

• Uses 16-bit polynomial: X16 + X15 + X2 + 1or (1 1000 0000 0000 0101)2 or (18005)16

• Usually implemented in hardware by shift register with XOR

• Undetected errors possible in large transfers

Page 16: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 16

Ethernet - IEEE 802.3 CRC-32

• Can detect and correct many errors

• Uses 32-bit polynomial:X32 + X26 + X23 + X16 + X12 + X11+ X10 + X8 + X7

+ X5 + X4 + X2 + X + 1or,

(1 0000 0100 1000 0001 0001 1101 1011 0111)2

or,

(104811db7)16

Page 17: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 17

CRC AlgorithmFor I:= 1 to length(message) do

If MSB of dividend=1 then

(quotient would get 1 in that position)

XOR divisor into dividend

(Note: dividend padded with length(divisor)-1 zeroes)

Shift dividend left one bit (SHL)

End up with remainder in divisor, append to message instead of zeroes

Page 18: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 18

Example ComputationGenerator 1 1 0 0 1

Data + 0000 1 1 1 0 0 1 1 0 0 0 0 0XOR 0 0 1 0 1 1 1 0 0 0 0 0SHL (Remainder) 0 1 0 1 1 1 0 0 0 0 0

SHL (Remainder) 1 0 1 1 1 0 0 0 0 0

XOR 0 1 1 1 0 0 0 0 0 0SHL (Remainder) 1 1 1 0 0 0 0 0 0

XOR 0 0 1 0 1 0 0 0 0SHL (Remainder) 0 1 0 1 0 0 0 0

SHL (Remainder) 1 0 1 0 0 0 0

XOR 0 1 1 0 1 0 0SHL (Remainder) 1 1 0 1 0 0

XOR 0 0 0 1 1 0SHL (Remainder) 0 0 1 1 0

SHL (Remainder) 0 1 1 0

Page 19: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 19

Example - Perfect ReceptionGenerator 1 1 0 0 1

Data + 0110 1 1 1 0 0 1 1 0 0 1 1 0

XOR 0 0 1 0 1 1 1 0 0 1 1 0SHL (Remainder) 0 1 0 1 1 1 0 0 1 1 0

SHL (Remainder) 1 0 1 1 1 0 0 1 1 0

XOR 0 1 1 1 0 0 0 1 1 0SHL (Remainder) 1 1 1 0 0 0 1 1 0

XOR 0 0 1 0 1 0 1 1 0SHL (Remainder) 0 1 0 1 0 1 1 0

SHL (Remainder) 1 0 1 0 1 1 0

XOR 0 1 1 0 0 1 0SHL (Remainder) 1 1 0 0 1 0

XOR 0 0 0 0 0 0SHL (Remainder) 0 0 0 0 0

SHL (Remainder) 0 0 0 0

Page 20: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 20

Example - Error in Bit-0Generator 1 1 0 0 1

(Data XOR 000000001) + 0110 1 1 1 0 0 1 1 1 0 1 1 0

XOR 0 0 1 0 1 1 1 1 0 1 1 0SHL (Remainder) 0 1 0 1 1 1 1 0 1 1 0

SHL (Remainder) 1 0 1 1 1 1 0 1 1 0

XOR 0 1 1 1 0 1 0 1 1 0SHL (Remainder) 1 1 1 0 1 0 1 1 0

XOR 0 0 1 0 0 0 1 1 0SHL (Remainder) 0 1 0 0 0 1 1 0

SHL (Remainder) 1 0 0 0 1 1 0

XOR 0 1 0 0 0 1 0SHL (Remainder) 1 0 0 0 1 0

XOR 0 1 0 0 0 0SHL (Remainder) 1 0 0 0 0

XOR 0 1 0 0 1SHL (Remainder) 1 0 0 1

Page 21: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 21

Example: IEEE 802.3 Data Framing

Page 22: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 22

IEEE 802.3 Preamble

• Defines start of frame7 bytes of 10101010

1 byte frame delimiter

• Synchronizes receiving clock

Page 23: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 23

IEEE 802.3 Header Components• Destination Medium Access Control

(MAC) address– 3 byte manufacturer code– 3 byte product line serial number

• Source MAC address (same structure as destination address)

• Length of data (2 bytes)

Page 24: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 24

MAC Address Format

• 6-byte address format

• used for source and destination addresses

Page 25: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 25

IEEE 802.3 Data and Checksum

• Frame data (46 - 1500 bytes)

• Cyclic Redundancy Check (CRC) checksum (32 bits)– for error control– can detect and correct errors

Page 26: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 26

Flow Control

• Computers can generate data at rates higher than network can transmit them

• Data must be buffered

• Mechanism must be introduced to prevent buffer overflow

Page 27: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 27

Source Control

• Source “hold” needed

• Methods– semaphore

• XON/XOFF control characters used for software RS-232-C

• CTS RS-232-C hardware permission to transmit

– byte count grant

Page 28: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 28

Collisions (Ethernet)

• Frames transmitted from two sources at the same time can collide on a common bus network

• Solutions– retransmission with random standoff– redesigning network to use switched ports,

instead of common bus

Page 29: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 29

Ethernet Transmission

• Frames are transmitted sequentially in empty (no pulse stream) time slots

• If there is a collision, frames are retransmitted after random delay

• Retransmission continues until prescribed time limit is reached

Page 30: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 30

Flow Control Protocols

• Protocols are rules for the management of data transfer at both ends of the line

• Examples– Simplex, or “Stop-and-Wait”– Sliding Window

• Go Back n

• Selective Repeat

Page 31: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 31

Simplex - “Stop-and-Wait”

Transmitterwhile(true)

get packet from network layer

frame it for transmission

transmit frame

Receiverwhile(true)

wait for new_frame

get frame from physical layer

detect errors

if not(frame_error)send packet to network layer

else

discard packet

Note: No ACK or NAK of frames to transmitter

Page 32: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 32

Petri Diagrams

• Used to diagram protocols– Places

• accept and hold tokens

– Tokens• activate transitions

– Transitions• triggered by external events

• can fire if one token at each input and outputs can each accept token

Transition

Placewith

Token

Place

Input Output

Input Output

Inputs Output

Page 33: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 33

Petri Net Firing Rules

• Transition activated if all input places have token

• Each output place gets one token when transition fires

• Each input place loses one token upon firing

Place 1 t1

Outputt2

ActivatedTransition

Place 2

Non-activatedTransition

Page 34: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 34

Use of Petri Diagrams

• Can illustrate simplex protocol

• Follow packets through system

Page 35: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 35

Simplex Petri Diagram

t1PacketBuffer Packet

t2Frame

t3 ReceivedFrame

Transmitter Receiver

t1: get packet, t2: frame packet, t3: send frame

Packets in buffer, t1 enabled

Page 36: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 36

Simplex Petri Diagram

t1PacketBuffer Packet

t2Frame

t3 ReceivedFrame

Transmitter Receiver

t1: get packet, t2: frame packet, t3: send frame

Packet obtained, t2 enabled

Page 37: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 37

Simplex Petri Diagram

t1PacketBuffer Packet

t2Frame

t3 ReceivedFrame

Transmitter Receiver

t1: get packet, t2: frame packet, t3: send frame

Packet framed, t3 enabled

Page 38: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 38

Simplex Petri Diagram

t1PacketBuffer Packet

t2Frame

t3 ReceivedFrame

Transmitter Receiver

t1: get packet, t2: frame packet, t3: send frame

Packet received, no acknowledgment necessary

Page 39: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 39

Assumptions (Unrealistic ideal)

• Channel can accept packets at any rate

• There are no buffer space limitations

• Receiver is always ready

• Processing time can be ignored

• No packets are lost

• There are no errors

Page 40: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 40

Improved “Stop & Wait”Transmitterwhile(true)

if not(resend)get packet from network layer

set ACK timeout

frame for transmission

transmit frame

waitfor (event)

if timeout or error

resend:=true

else resent:=false

Receiverwhile(true)

wait for new_frame

get frame from physical layer

detect errors

if not(frame_error)send packet to network layer

return ACK frame to transmitter

else

return NAK frame to transmitter

Page 41: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 41

Improved “Stop & Wait”t1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 42: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 42

Get Packett1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 43: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 43

Frame Packett1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 44: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 44

Send Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 45: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 45

Get Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 46: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 46

Check Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 47: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 47

Send Ackt1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 48: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 48

Send Datat1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 49: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 49

Receive ACKt1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 50: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 50

Error Case

• Lost ACK frame

• Timeout remains activated

• After timeout, original frame retransmitted

Page 51: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 51

Initial Statet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 52: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 52

Get Packett1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 53: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 53

Frame Packett1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 54: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 54

Send Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 55: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 55

Get Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 56: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 56

Check Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 57: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 57

Send Ackt1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 58: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 58

Send Datat1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 59: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 59

ACK Lostt1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 60: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 60

Re-send Framet1Packet

Buffer Packett2

Framet3 Received

Frame

Transmitter Receiver

ReceiverReady

t4

t5

t6

t6

t7

t8

ReceivedACK

ReadyACKBuffer

DataReady

PacketGetPacket

FramePacket

Timeout

SendFrame

GetFrame

FrameBuffer Full

Check

SendData

SendACK

Flag

Receive

Page 61: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 61

Problems• Frame error

– no ACK sent– frame is resent– receiver must discard bad frame

• ACK frame lost or timeout (TMO)– frame is resent– two copies at receiver– receiver must discard redundant frame (frames must be numbered for this)

Page 62: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 62

Positive Acknowledgment• Frames contain sequence number (byte)

• Receiver ACKs correctly received frames– frame removed from transmit list– retransmission on loss of ACK

• Receiver NAKs incorrectly received frames– frame retransmitted and stays in transmit list– retransmission on loss of NAK

• Receiver discards redundant frames

Page 63: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 63

Sliding Window Protocols• n frames in buffer can be awaiting ACK

• frames have sequence numbers

• window defined of size less than addressable by sequence numbers

• frame queue needed, for windowed frames

• window slides forward as ACKs received

Page 64: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 64

Sliding Window Transmitter

• Maintains list of frames to be transmitted until each acknowledged (window)

• removes ACK frames from transmit list

• retransmits NAK or TMO frames

Page 65: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 65

Sliding Window Protocol

• Frames transmitted sequentially

• Each correct frame acknowledged

• No errorsDashed lines represent acknowledged frames

Page 66: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 66

Sliding Window Receiver

• Maintains list of frames expected (window)

• discards duplicate frames

• sends ACK or NAK for received frames

• prepares packets for Network Layer and places them in correct order

Page 67: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 67

Go Back n Process

• Window size = 1

• Receiver sends ACK for good frames

• Receiver discards all frames after bad one

• Transmitter times out on non-ACK frames

• Transmitter retransmits from last ACK

• Receiver discards duplicates

• Good frames sent to Network Layer

Page 68: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 68

Selective Repeat Protocol

• Unacknowledged frames retransmitted after timeout

• Acknowledged frames sent to network layer in order

• Inefficient, due to lack of overlap

Frame 2 does not arrive

Frame 2 retransmitted after timeout

Frames 2-5 sent to network layer

Page 69: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 69

Selective Repeat

• Window size = n

• Receiver sends ACK for good frames

• Receiver stores all good frames

• Non-ACK frames time out

• Transmitter resends non-ACK frames

• Window, filled with good frames, sent to Network Layer

Page 70: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 70

Selective Repeat Protocol

• Acknowledged frames removed from retransmit list

• Unacknowledged frames retransmitted after timeout

• Reordering of frames may be required

Frame 2 does not arrive

Frame 2 retransmitted after timeout

Page 71: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 71

Selective Repeat Protocol

• Acknowledged frames removed from retransmit list

• Unacknowledged frames retransmitted after timeout

• Multiple copies must be removed

Frame 2 ACK lost

Frame 2 retransmitted after timeout - 2 copies!

Page 72: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 72

Selective Repeat with Buffer

• Simpler to implement (no queue)

• Adjustable window size

Page 73: 5/15/2015© 2008 Raymond P. Jefferis IIILect 04 - 1 The Data Link Layer

04/18/23 © 2008 Raymond P. Jefferis III Lect 04 - 73

Selective Repeat Protocol

• Unacknowledged frames retransmitted after timeout

• Acknowledged frames sent to network layer in order

Frame 2 does not arrive

Frame 2 retransmitted after timeout

Frames 2-5 sent to network layer