Data Link Layer

Download Report

Transcript Data Link Layer

D ATA L INK L AYER By Dr. Nawaporn Wisitpongphan

I

NTRODUCTION TO SOME RANDOM TOPIC IN

C

OMPUTER

N

ETWORK

E

PIDEMIC

R

OUTING

O

UTLINE

D

ATA

L

INK

C

ONTROL

P

ROTOCOLS

Data Link Control Protocols Who should Send now?

How much data Can be sent?

be corrected?

5

D

ATA

L

INK

C

ONTROL

P

ROTOCOLS

Line Discipline

ENQ/ACK

• In half-duplex transmissions, it is essential that only one device transmit at a time.

• If both ends of the link put signals on the line simultaneously, they collide, leaving nothing on the line but noise.

• The coordination of half-duplex transmission is part of a procedure called line discipline.

6

ENQ/ACK

     ENQ/ACK coordinates which device may start a transmission and whether or not the intended recipient is ready and enabled. See fig 10.4

Using ENQ/ACK, a session can be initiated by either station on a link as long as both are of equal rank.

In both half-duplex and full-duplex transmission, the initiating device establishes the session.

In half duplex, the initiator then sends its data while the responder waits. The responder may take over the link when the initiator is finished or has requested a response.

In full duplex, both devices can transmit simultaneously once the session has been established. How it works? Refer fig. 10.5

7

ENQ/ACK

P

OLL

/S

ELECT    The poll/select method of line discipline works with topologies where one device is designated as a primary station and the other devices are secondary stations.

Multipoint systems must coordinate several nodes, not just two.

The question to be determined in these cases, therefore, is more than just, are you ready? It is also, which of the several nodes has the right to use the channel?

P

OLL

/S

ELECT

: H

OW DOES IT WORK

?

     Whenever multipoint link consists of a primary device and multiple secondary devices using a single transmission line, all exchanges must be made through primary device.

The primary device controls the link; the secondary device follow its instructions.

It is up to the primary to determine which device is allowed to use the channel at a given time The primary, therefore is always the initiator of a session.

If the primary wants to receive data and send data. It apply function called poll and select respectively.

A

DDRESSING IN

P

OLL

/S

ELECT    For point-to-point configurations, there is no need for addressing; any transmission put onto the link by one device can be intended only for the other.

For the primary device in a multipoint topology to be able to identify and communicate with a specific secondary device, however, there must be an addressing convention.

For this reason, every device on a link has an address that can be used for identification.

POLL

     The polling function is used by the primary device to solicit transmission from the secondary devices.

As noted, the secondaries are not allowed to transmit data unless asked (don’t call us-we’ll call you).

By keeping all control with the primary, the multipoint system guarantees that only one transmission can occur at a time, thereby ensuring against signal collision.

When the primary is ready to receive data, it must ask (poll) each device in turn if it has anything to send.

When the first secondary is approached, it responds either with a NAK frame if it has nothing to send or with data (in the form of a data frame) if it does.

POLL (C

ONT

)

 There are two possibilities for terminating the exchange: either the secondary sends all its data, finishing with an EOT frame  Or the primary says, “time’s up” which of these occurs depends on the protocol and the length of the message.

 Once a secondary has finished transmitting, the primary can poll the remaining devices

P

OLL

14

S

ELECT      The select mode is used whenever the primary device has something to send.

But first, it must ensure that the target device is prepared to receive.

So the primary must alert the secondary to the upcoming transmission and wait for an acknowledgment of the secondary’s ready status.

Before sending data, the primary, the primary creates and transmits a select (SEL) frame, one field of which includes the address of the intended secondary.

If the secondary is awake and running, it returns an ACK frame to the primary. The primary then sends one or more data frames each addressed to the intended secondary.

S

ELECT

16

D

ATA

L

INK

C

ONTROL

P

ROTOCOLS

Data Link Control Protocols Who should Send now?

How much data Can be sent?

be corrected?

17

F

LOW

C

ONTROL

/ S

TOP

& W

AIT

Flow Control

Stop-and-Wait Send 1 frame

Sliding Window

18

S

TOP

-

AND

-W

AIT

F

LOW

C

ONTROL Procedure 1.

Source transmits frame 2.

3.

4.

Destination receives frame and replies with acknowledgement (ACK) Source waits for ACK next frame before sending the Destination can stop flow by not send ACK  Works well for a few large frames  Stop and wait becomes inadequate if large block of data is split into small frames

19

S

TOP

-

AND

-W

AIT

F

LOW

C

ONTROL

20

S

TOP

