The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing...

32
The Data Link Layer
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    7

Transcript of The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing...

Page 1: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

The Data Link Layer

Page 2: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Data Link Layer Design Issues

• Services Provided to the Network Layer

• Framing

• Error Control

• Flow Control

Page 3: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Functions of the Data Link Layer

• Provide service interface to the network layer

• Dealing with transmission errors

• Regulating data flow• Slow receivers not swamped by fast senders

Page 4: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Functions of the Data Link Layer (2)

Relationship between packets and frames.

Page 5: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Services Provided to Network Layer

(a) Virtual communication.(b) Actual communication.

Page 6: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Services Provided to Network Layer (2)

Placement of the data link protocol.

Page 7: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Framing

A character stream. (a) Without errors. (b) With one error.

Page 8: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Framing (2)

(a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.

Page 9: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Framing (3)

Bit stuffing

(a) The original data.

(b) The data as they appear on the line.

(c) The data as they are stored in receiver’s memory after destuffing.

Page 10: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Sliding Window Protocols

• A One-Bit Sliding Window Protocol

• A Protocol Using Go Back N

• A Protocol Using Selective Repeat

Page 11: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Sliding Window Protocols (2)

A sliding window of size 1, with a 3-bit sequence number.

(a) Initially.

(b) After the first frame has been sent.

(c) After the first frame has been received.

(d) After the first acknowledgement has been received.

Page 12: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

A Protocol Using Go Back N

Pipelining and error recovery. Effect on an error when

(a) Receiver’s window size is 1.

(b) Receiver’s window size is large.

Page 13: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Go-Back-N

Sender:a) k-bit seq # in pkt header

b) “window” of up to N, consecutive unack’ed pkts allowed

a) ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”– may deceive duplicate ACKs (see receiver)

b) timer for each in-flight pkt

c) timeout(n): retransmit pkt n and all higher seq # pkts in window

Page 14: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

GBN: sender extended FSM

Wait start_timerudt_send(sndpkt[base])udt_send(sndpkt[base+1])…udt_send(sndpkt[nextseqnum-1])

timeout

rdt_send(data)

if (nextseqnum < base+N) { sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum) udt_send(sndpkt[nextseqnum]) if (base == nextseqnum) start_timer nextseqnum++ }else refuse_data(data)

base = getacknum(rcvpkt)+1If (base == nextseqnum) stop_timer else start_timer

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)

base=1nextseqnum=1

rdt_rcv(rcvpkt) && corrupt(rcvpkt)

Page 15: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

GBN: receiver extended FSM

ACK-only: always send ACK for correctly-received pkt with highest in-order seq #– may generate duplicate ACKs

– need only remember expectedseqnum

a) out-of-order pkt: – discard (don’t buffer) -> no receiver buffering!

– Re-ACK pkt with highest in-order seq #

Wait

udt_send(sndpkt)

default

rdt_rcv(rcvpkt) && notcurrupt(rcvpkt) && hasseqnum(rcvpkt,expectedseqnum)

extract(rcvpkt,data)deliver_data(data)sndpkt = make_pkt(expectedseqnum,ACK,chksum)udt_send(sndpkt)expectedseqnum++

expectedseqnum=1sndpkt = make_pkt(expectedseqnum,ACK,chksum)

Page 16: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

GBN inaction

Page 17: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Selective Repeat

a) receiver individually acknowledges all correctly received pkts– buffers pkts, as needed, for eventual in-order delivery to upper layer

b) sender only resends pkts for which ACK not received– sender timer for each unACKed pkt

c) sender window– N consecutive seq #’s

– again limits seq #s of sent, unACKed pkts

Page 18: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Selective repeat: sender, receiver windows

Page 19: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Selective repeat in action

Page 20: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Selective repeat: dilemma

Example: a) seq #’s: 0, 1, 2, 3

b) window size=3

c) receiver sees no difference in two scenarios!

d) incorrectly passes duplicate data as new in (a)

Q: what relationship between seq # size and window size?

Page 21: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Example Data Link Protocols

• HDLC – High-Level Data Link Control

• The Data Link Layer in the Internet

Page 22: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

High-Level Data Link Control

Frame format for bit-oriented protocols.

Page 23: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

High-Level Data Link Control (2)

Control field of

(a) An information frame.

(b) A supervisory frame.

(c) An unnumbered frame.

Page 24: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

The Data Link Layer in the Internet

A home personal computer acting as an internet host.

Page 25: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

PPP – Point to Point Protocol

The PPP full frame format for unnumbered mode operation.

Page 26: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

PPP Design Requirements [RFC 1557]

a) packet framing: encapsulation of network-layer datagram in data link frame

– carry network layer data of any network layer protocol (not just IP) at same time

– ability to demultiplex upwards

b) bit transparency: must carry any bit pattern in the data field

c) error detection (no correction)

d) connection liveness: detect, signal link failure to network layer

e) network layer address negotiation: endpoint can learn/configure each other’s network address

Page 27: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

PPP non-requirements

a) no error correction/recovery

b) no flow control

c) out of order delivery OK

d) no need to support multipoint links (e.g., polling)

Error recovery, flow control, data re-ordering all relegated to higher layers!

Page 28: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

PPP Data Frame

a) Flag: delimiter (framing)

b) Address: does nothing (only one option)

c) Control: does nothing; in the future possible multiple control fields

d) Protocol: upper layer protocol to which frame delivered (eg, PPP-LCP, IP, IPCP, etc)

Page 29: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

PPP Data Frame

a) info: upper layer data being carried

b) check: cyclic redundancy check for error detection

Page 30: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Byte Stuffing

a) “data transparency” requirement: data field must be allowed to include flag pattern <01111110>

– Q: is received <01111110> data or flag?

b) Sender: adds (“stuffs”) extra < 01111110> byte after each < 01111110> data byte

c) Receiver:

– two 01111110 bytes in a row: discard first byte, continue data reception

– single 01111110: flag byte

Page 31: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Byte Stuffing

flag bytepatternin datato send

flag byte pattern plusstuffed byte in transmitted data

Page 32: The Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Other Topics

a) Error recovery. Parity checking. Hamming distance.

b) Maximal channel utilization rate.

c) HDLC protocol (in more details).