Download presentation
Presentation is loading. Please wait.
1
The Data Link Layer
2
Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control
3
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
4
Functions of the Data Link Layer (2) Relationship between packets and frames.
5
Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.
6
Services Provided to Network Layer (2) Placement of the data link protocol.
7
Framing A character stream. (a) Without errors. (b) With one error.
8
Framing (2) (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.
9
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.
10
Sliding Window Protocols A One-Bit Sliding Window Protocol A Protocol Using Go Back N A Protocol Using Selective Repeat
11
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.
12
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.
13
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
14
GBN: sender extended FSM Wait start_timer udt_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)+1 If (base == nextseqnum) stop_timer else start_timer rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) base=1 nextseqnum=1 rdt_rcv(rcvpkt) && corrupt(rcvpkt)
15
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=1 sndpkt = make_pkt(expectedseqnum,ACK,chksum)
16
GBN in action
17
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
18
Selective repeat: sender, receiver windows
19
Selective repeat in action
20
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?
21
Example Data Link Protocols HDLC – High-Level Data Link Control The Data Link Layer in the Internet
22
High-Level Data Link Control Frame format for bit-oriented protocols.
23
High-Level Data Link Control (2) Control field of (a) An information frame. (b) A supervisory frame. (c) An unnumbered frame.
24
The Data Link Layer in the Internet A home personal computer acting as an internet host.
25
PPP – Point to Point Protocol The PPP full frame format for unnumbered mode operation.
26
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
27
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!
28
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)
29
PPP Data Frame a)info: upper layer data being carried b)check: cyclic redundancy check for error detection
30
Byte Stuffing a) “data transparency” requirement: data field must be allowed to include flag pattern –Q: is received data or flag? b)Sender: adds (“stuffs”) extra byte after each data byte c)Receiver: –two 01111110 bytes in a row: discard first byte, continue data reception –single 01111110: flag byte
31
Byte Stuffing flag byte pattern in data to send flag byte pattern plus stuffed byte in transmitted data
32
Other Topics a)Error recovery. Parity checking. Hamming distance. b)Maximal channel utilization rate. c)HDLC protocol (in more details).
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.