390 likes | 577 Views
Chapter 11 Data Link Control. Application Presentation Session Transport Network Data Link Physical. Recall - OSI Reference Model. Node-to-node communications: Framing, Error Control, Flow Control, Physical Addressing, Access Control. Data Comm Layers.
E N D
Chapter 11 Data Link Control Fall 2009
Application Presentation Session Transport Network Data Link Physical Recall - OSI Reference Model • Node-to-node communications: • Framing, Error Control, Flow Control, Physical Addressing, Access Control Data Comm Layers Fall 2009
Major Data Link Tasks Node-to-node communication – design & procedures for communication between two adjacent nodes • Framing – the data link layer divides or organizes the raw bits provided by the physical layer into frames based on the particular technology – also adds a header to frame that specifies the address of the Tx and Rx • Flow Control – the data link layer make sure that the rate at which the Tx sends bits and frames to the Rx is a rate the Rx can handle. • Error Control - the data link layer adds some reliability to the physical layer by detecting and retransmitting damaged, duplicate or lost frames • Access Control – the data link layer determines which node has access to or control of the transport medium at any given time (sharing the transport). Fall 2009
FRAMING The data link layer needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of data from another; the envelope serves as the delimiter. Fall 2009
Fixed-Size Framing – no delimiter (ie. ATM cells) Variable-Size Framing– need a way to definestart and end of frame, twoapproaches: • Character-orientedapproach • Bit-orientedapproach Fall 2009
Flag separates the frames Uses characters NOT used for text 8-bit characters Header which carries Tx and Rx addresses and control info Trailer which carries error control redundant bits A Frame in a Character-Oriented Protocol Character-oriented protocol was popular when text was mostly transmitted (today, other type of data is sent (ie graphic, audio, video)) Fall 2009
Byte Stuffing and Unstuffing With the rise of the use of video, graphics and audio, the FLAG has less options to distinguish itself from the data section of the frame. So Byte-stuffing is used – adds a special byte to the data section of the frame when there is a character with the same pattern as the flag Data appearing to be FLAG and ESC before doing byte-stuffing The special byte added is ESC (escape character) Tx ESC that is part of the data section must also use byte-stuffing Rx When the Rx encounters the ESC, it removes it and treats the next character as data (and not a flag) Fall 2009
A Frame in a Bit-Oriented Protocol For bit-oriented approach, instead of a variable number of characters (bytes), there is a variable number of bitsfor the data section of the frame. For bit-oriented approach, instead of a bit pattern that varies, there is aSETpattern of bits for theFLAG Because of the SET pattern for the FLAG, that same pattern could show up in the data section Bit Stuffto break the pattern Bit Stuff by adding one extra 0 when five consecutive 1s follow a 0 in the data Fall 2009
Flow and Error Control The most important responsibilities of the data link layer are flow control and error control. Collectively, these functions are known as data link control. Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment. Error control in the data link layer is based on automatic repeat request (ARQ), which is the retransmission of data. The data link protocols are normally implemented in software. Fall 2009
Noiseless Channels • An ideal channel in which no frames are lost, duplicated, or corrupted. Two protocols for this type of channel are introduced: • Simplest Protocol, • Stop-and-Wait Protocol The design of the simplest protocol with no flow or error control On Tx side, DL gets the data from the Network layer and makes into frame and sends it On Rx side, DL gets the frame from the physical layer, extracts data from frame, delivers data to network layer The DL for the Tx and Rx are both constantly running because Tx DL doesn’t know when a request from the Network layer will occur and the Rx DL doesn’t know when the Physical layer will send a notification of a an arrival Fall 2009
Simplest Protocol Fall 2009
Stop-and-Wait Protocol Stop-And-Wait Protocol sends one frame stops until it receives confirmation from the Rx sends the next frame Stop-and-wait has flow control and simplest doesn’t ACK comes back letting the Tx know it can send the next frame If data frames arrive to the Rx too fast, could overflow the buffer causing frames to be dropped or denial of service Fall 2009
Noisy Channels Three protocols that use error controlfor noisy channels: Stop-and-Wait Automatic Repeat Request Go-Back-N Automatic Repeat Request Selective Repeat Automatic Repeat Request Fall 2009
Stop-and-Wait ARQ Protocol Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires. In Stop-and-Wait ARQ, sequence numbers are used to number the frames. The sequence numbers are based on modulo-2 arithmetic. In Stop-and-Wait ARQ, the acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame expected. Fall 2009 Modulo-2
Stop-and-Wait ARQ Protocol • Redundant bits are added for error control. • Seq # is added to detect if out of order or corrupted • Seq # and redundant bits added to ACK too – it could be in error or corrupted too • If Tx detect error via redundant bits, frame is discarded • If Tx detect out-of-order or corruption via seq #, frame is re-transmitted • ACK # announces the Seq# of the next frame expected – if frame 0 arrives, ACK is 1. If frame 1 arrives, ACK is 0 – only need 0 and 1 to distinguish between frames • Tx keeps copy of frame, if timer counts down before ACK received, it re-sends the frame Fall 2009
Pipelining • Pipelining is the process of starting another task before the previous task has ended – improves efficiency • Stop-and-Wait ARQ does not use pipelining • Go-Back-N ARQ and Selective Repeat ARQ do use pipelining Fall 2009
Tx – Send Window for Go-Back-N ARQ Several frames are sent from the Tx BEFORE the Tx receives an ACK from the Rx in keeping the channel busy A copy of each frame is kept by the Tx Sequence # can range from 0 to 2m-1 (where m is the # bits) – because the seq #s rotate, it uses modulo-2m Fall 2009
Go-Back-N ARQ • GBN-ARQ has a Fixed sizesliding window of 2m-1 • The sliding window defines the range of sequence numbers • TX and RX need to deal with only part of the possible sequence numbers Fall 2009
The sliding window in the following case, 15 • 4 possible regions for seq# • Far left shows that more than 1 frame can be ACK at a time – in this case, 3 frames were ACKed – so the window adjusts or slides Fall 2009
Rx - Receive window for Go-Back-N ARQ Rx window make sure the correct frames are received and the correct ACK are sent If frames arrive out-of-order, the frame is dropped (and needs to be re-transmitted) The Rx can send one cumulative ACK for several frames – in this case, if the Tx doesn’t receive an ACK within a certain time, it could re-send several frames Rx window size is always 1 Fall 2009
Go-Back-N ARQ Issues • Simplifies the process on the Rx side • Rx only keeps track of one variable – the next expected frame (others are dropped) • In-efficient because for noisy links there is a high probability frames will be damaged – needing to be re-sent • Re-sends multiple frames when one frame is damaged • Re-sending uses bandwidth and processing Fall 2009
Selective Repeat ARQ vs Go-Back-N ARQ Unlike Go-Back-N ARQ, Selective Repeat ARQ only re-sends the damaged frame when no ACK is received However for Selective Repeat ARQ, the Rx has more complex tasks than in the Go-Back-N ARQ case Selective Repeat ARQ’s send window size is much smaller than Go-Back-N ARQ’s send window size, 2m-1 versus 2m-1 Unlike Go-Back-N ARQ STATIC receive window of 1, the Selective Repeat ARQ’s receive window is the same size as the send window. Unlike Go-Back-N ARQ not being able to receive out-of-order frames, the Selective Repeat ARQ’s can receive out-of-order frames and stores them and delivery them to the network layer in-order Fall 2009
Tx - Send window for Selective Repeat ARQ Seq# can go up to 15, however, window size is only 8 Means less efficiency, however, also less frame duplication and re-sends Receive window for Selective Repeat ARQ Multiple fames can be received OUT-OF-ORDER and stored – and later delivered to network layer IN-ORDER Fall 2009
Piggybacking • Recall frames going back and forth between Tx and Rx (data frames) • Recall ACK and NAK going back from Rx to Tx (control info) • Piggybacking is COMBINING the data frames and control info into the same frames • Increases efficiency Fall 2009
HDLC High-level Data Link Control (HDLC) is a bit-orientedprotocol for communication over point-to-point and multipoint links. It implements the ARQ mechanisms already discussed. HDLC provides 2 Transfer Modes Normal Response Mode (NRM)– one primary station and multiple secondary stations – primary sends commands – secondary responds Asynchronous Balance Mode (ABM) – both the primary and secondary stations can act as a command-sender or responder Fall 2009
HDLC frames HDLC uses 3 different types of frames to send 3 different types of messages Flow & error control identifies start and end of frame I transport user data and control info (piggybacking) S only transport control info U reserved for system mgmt Frame check sequence – error detect user data or mgmt info Fall 2009
Control field format for the different frame types Control field determines the type frame and its functionality Poll, if going primary to secondary, Final for vice versa Type – 0 for I frame, 1 for S or U Seq# Ack# Code, type of s-frame Receive Ready – good frame received Receive Not Ready – ACK the frames and state it can’t receive more Reject – NAK frame Selective reject – selective repeat ARQ reject frame If first 2 are 10, S frame For the U frame, all 5 bits are used for the code Fall 2009
U-frame control command and response Fall 2009
POINT-TO-POINT PROTOCOL HDLC is a general protocol that can be used for both point-to-point and multipoint configurations One of the most common protocols for point-to-point access is the Point-to-Point Protocol (PPP).PPP is a byte-oriented protocol. Fall 2009
PPP Protocol • PPP is typically used to connect to the Internet via a modem and telephone line • PPP defines the format of the frame • PPP defines how 2 nodes negotiate the establishment of a link (and exchange) • PPP defines how the network layer is encapsulated in the data link frame • PPP defines how 2 nodes authenticate each other • PPP provides connections over multiple links • PPP provides a temporary network address • PPP does NOT provide flow control • PPP uses CRC for error detection Fall 2009
PPP frame format Shows start and end of frame Uses a broadcast address Carries user data or other info Defines how to interpret the payload field Error detection Not really used Fall 2009