Data Link LAYER Chapter 3
Services provided to network layer Unacknowledged connectionless service: Ethernet Acknowledged connectionless service: WiFi Acknowledged connection-oriented service: Telephone
Framing a)breaking up the bit stream into discrete frames b)compute a checksum for each frame c)Include the checksum in the frame when it is transmitted d)Recomputing the checksum when the frame is received. e)Comparing the recomputed and included checksums. f)Taking proper actions Frame recognition techniques: 1. Byte count. 2. Flag bytes with byte stuffing. 3. Flag bits with bit stuffing. 4. Physical layer coding violations
o Byte count o the byte count method is rarely used by itself
o Flag bytes + Byte stuffing o Same byte is sent before and after each fram. o If flag is occurred in frame data: o Byte stuffing : escape byte before the flag
o Flag bytes + bit stuffing o or 0x7E is used as flag byte o If 5 consecutive 1s occurred in frame data: o bit stuffing : a 0 bit is inserted after them. o Used in USB, and ZigBee protocols.
o Coding violation o use 1 out of 16 unused codes in 4B/5B coding for the flag. o Long Preamble o Use a long preamble (e.g. 72 bits in ) to allow the receiver to be synchronic with the sender.
Error Detection & Correction a)error-correcting codes also FEC (Forward Error Correction) b)error-detecting codes Error types: 1. Isolated single bit errors 2. Error bursts: harder to correct Also done in other layers. 8
Error Correcting Codes a)Block code: r check bits are computed solely as a function of the m data bits b)systematic code: the m data bits are sent directly, along with the check bits c)linear code: the r check bits are computed as a linear function of the m data bits total length of a block = n = m + r : (n,m) code or n-bit codeword code rate = m/n : typically Hamming distance: The number of bit positions in which two codewords differ To reliably detect d errors, you need a distance d + 1 code to correct d errors, you need a distance 2d + 1 code XOR
Error correction codes , , , Above code has a distance of 5 : it can correct double errors or detect quadruple errors For correcting all single bit errors in an m bit code:
Hamming code Bit position Encoded data bits p1p2d1p4d2d3d4p8d5d6d7d8d9d10d11p16d12d13d14d15 Pari ty bit cove rage p1XXXXXXXXXX p2XXXXXXXXXX p4XXXXXXXXX p8XXXXXXXX p16XXXXX
convolutional code Is not a block code. Depends on the previous bits in stream. The number of previous bits on which the output depends is called the constraint length. Used in GSM, Satellite, and NASA convolutional code of r = 1/2 and k = 7 Is not systematic Decoding is done with Viterbi algorithm that finds the input code with maximum likelihood to produce the observed code.
Reed-Solomon code Is based on fitting a polynomial to a number of points and then detect errors where some points do not fit to the curve. (255, 233) code is widely used. Can correct up to 16 symbol errors, so a 128 bit error burst can be corrected. Have strong error-correction properties, particularly for burst errors. Used for DSL, cable, satellite, and on CDs, DVDs, and Blu-ray discs. Often used in combination with convolutional code to provide good protection against both single and burst errors. LDPC (Low-Density Parity Check) code invented by Gallagher, Works with matrix manipulation. have excellent error-correction abilities. Used in digital video broadcasting, 10 Gbps Ethernet, power-line networks, and the latest version of
Error Detecting Codes 1.Parity 1 bit per code block. Can find single errors. Interleaving: n+1 bit error bursts may pass undetected. the probability of a bad block being accepted: n k
2. checksum 16-bit Internet checksum is a sum of the message bits divided into 16-bit words. The Internet checksum is computed in one’s complement arithmetic Sum Checksum: Sum Complement means that the pattern is O.K.
3. CRC (Cyclic Redundancy Check) also known as a polynomial code represents: addition and subtraction are identical to XOR. the sender and receiver agree upon a generator polynomial G(x) the frame must be longer than the generator polynomial append a CRC to the end of the frame in such a way that the checksummed frame is divisible by G(x). the receiver divides the received frame by G(x). If there is a remainder, there has been a transmission error.
CRC algorithm 1.Let r be the degree of G(x). Append r zero bits to the low-order end of the frame so it now contains m + r bits and corresponds to the polynomial x^r M(x). 2.Divide the bit string corresponding to G(x) into the bit string corresponding to x^r M(x), using modulo 2 division. 3.Subtract the remainder (which is always r or fewer bits) from the bit string corresponding to x^r M(x) using modulo 2 subtraction. The result is the checksummed frame to be transmitted. Call its polynomial T(x). The algorithm can catch all 1 bit errors. Can catch most 2 bit errors. Can catch all odd number of inverted bits. a polynomial code with r check bits will detect all burst errors of length ≤ r.
CRC example If error burst longer than r + 1 bits occurs the probability of a bad frame getting through unnoticed is ½^r IEEE802 CRC: 18
Elementary Data Link Protocols Definitions and Procedures required for a typical data link protocol. Provided in protocol.h
Utopian Simplex protocol
Simplex stop-and-wait protocol for error free
Simplex stop-and-wait protocol for noisy channel Also ARQ (Automatic Repeat reQuest) or PAR (Positive Acknowledgement with Retransmission)
Sliding Window Protocols 23 In full duplex links – ack frames can be sent along with data frames separated by kind field. –They can be delayed to be sent over a data frame using the ack field. Also called piggybacking. sending window: the set of sequence numbers the sender is permitted to send receiving window : the set of frames the receiver is permitted to accept A sliding window of size 1, with a 3-bit sequence number
One bit sliding window protocol 24
One bit sliding window protocol 25 Wasted bandwidth due to bad timing. (simultaneous transmissions)
Go-Back-N protocol a)The sender transmits up to w frames before blocking, instead of 1 (pipelining) b)Leads to better BW utilization c)BD=(bandwidth-delay product)/(frame size) d)To keep the channel full : w=2BD+1 Example: bandwidth = 50 kbps one-way transit time = 250 msecw=26 frame size = 1000 bits 26
Pipeline error recovery a) Receivers window = 1 b) receiver window > 1 (selective repeat) 27
Go-Back-N protocol 28
Go-Back-N protocol 29
Multiple timer implementation using a linked list 30
Selective Repeat Protocol 31
Selective Repeat Protocol 32
Receiver’s window size problem 33 The window size = (MAX SEQ + 1)/2
PPP (Point-to-Point Protocol) a)Over SONET 1. A framing method that unambiguously delineates the end of one frame and the start of the next one. It also handles error detection. 2. A link control protocol for bringing lines up, testing them, negotiating options. This protocol is called LCP (Link Control Protocol). 3. Negotiate network-layer options, by having a different NCP (Network Control Protocol) for each network layer supported. 34
a)HDLC (High-level Data Link Control) frame format is chosen but with byte stuffing rather than bit stuffing. b)HDLC provides reliable transmissions while PPP provides both reliable and unnumbered mode, which resembles connectionless unacknowledged service. c)All PPP frames begin with the HDLC flag byte of 0x7E ( ) d)0x7E in payload is escaped by replacing 0x7D 0x5E. e)Payload is scrambled for synchronization. 35 Bcast addr. Unnumbered frame Payload protocol: : IP frame 1----: LCP or NCP frame 1500 bytes max
Setting a PPP link up or down 36
Home work assignment StudentAssigned problems