� ECEN 5032 Data Networks Data Link Layer Peter Mathys mathys@colorado.edu University of Colorado, Boulder Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.1/21
� Overview A number of specific functions are carried out by the data link layer (DLL): 1. Provide well-defined service interface to network layer. 2. Deal with transmission errors. 3. Regulate data flow from fast transmitters to slow receivers. To accomplish these goals, the DLL encapsulates the data to transmit (payload) into frames by adding a header and a trailer as follows: +--------+----------------------------+---------+ | Header | Payload (Data to transmit) | Trailer | +--------+----------------------------+---------+ : : :<------------------- Frame ------------------->: Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.2/21
� Virtual/Actual Communication Actual path must use physical medium, but virtual path is less distracting to visualize and to think about. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.3/21
� Services for Network Layer 1. Unacknowledged connectionless service. Frames are just sent and no acknowledgement from destination is expected. Frames with errors are dropped and higher layer is responsible for error recovery. 2. Acknowledged connectionless service. No logical connection is established, but each frame is individually acknowledged by the destination and can be retransmitted in the event of errors. 3. Acknowledged connection-oriented service. In this case source and destination establish connection before any data is transferred. Data link layer guarantees that each frame sent is received exactly once and in the right order. At the end connection needs to be released. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.4/21
� Use of Acknowledgements Providing acknowledgements at the data link layer is just an optimization , never a requirement. The network layer can always send a packet and wait for it to be acknowledged. But a packet may consist of 20 or 30 frames. If the probability that a frame is lost is high, it may take a long time to get the entire packet through. If frames are acknowledged individually, then only the erroneous frames need to be retransmitted. In general unacknowledged service works fine and reduces overhead if the error-rate is very low, e.g, on optical fiber networks. Unacknowledged service is also better for real-time traffic (e.g., voice over IP). If the error-rate of the transmission channel is high and/or errors occur in bursts, e.g., on a wireless channel, then acknowledged service is preferable. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.5/21
� Framing To provide service to network layer, data link layer must use service provided by physical layer. Physical layer accepts raw bit stream and attempts to deliver it to destination. Received bit stream is not error-free and some bits might be lost ( deletions ) or added ( insertions ). The usual approach is for the data link layer to break the bit sream up into discrete frames and compute a checksum (CRC/FCS) for each frame: :<------------------- n bits ------------------>: : : +--------+----------------------------+---------+ | Header | Payload (Data to transmit) | CRC/FCS | +--------+----------------------------+---------+ : : : :<-------------- k bits ------------->:<-- r -->: Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.6/21
� Framing Breaking a bit stream up into frames is more difficult than it at first appears. Four possible methods are: 1. Character (byte) count. Uses length field in header to specify length of frame. 2. Starting and ending flags with byte stuffing. 3. Flags with bit stuffing of data that could be mistaken for flag. 4. Physical layer coding violations, e.g., consecutive positive pulses in AMI signal. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.7/21
� Length-Based Framing Problem if error during transmission occurs. Resynchronization virtually impossible. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.8/21
� Length-Based Framing DECNET DDCMP (Digital Data Communications Message Protocol). If several frames are sent in succession, this is similar to a linked list. If one of the links is affected by a transmission error, resynchronization is difficult. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.9/21
� Flag-Based Framing If synchronization is lost, receiver looks for flag byte. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.10/21
� �✁ ✂ � �✁ ✄ Byte/Bit Stuffing When arbitrary binary data is sent, occurrence of the flag in the data must be prevented. One way to solve this problem is to use an escape character (ESC) before each flag byte pattern in the data. This is called byte or character stuffing. Bit stuffing. Flag is 01111110 ( ). If occurs in data, a 0 bit is stuffed in at the transmitter and removed at the receiver. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.11/21
� Character-Based Framing IBM BISYNC (Binary Synchronous Communications). Three types of characters: (i) Text (keyboard) characters (A,B,C,...), (ii) Terminal control characters (CR, LF , BS, ...), (iii) Communication control characters (SYN, STX, ETX, DLE, ...). Frame boundaries are found by looking for STX, ETX that cannot occur in ASCII text. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.12/21
� Character-Based Framing IBM BISYNC in transparent mode in which arbitrary binary data can be sent. DLE (data link escape) precedes each control character. If DLE occurs in data it is repleaced by DLE DLE (character stuffing). Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.13/21
�✁ ✂ � � Bit Stuffing Frame structure of HDLC (High-level Data Link Control). Flag is 01111110 ( ). Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.14/21
☎ ☎ � ✝✞ �✁ ✂ � ✁ �✁ Bit Stuffing Bitstuffing rule: Insert 0 after occurrence of 5 consecutive 1’s. Additional features: indicates normal frame termination. ✄✆☎ indicates “abort frame”. or more ones is regarded as idle link. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.15/21
� Finite State Machine Finite state machine (FSM) representation of stop-and-wait ARQ protocol. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.16/21
� Petri Net for Stop-And-Wait Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.17/21
� Efficiency There are two different aspects for ARQ protocols: 1. Correctness : Does the protocol succeed in releasing each packet once and only once without errors to the network layer? 2. Efficiency : How much of the capacity of the physical layer is wasted by waiting and retransmissions? General strategy to increase efficiency is for sender to have window of frames that can be transmitted while ACKs are still outstanding. Receiver could also have window of frames that can be accepted out of order. Note: Windows require that DLL has sufficient buffer capacity. Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.18/21
� � Pipelining and Error Recovery Effect of error when receiver window size is 1. This protocol is called go back ARQ . Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.19/21
� � � ✁ � Go Back n ARQ Example Go back ARQ with . Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.20/21
� � ✁ � Pipelining and Error Recovery Effect of error when receiver window size is . This protocol is called selective repeat ARQ . Data Networks, Data Link Layer, c 1996–2005, P . Mathys – p.21/21
Recommend
More recommend