1 / 91

Link Layer Protocols

Link Layer Protocols. Link Layer Services. Framing and link access: encapsulate datagram into frame implement channel access if shared medium, ‘physical addresses’ are used in frame headers to identify source and destination of frames on broadcast links Reliable Delivery:

jjane
Download Presentation

Link Layer Protocols

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Link Layer Protocols ICSS420 Data Link - MAC

  2. Link Layer Services • Framing and link access: • encapsulate datagram into frame implement channel access if shared medium, • ‘physical addresses’ are used in frame headers to identify source and destination of frames on broadcast links • Reliable Delivery: • seldom used on fiber optic, co-axial cable and some twisted pairs too due to low bit error rate. • Used on wireless links, where the goal is to reduce errors thus avoiding end-to-end retransmissions ICSS420 Data Link - MAC

  3. Link Layer Services (more) • Flow Control: • pacing between senders and receivers • Error Detection: • errors are caused by signal attenuation and noise. • Receiver detects presence of errors: • it signals the sender for retransmission or just drops the corrupted frame • Error Correction: • mechanism for the receiver to locate and correct the error without resorting to retransmission ICSS420 Data Link - MAC

  4. Link Layer Protocol Implementation • Link layer protocol entirely implemented in the adapter (eg,PCMCIA card). Adapter typically includes: RAM, DSP chips, host bus interface, and link interface ICSS420 Data Link - MAC

  5. Network Adapters • Network adapters, sometimes called Network Interface Cards (NIC), plug into the data bus on a computer and into a network cable • The NIC performs all of the functions required to communicate on a network • Some computers have a NIC built in ICSS420 Data Link - MAC

  6. Selecting a NIC • Before selecting a NIC for your computer, you need to determine three things: • What type of network are you connecting to? • What type of media (cable) are you using? • What type of bus does your computer have? • If you have a choice of bus, you will want to consider the performance of each bus and how will affect the NIC ICSS420 Data Link - MAC

  7. Error Detection ICSS420 Data Link - MAC

  8. Errors • Transmission errors are a way of life. • In the digital world an error means that a bit value is flipped. • An error can be isolated to a single bit. • Errors on some media come in bursts • Harder to detect and correct than isolated errors. ICSS420 Data Link - MAC

  9. Dealing with Errors • Error detecting codes • provide enough redundant information to enable the receiver to deduce that an error occurred • Error correcting codes • provide enough redundant information to enable the receiver to deduce that an error occurred AND how to fix it • So a message consists of m data bits and r redundant or check bits. ICSS420 Data Link - MAC

  10. Hamming Distance • Hamming distance: • the number of bit positions in which two codewords differ • Simple to calculate find the XOR • If two codewords are a Hamming distance d apart, it will require d single-bit errors to convert one into the other. • The Hamming distance of a code is the minimum Hamming distance between any two codewords. ICSS420 Data Link - MAC

  11. Hamming Distance 2 Code 000 011 101 110 • Note that not all of the 8 different bit patterns are included in the code • Any single error will not convert a valid codeword into another valid codeword. ICSS420 Data Link - MAC

  12. How Error Detection Works 2e Valid codeword Valid codeword Invalid Code Words ICSS420 Data Link - MAC

  13. Parity • A simple single error detecting code could be constructed by counting bits. • Any codeword with an even number of bits is consider valid (you could also make it the other way around). • The minimum distance of this code is 2, so it is capable of detecting single errors. • This code can be created by adding a parity bit: • chose the parity bit so that the number of ones in the codeword is even (or odd). ICSS420 Data Link - MAC

  14. Parity in Action Want to send: 10 Data Link Sends: 110 Receive: 111 (ERROR) ICSS420 Data Link - MAC

  15. Protecting Blocks • The probability of detecting a burst error on a block using a single parity bit is 50%. • This can be improved by viewing the block as a n by k bit matrix. • A parity bit is then computed for each column. • The check bits are placed in a k-bit row and affixed to the matrix as the last row. • Bursts of length n can be detected. ICSS420 Data Link - MAC

  16. Detecting Burst Errors Data 1001000 1100001 1101101 1101101 1101001 1101110 1100111 0100000 1100011 1101111 1100100 1100101 10010000 11000011 11011011 11011011 11010010 11011101 11001111 01000001 11000110 11011110 11001001 11001010 11001001 VRC (Vertical Redundancy Check) n LRC (Longitudinal Redundancy Check) ICSS420 Data Link - MAC

  17. What About Error Correction? • How do we get error correction? • Must increase the minimum distance of the code • The key to error correction is that it must be possible to detect and locate the error. • The minimum distance must be at least 2e+1 ICSS420 Data Link - MAC

  18. Error Correction The +1 ensures the circles will not overlap Valid codeword Valid codeword Invalid codewords ICSS420 Data Link - MAC

  19. A Simple Single Error Correcting Code ICSS420 Data Link - MAC

  20. Hamming Codes • Hamming codes are n-bit codes that can correct single errors. • The basic idea is to split the codeword into two portions • information or message bits (m) • parity bits (k) • The result are codewords that consist of m+k bits ICSS420 Data Link - MAC

  21. Choosing m and k • Selecting m is easy, you are usually told what it is. • How do you pick k? • The parity bits are used to generate a k-bit word that identifies where in the codeword the error, if any, occurred. • Consequently, k must satisfy the following: ICSS420 Data Link - MAC

  22. Constructing the Codeword • The codeword consists of m+k bits. • The location of each of the m+k bits is assigned a decimal value, 1 is assigned to the MSB, and m+k to the LSB. • Parity bits go in positions 1, 2, 4, …, 2k-1 m3 p0 p1 m0 p2 m1 m2 p3 m4 ... mm+k 1 2 3 4 5 6 7 8 9 ... m+k ICSS420 Data Link - MAC

  23. Parity Checks • The parity checks must be specified so that when an error occurs, the position number will take on the the value assigned to to location of the error ICSS420 Data Link - MAC

  24. Putting It Together ICSS420 Data Link - MAC

  25. Example Send the message 0010 using a hamming code Step 1: Find k. Here k=3 Step 2: Determine where things go Step 3: Figure out the parity bits p1 will cover 1,3,5,7,9,11,… p2 will cover 2,3,6,7,10,11,… p3 will cover 4,5,6,7,12,13,14,15,... ICSS420 Data Link - MAC

  26. Correcting Burst Errors • Hamming codes can be used to correct burst errors • A sequence of s consecutive codewords are arranged as a matrix, one codeword per row. • Transmit data one column (s bits) at a time. • The matrix is reconstructed by the receiver one column at a time. • If a burst error of size s occurs, only a single column will be affected. ICSS420 Data Link - MAC

  27. Correcting Burst Errors Character ASCII Check Bits H a m m I n g c o d e 1001000 1100001 1101101 1101101 1101001 1101110 1100111 0100000 1100011 1101111 1100100 1100101 00110010000 10111001001 11101010101 11101010101 01101011001 01101010110 01111001111 10011000000 11111000011 10101011111 11111001100 00111000101 s ICSS420 Data Link - MAC

  28. Correcting vs. Detecting • Most often error detection followed by retransmission is more efficient. • Consider a channel with an error rate is 10-6 per bit (one error per million bits sent) • Block size 1000 == 10 check bits ( k == 10 ) • For parity one check bit will suffice • Overhead for sending 1MB • Hamming == 10,000 bits • Parity == 2001 bits (since 1 block will be retransmitted) ICSS420 Data Link - MAC

  29. Cyclic Redundancy Check • The transmitter generates a bit pattern called a Frame Check Sequence (FCS), based on the contents of the frame. • The combined contents of the frame and the FCS are exactly divisible by some predetermined polynomial. • If the contents of the frame are damaged during transmission, the receiver’s division will yield a non-zero remainder. ICSS420 Data Link - MAC

  30. Cyclic Redundancy Check • CRC detects all of the following errors: • All single bit errors • All double bit errors if the divisor is at least three terms • Any odd number of errors, if the divisor contains a factor (x+1) • Any error in which the length of the error (an error burst) is less than the length of the FCS • Most errors with larger bursts ICSS420 Data Link - MAC

  31. Polynomials • CRC is based upon treating bit strings as representations of polynomials with coefficients of 0 and 1 only. • 11001 == x5+ x4+ x0 • A k-bit frame is regarded as the coefficient list for a polynomial with k terms, ranging from xk-1 to x0 ICSS420 Data Link - MAC

  32. The Generator Polynomial • Both the sender and the receiver must agree upon a generator polynomial, G(x). • Both the high and low order bits of the generator must be 1. • The length of the generator is one bit longer than the FCS. • Finally the frame must be longer than the generator. ICSS420 Data Link - MAC

  33. The Algorithm • The frame contents are appended by a set of 0s equal in number to the length of the FCS. • The resulting value is divided modulo 2 by the generator polynomial • Each division step is carried out in the conventional manner, except that the subtraction is done modulo 2. ICSS420 Data Link - MAC

  34. Modulo 2 Subtraction • Subtraction and addition are identical to XOR (no borrows or carries). 1 1 0 0 -1 -0 -1 -0 -- -- -- -- 0 1 1 0 1 1 0 0 +1 +0 +1 +0 -- -- -- -- 0 1 1 0 ICSS420 Data Link - MAC

  35. The Algorithm (continued) • The division produces a quotient which is discarded. • The remainder replaces the 0s appended to the frame (subtracted from the frame modulo 2). • The resulting frame is now evenly divisible by the generator polynomial. • The receiver performs the same division, a non-zero remainder indicates that an error occurred. ICSS420 Data Link - MAC

  36. CRC Example (transmit) Frame contents: 111011 Polynomial: 11101 (x4+ x3+x2 + x0) Frame with 0s: 1110110000 100001 11101 1110110000 11101 ----- 10000 11101 ----- 1101 Frame to send: 1110111101 ICSS420 Data Link - MAC

  37. CRC Example (receive) Frame contents: 1110111101 Polynomial: 11101 (x4+ x3+x2 + x0) 100001 11101 1110111101 11101 ----- 11101 11101 ----- 0 ICSS420 Data Link - MAC

  38. Standard Polynomials • CRC-12 (x12+x11+x3+x2+x1+1) • used when the character length is 6 • CRC-16 (x16+x15+x2+1) • CRC-CCITT (x16+x12+x5+1) • used for 8 bit characters • catches all single and double errors • all errors of an odd length • all bursts of 16-bits or less, 99.997% of 17-bits, and 99.998% of 18-bits and longer. ICSS420 Data Link - MAC

  39. Doing the Calculation Quickly • The CRC calculations are actually performed in a cyclic shift register that uses XOR gates. x5 x12 x16 MSB LSB CRC-CCITT Input ICSS420 Data Link - MAC

  40. Warning • All the analysis that has been done on CRC techniques assume the frames contain random bits. • Real data, however, is not all that random. • As a consequence, under some circumstances, undetected errors are much more common than had been previously thought. ICSS420 Data Link - MAC

  41. Multiple Access Links and Protocols Three types of links: (a) Point-to-point (single wire) (b) Broadcast (shared medium) (c) Switched ICSS420 Data Link - MAC

  42. Multiple Access Control (MAC) Protocols • MAC protocol: coordinates transmissions from different stations in order to minimize/avoid collisions • Channel Partitioning MAC protocols • Random Access MAC protocols • “Taking turns” MAC protocols • Goal: efficient, fair, simple, decentralized ICSS420 Data Link - MAC

  43. Channel Partitioning MAC protocols • TDM (Time Division Multiplexing): channel divided into N time slots, one per user; inefficient with low duty cycle users and at light load. • FDM (Frequency Division Multiplexing) ICSS420 Data Link - MAC

  44. Cocktail Party Analogy • TDM • Everyone stands in the middle of the room, taking turns talking • FDM • People group into widely separated clumps, each clumping holding a conversation at the same time, but still independent of the others. ICSS420 Data Link - MAC

  45. Code Division Multiple Access • CDMA • Used widely in wireless technologies • Allows each station to transmit using the same frequency • Cocktail party example • Everyone is talking at the same time, but in different languages ICSS420 Data Link - MAC

  46. Spread Spectrum • The bandwidth of a signal is increased by artificially increasing the bit data rate • This is done by breaking each bit into a number of sub-bits called "chips“ • Assuming this number is 10, each bit of the original signal would be divided up into 10 separate bits, or "chips." This results in an increase in the data rate by 10. By increasing the data rate by 10, we also increase the bandwidth by 10. ICSS420 Data Link - MAC

  47. Chipping Sequence • All users share the same frequency • A Unique N-bit “code” assigned to each user • Each bit is multiplied by the code and transmitted ICSS420 Data Link - MAC

  48. Channel Partitioning (CDMA) • Chipping sequence like a mask: used to encode the signal • encoded signal = (original signal) X (chipping sequence) • decoding: innerproduct of encoded signal and chipping sequence (note, the innerproduct is the sum of the component-by-component products) • To make CDMA work, chipping sequences must be chosen orthogonal to each other (i.e., innerproduct = 0) ICSS420 Data Link - MAC

  49. ICSS420 Data Link - MAC

  50. ICSS420 Data Link - MAC

More Related