Telematics Chapter 4: Data Link Layer
Total Page:16
File Type:pdf, Size:1020Kb
User Server Telematics watching with video video clip clips Chapter 4: Data Link Layer Application Layer Application Layer BeispielbildPresentation Layer Presentation Layer Session Layer Session Layer Transport Layer Transport Layer Network Layer Network Layer Network Layer Data Link Layer Data Link Layer Data Link Layer Physical Layer Physical Layer Physical Layer Prof. Dr. Mesut Güneş Computer Systems and Telematics (CST) Distributed, embedded Systems Institute of Computer Science Freie Universität Berlin http://cst.mi.fu-berlin.de Contents ● Design Issues ● Error Detection and Correction ● Elementary Data Link Protocols ● Sliding Window Protocols ● High Level Data Link Control (HDLC) ● Point-to-Point Protocol (PPP) ● Protocol Verification Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.2 Design Issues Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.3 Design Issues ● The data link layer has a number of spp,ecific functions, for this it OSI Reference Model ● provides a well-defined service Application Layer interface to the network layer ● deals with transmission errors Presentation Layer ● regulates the flow of data Session Layer ● access to the medium ● prevent a slow receiver being not Transport Layer swamped by a fast sender Network Layer Data Link Layer Phy sical Laye r Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.4 Layer 2: Division into two Parts Logical Link Control (LLC) (Layer 2b) − Organization of the data to be sent into frames − Guarantee (if possible) an error free transmission between neighboring nodes through: • Detection (and recovery) of transfer errors • Flow Control (avoidance of overloading the receiver) • Buffer Management Medium Access Control (MAC) (Layer 2a) − Control of the access to the communication channel in broadcast networks - LLC IEEE 802.2 Logical Link Control ... s g e n er Link n n u u yy r e e b La ANSI ATM h e c 802.3 802.4 802.5 802.6 i Data X3T9.5 Forum S MAC ... CSMA/CD Token Token ATM LAN (()Ethernet) Bus Ring DQDB FDDI Emulation ISO/OSI ConcreteReale Netze Networks Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.5 Services Provided to the Network Layer ● The data link layer provides services to the network layer ● Principal service is transferring data from the network layer of the source to the network layer of the destination machine Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.6 Services Provided to the Network Layer ● Communication of two processes on the network layer ● Virtual data path ● Actual data path Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.7 Services Provided to the Network Layer ● Service provided by the data link layer ● Unacknowledged connectionless service ● No logical connection beforehand ● Source sends independent frames ● Destination does not acknowledge frames ● Acknowledged connectionless service ● No logical connection beforehand ● Destination acknowledges frames ● Acknowledged connection-oriented service ● Logical connection beforehand ● Each sent frame is numbered ● Each sent frame is received once and in the right order Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.8 Services Provided to the Network Layer ● Placement of the data link protocol. Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.9 Services Provided to the Network Layer Router Packets here Routing process Routing process DLL DLL DLL DLL DLL DLL Process Process Process Process Process Process Frames here DLL Protocol Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.10 LLC: Frame Construction Organization of a message into uniform units (for simpler transmission) WllWell-dfiditftthl(l3)defined interface to the upper layer (layer 3) Marking of the units: Error check Header Data Trailer Frame Checking Sequence (FCS) Control information (addresses, frame numbers,…) MkthMark the fbframe by: Start and end flags Start flag and length Code injuries Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.11 LLC: Frame Construction ● Marking the start and end of a frame ● Character count ● Flag bytes with byte stuffing ● Starting and ending flags with bit stuffing ● Physical layer coding violations Byte/bit-stream Frames Frame 1 Frame 2 Frame 3 Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.12 Framing: Character Count ● Specify the number of characters in the frame Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.13 Framingggy: Flag Bytes with Character Stuffing ● The start and end of a frame is represented by a special flag byte. ● Problem: What happens if the flag byte occurs in the data? ● Byte stuffing/character stuffing ● A special escape byte (ESC) is inserted (stuffed) by the sender and removed by the receiver ● If the escape byte occurs in the data, then it is also stuffed Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.14 Framingggy: Flag Bytes with Bit Stuffing ● Character stuffing is bound to the character set (disadvantage)! ● General form: Bit stuffing ● Frames begin and end with a special pattern: 01111110 ● Sender inserts after five 1s a 0-bit, i.e., 011111x... ¨ 0111110x... and the receiiiver removes it Original data: Transmitted data: After destuffing: Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.15 Framinggy: Physical Lay er Coding Violations ● Only applicable if physical layer coding has some redundancy ● 1 bit data is encoded in 2 physical bits ● 1-bit coded as high-low, 0-bit coded as low-high, high-high and low-low are not used 1-bit 0-bit not used not used Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.16 Framing: Flow Control ● Scenario: Fast sender and slow receiver ● How to prevent a slow receiver swamped? ● Two approaches ● Feedback-based flow control ● Receiver sends information back to the sender giving permission to send more data ● Rate-based flow control ● Protocol limits t he rate o f data a se nde r may t ra ns mit wit h out f eedback fr om th e receiver Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.17 Error Detection and Correction Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.18 Error Detection and Correction ● Next task of the LLC layer: protected transmission of the frames to the communication partner ● The transmission over layer 1 is not necessarily free of errors! ● Errors tend to come in bursts rather than single ● Question: how can errors be recognized and repaired? ● Error-detecting codes ● Error-correcting codes (Forward Error Correction, FEC) ● Scenario ● A frame consisting of m data bits and r redundant (check) bits ● Total length: n = m + r ● The n-bit unit with data and check bits is called codeword Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.19 Error-detecting and -correcting Codes: Parity bits From the data, compute a short checksum and send it together with the data to the receiver. The receiver also computes a checksum from the received data and compares it with those of the sender. Simplest procedure - parity bit: count the number of 1s: Sender: 10111001 PB: 1 sent: 101110011 1-Bit errors are dddetected Receiver: 001011011 PB computed: 0 2-Bit errors are not detected Corrections are not possible! Variant: double parity Improvement of the parity bit procedure by further parity bits. For this, several blocks of bits are ggprouped and treated tog ether: Sender: 1011 1 Receiver: 1011 1 0010 1 0110 0 1100 0 1100 0 0110 0 0110 0 0011 0111 An incorrect bit can be identified and corrected by this procedure. Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.20 Error Detection Cyclic redundancy check (CRC) Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.21 Error Detection with Cyclic Codes Problem: how to recognize errors in several bits, especially sequences of bit errors? The use of simple parity bits is not suitable. However, in data communication (modem, telephone cables) such errors arise frequently. Most often used: Polynomial Codes m-1 Idea: a m-bit PDU (am-1, …, a0) is seen as a polynomial am-1x + … + a0 with the coefficients ai “0” and “1”. Example: 1100101 is interpreted as x6x5x4x3x2x1x0 ¨ x6 + x5 + x2 + 1 Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.22 Error Detection with Cyclic Codes ● For computations, polynomial arithmetic modulo 2 is used, i.e., addition and subtraction without carriaggpe. Both operations become Exclusive-OR (XOR) operations. ● PlPolynomi ilal ari ihthmeti c i s d one mod dlulo 2 ● Addition and subtraction are identical to exclusive OR (XOR), e.g. 10011011 00110011 11110000 01010101 + 11001010 + 11001101 - 10100110 - 10101111 01010001 11111110 01010110 11111010 Prof. Dr. Mesut Güneş ▪ cst.mi.fu-berlin.de ▪ Telematics ▪ Chapter 4: Data Link Layer 4.23 Error Detection with Cyclic Codes ● Idea for error detection: ● Sender and receiver agree upon a generator polynomial G(x) r r-1 1 0 G(x) = grx +gr-1x +…+ g1 x + g0x ● The first (g0) and the last (gr) coefficient have to be 1 r r-1 1 G(x) = x +gr-1x +…+ g1 x + 1 ● The sender interprets a data block of length m as polynomial M(x) m-1 1 0 M(x) = am-1x ++a+…+ a1x +a+ a0x ● The sender extends M(x), i.e., adds “redundant” bits in a way that the extended polynomial M’(x) is divisible by G(x) ● Redundancy = remainder R(x ) by division of the sequence with G(x ) ● The receiver divides the received extended M(x) by G(x).