-

AND

-W

AIT

L

INK

U

TILIZATION

Transmission Time is normalized to 1, Propagation Delay is expressed as ‘a’ 21

F

LOW

C

ONTROL

/ S

LIDING

W

INDOW

Flow Control

Stop-and-Wait Send 1 frame Sliding Window

22

S

LIDING

-W

INDOWS

F

LOW

C

ONTROL  Allows multiple frames to be in transit  Receiver has buffer for W frames  Transmitter sends up to W frames once without ACK from receiver  ACK includes sequence number of next frame expected  Sequence number is bounded by size of field (k)   frames are numbered modulo 2 k giving max window size of up to 2 k - 1

23

S

LIDING

-W

INDOWS

F

LOW

C

ONTROL  Receiver can ACK frames without permitting further transmission (Receive Not Ready)  Must send a normal acknowledgment to resume data transmission  Can use

Piggyback ACKs

in Full Duplex Links  Send data and ACK together in 1 frame   If a station has only ACK to send (No data) : Send a separate ACK frame (RR/RNR) If a station has only data to send (No new ACK) : Send a repeat (as previous) ACK frame

24

S

LIDING

-W

INDOW

D

IAGRAM

25

S

LIDING

-W

INDOW

E

XAMPLE

26

D

ATA

L

INK

C

ONTROL

P

ROTOCOLS

Data Link Control Protocols Who should Send now?

How much data Can be sent?

be corrected?

27

E

RROR

C

ONTROL  Detection and correction of errors such as:   Lost frames Damaged frames  Common techniques use:   Error detection : CRC Positive acknowledgment   Retransmission after timeout Negative acknowledgement & retransmission

28

A

UTOMATIC

R

EPEAT

R

EQUEST

(ARQ)

 Collective name for such error control mechanisms, including:  Stop-and-Wait   Go-back-N Selective-Reject (selective retransmission)

29

S

TOP

-

AND

-W

AIT

ARQ

    Based on Stop-and-Wait Flow Control Source transmits single frame & wait for ACK If received frame damaged, discard it   Transmitter has timeout If no ACK within timeout, retransmit If ACK is damaged, transmitter will not recognize it   Transmitter will retransmit Receive gets two copies of frame - Discard  Use alternate numbering and ACK0 / ACK1

30

S

TOP

-

AND

-W

AIT

ARQ

 Possible Transmission Errors   Data Lost ACK Lost   Pros  Simple Cons  inefficient

31

G

O

-B

ACK

-N ARQ

 Based on Sliding-Window Flow Control  If no error, ACK as usual  Use window to control number of outstanding frames  If error, reply with rejection  Discard that frame and all future frames until error frame received correctly  Transmitter must go back and retransmit that frame and all subsequent frames

32

G

O

-B

ACK

-N – H

ANDLING

E

RROR  Damaged Frame   Error in frame

i

so receiver rejects frame

i

Transmitter retransmits frames from

i

 Lost Frame   Frame

i

lost and either   Transmitter sends

i+1

and receiver gets frame

i+1

out of sequence and rejects frame

i

Or transmitter times out and send ACK with P-bit set which receiver responds to with ACK

i i

Transmitter then retransmits frames from

33

G

O

-B

ACK

-N - H

ANDLING   Damaged Acknowledgement  Receiver gets frame

i

, sends ACK (i+1)    which is lost ACKs are cumulative, so next ACK frame

i

(i+n) may arrive before transmitter times out on If transmitter times out, it sends ACK with P-bit set Can be repeated a number of times before a reset procedure is initiated Damaged Rejection  Reject for damaged frame is lost  Handled as for lost frame when transmitter times out

34

S

ELECTIVE

-R

EJECT

ARQ

        Also called Selective-Retransmission Only rejected frames are retransmitted Subsequent frames are accepted by the receiver and buffered Minimizes retransmission Receiver must maintain large enough buffer More complex logic in transmitter Hence less widely used Useful for satellite links with long propagation delays

35

G

O VS

.

B

ACK

N S

ELECTIVE

R

EJECT

36

PREVIEW

OF THE

N

EXT

C

LASS

E

VOLUTION OF

C

ONTENTION

P

ROTOCOLS

Aloha

Developed in the 1970s for a packet radio network

Slotted Aloha CSMA CSMA/CD

Improvement: Start transmission only at fixed times (slots) CSMA = Carrier Sense Multiple Access Improvement: Start transmission only if no transmission is ongoing CD = Collision Detection Improvement: Stop ongoing transmission if a collision is detected (e.g. Ethernet)

38