Ethernet Carrier Sense Multiple Access with Collision Detection Giuseppe Bianchi Ethernet Ancestors Late 1960: ALOHA network Norman Abramson, University of Hawaii Application: radio network among islands Distributed, uncoordinated network! First random access mechanism (Pure aloha / Slotted aloha) Giuseppe Bianchi Birth of Ethernet May 22, 1973: Ethernet memo Bob Metcalfe (Xerox Palo Alto Research Center) Carrier Sense Multiple Access with Collision Detection and expo backoff 3 mbps speed US Patent 4.063.220 “Multipoint Data Communication System with Collision Detection” end 1977 Giuseppe Bianchi On the birth of Ethernet [quoting from Ethernet – The definitive guide”]: In late 1972, Metcalfe and his Xerox PARC colleagues developed the first experimental Ethernet system to interconnect the Xerox Alto, a personal workstation with a graphical user interface. The experimental Ethernet was used to link Altos to one another, and to servers and laser printers. The signal clock for the experimental Ethernet interface was derived from the Alto's system clock, which resulted in a data transmission rate on the experimental Ethernet of 2.94 Mbps. Metcalfe's first experimental network was called the Alto Aloha Network. In 1973 Metcalfe changed the name to "Ethernet," to make it clear that the system could support any computer--not just Altos--and to point out that his new network mechanisms had evolved well beyond the Aloha system. He chose to base the name on the word "ether" as a way of describing an essential feature of the system: the physical medium (i.e., a cable) carries bits to all stations, much the same way that the old "luminiferous ether" was once thought to propagate electromagnetic waves through space. Thus, Ethernet was born. Giuseppe Bianchi Ethernet Standardization: from DIX to 802.3 1980: DIX Ethernet Standard DIX = Digital-Intel-Xerox vendor consortium Interoperable products from the three founding companies 1982: Xerox relinquish “Ethernet” trademark 1985: IEEE 802.3 Ethernet becomes an IEEE 802 standard Minor modifications vs DIX standard Path towards worldwide interoperability Speed: 10 mbps Medium: Thick coaxial, 500 mt max cable (10BASE5) Thin coaxial, 185mt max cable (10BASE2) Network extension via repeaters (up to a max limit) Thick-RG213 Thin-RG58 Ethernet standard: the world’s FIRST open, multi-vendor standard! Quoting Metcalfe: “the invention of Ethernet as an open, non-proprietary, industry-standard local network was perhaps even more significant than the invention of Ethernet technology itself” Giuseppe Bianchi A note on Ethernet terminology speed Signal method medium EXAMPLE: 100Base-T, 1000Base-LX, … Speed 10, 100, 1000, 10G Signal method Base, Broad Broad = RF modulated on coax » only one case: 10BROAD36, now obsolete Medium Old notation: 2,5 = 200/500 mt (thin/thick coax) More recent notation: T, Tx, T4, T2, FX, X, CX, SX, LX Depends on which specific twisted pair category & fibre category; Different labels (e.g. T, TX, T4, T2) account for different encoding details Giuseppe Bianchi Historical Ethernet topology: bus Multiple Access shared transmission medium thick / thin coaxial cable A B C A Giuseppe Bianchi D B C E D F E F Ethernet transceiver (10base-5) Giuseppe Bianchi Ethernet transceiver (10Base-2) Giuseppe Bianchi Breakthrough idea (1990) A B C D E Multi-Port Repeater (HUB) A B Giuseppe Bianchi F Collapsed Backbone From Bus To Star topology C D E F Twisted Pair revolution 1990: 802.3i 10BASE-T twisted pair Invented by SynOptics Communications Alternatives Reuse structured cabling UTP (Unshielded) system standards FTP (Foiled) Overcomes management and installation 1 shield for all the cable problems from coaxial cabling STP (Shielded): Ethernet market takes-off!! One shield per pair Giuseppe Bianchi Ethernet RJ45 connector Giuseppe Bianchi Signal transmission & reception on twisted pair Pair 3 used for transmission Pair 2 used for reception Pairs 1 & 4 unused In 10Base-T & 100Base-T(x) Ethernet Used in 1000Base-T Giuseppe Bianchi Straight & crossover RJ45 meant to connect PC to Hub What About PC to PC or Hub to Hub connection? Giuseppe Bianchi Ethernet Frame 64-1518 bytes 8 bytes preamble 14 bytes Ethernet header 6 bytes Destination address 46-1500 bytes 4 bytes DATA FCS 6 bytes 2 bytes Source address Type Preamble: For bit-level and frame-level synchronization Destination address: Who’s this frame for (who is the intended receiver) Hardware address (48 bits address of the network interface card) Source address: Who’s this frame from (who is the transmitter) Hardware address (48 bits address of the network interface card) Type: Which type of information is carried by the frame (which upper layer protocol) Frame Check Sequence Verifies if the frame has been received properly (not corrupted) Giuseppe Bianchi Transmission of bits Idea: send data + clock in the same signal! 10 mbps Manchester encoding 1 0 1 1 0 0 When a frame is being transmitted, a signal level transition occurs every 0,2 ms Allows to detect when transmissions are NOT occurring on the channel (IDLE channel) Giuseppe Bianchi Preamble (10 mbps) 8 bytes 7 bytes preamble 7 x (10101010) square wave @ 5 MHz for clock recovery Last byte: SFD (Start Frame Delimiter) 1 x (10101011) signals the start of the frame SFD bit sequence 1 0 Manchester Encoding Giuseppe Bianchi 1 0 1 0 1 1 48 bit addresses Typically referred to as Interface address Hardware address MAC address First bit: 0 = physical address of an interface Unicast address 1 = group address Second bit: 0 = globally administered address Assigned by the manifacturer 1 = locally administered address First 24 bits: OUI (Organization Unique Identifier) (unique for each vendor) Typically written in hex e.g.: F0-11-00-4F-A2-1C Each byte transmitted from LSB to MSB 0000.1111.1000.1000.0000.0000. 1111.0010.0100.0101.1000.0011 Can be configured through driver mcast addresses: start with 1 (first octet LSB!) Why destination first? Station who does not match dest may ignore rest of frame! Giuseppe Bianchi Examples Individual unicast: xy-xx-xx-xx-xx-xx y multiple of 4 802.3 & 802.4: transmitted from LSB to MSB 802.5 & FDDI: transmitted from MSB to LSB Giuseppe Bianchi Multiple Access: Ethernet vs Aloha Aloha: Transmit without listening Ethernet: Listen before transmitting Regardless of channel activity Transmit only if channel idle Transmit all the frame Listen while transmitting, and stop transmission if collision is detected Giuseppe Bianchi Ethernet vs Aloha: listen before tx A ALOHA B A ETHERNET B Listen before transmit Giuseppe Bianchi Ethernet vs Aloha: collision handling A ALOHA B Collision lasts until the end of the transmitted frames; waste of channel capacity A ETHERNET B Detect collision; enforce collision with JAM sequence; end transmission Giuseppe Bianchi Carrier Sense Multiple Access 1. Listen before talking 1. NIC ready to transmit a frame 3. Transmit frame IFS 2. Listen for at least an Inter Frame Spacing (channel must be idle meanwhile) Giuseppe Bianchi Ethernet Notation = Inter Packet Gap (IPG) 802.3 Notation = Inter Frame Spacing (IFS) Minimum: 96 bits (@ 10 Mbps = 9.6 ms) Carrier Sense Multiple Access 2. If channel detected busy: defer 1. Frame ready 3. Busy Detect 4. Defer 5. Listen for ≥ IFS 2. Listen (similar defer situation if channel immediately busy) Giuseppe Bianchi Collision Detection 3. Listen while talking If collision detected: Continue to transmit other 32 bits of signal (Collision Enforcement Jam Signal) Collision detection: media-dependent On coax: Monitor average DC voltage When more than 1 station transmits, voltage gets greater than given threshold On point-to-point fiber or twisted pair links: Collision detected by the simultaneous occurrence of activity on both transmit and receive paths Giuseppe Bianchi Why collisions occur? distance d (m) prop delay d/200 ms Start tx IFS IFS Start tx Detect collision Jam sequence Detect coll. Jam seq. Collision occurs if stations access the channel in instants of time which differ for less than their mutual propagation delay time Speed of EM signal in cable: ~200.000 km/s 200m/ms Giuseppe Bianchi When a frame is “too short”… prop delay d/200 ms Start tx IFS IFS Can’t detect collision!! Thinks Tx was OK Start tx Collision! Detect collision time Transmitting Station Giuseppe Bianchi Destination station Interferer Network diameter Stations placed at opposite network edges Essential condition: a station MUST be able to detect a collision Shortest possible frame: 6+6+2+46+4 = 64 bytes = = 512 bits (excl preamble) 64 bytes Condition on network diameter: a collision MUST be detected on shortest possible frame Bound on maximum RTT 512 bits frame RTT=2 x prop must be lower than 512 bits tx time @ 10 Mbps: 512/10 [ms] > 2d [m] / 200 [m/ms] d < 5120 [m] @ 100 Mbps: 512/100 [ms] > 2d [m] / 200 [m/ms] d < 512 [m] NETWORK DIAMETER REDUCES AS SPEED INCREASES!! Giuseppe Bianchi Network diameter in practice Max RTT lower than 51,2 ms 802.3 standard max RTT = 46,38 ms Max link length Thick coax up to 500 mt Fiber link betw. repeaters up to 2 km Transceiver cable up to 50 mt Topological limits 5-4-3 rule: between any two nodes on the network, there can only be a maximum of five segments connected through four repeaters only three of the five segments may contain user connections. Repeaters add delay! Must account for repeater delays Min_TX_time > 2 x d/200 + N x Repeater_delay MAX network diameter for 10Base-5: 2800 mt Giuseppe Bianchi The need for random backoff A IFS IFS IFS IFS B Retransmission after collision must occur at different instant of times Otherwise collision will repeat forever Deterministic rule? Hard, for a fully distributed mechanism Idea: generate a random time after a collision Different stations will extract (sooner or later) different backoff times Giuseppe Bianchi Rationale for backoff “slots” Detect coll & Jam Detect coll & Jam Max RTT delay: < 51,2 ms Retransmit immediately (neglect IFS for simplicity) Schedule Retransm After random time T… … busy channel: defer! T greater or equal than 51,2 us NO COLLISION with another STA that has immediately rtx-ed T greater or equal than N x 51,2 us NO COLLISION with another STA that rtx-ed at (N-1) x 51,2 Giuseppe Bianchi Backoff slot-time First 64 bytes Remaining frame bytes (up to 1518 minus 64) Set to 512 bits As minimum frame size Collision possible Collision impossible As maximum RTT (Late Collision) guarantees that 1) A station transmitting at the beginning of the previous backoff slot will be ALWAYS detected; 2) A station transmitting for more than 512 bytes will acquire for sure the channel o o No “late collision” possible If they occur misconfiguration or hardware failures Ethernet Backoff rule: extract a DISCRETE value B, and schedule transmission at time B x 51,2 us Giuseppe Bianchi Ethernet (truncated) Exponential backoff rules Once a frame collides: End transmission with Jam signal Let N be the retry index N=0 for a new frame; N=1 for first rtx; N=2 for second rtx, etc Abort transmission after N=16 unsuccessful retries Let K=min(10,N) Extract a random integer number R in the range: 0 ≤ R < 2K Example: if K=6, extract R in (0, 31) Max range: when K=10 R in (0, 1023) Schedule retransmission at time: Backoff = R x 51,2 us (10 mbps case) » Where 51,2 us = tx time of 512 bits @ 10 Mbps » 100 Mbps Ethernet: slot-time = 5,12 us Retransmit at given time only if channel idle (otherwise defer until channel becomes idle for an IFS) Giuseppe Bianchi Ethernet (R)Evolution From multiple access to point-to-point collision-free networks Giuseppe Bianchi Ethernet Repeaters Physical layer device 3R functions Re-Shaping Restores the proper signal waveform Re-Timing Restores the proper impulse duration (clock recovery) Re-Transmitting Retransmits signal on “other” port Regardless of who’s the signal intended for D C R B A sends frame to B C & D receive signal, too Giuseppe Bianchi A Repeaters & collisions Retransmits collisions, too Actually, regenerates (extending them to 96 bits) 010101… jam sequences And generates collisions when signal is received simultaneously on both ends D C R B A A sends frame to B C sends frame to D Repeater generates collision (Jam signal) on both links Giuseppe Bianchi Multi-port repeater (hub) Signal regenerated & retransmitted on all repeater ports except the port from which the signal has arrived R Giuseppe Bianchi Multiport repeaters star topology Coax & transceivers no more necessary! 1990: emergence of 10Base-T technology Transmission medium = twisted pair point-to-point link Hub distributes signal across all stations Giuseppe Bianchi Hub-based star topologies: Why collision detection? How collision is detected? D AC BD A RX TX TX HUB RX A&B detect collision by listening on RX RX TX TX B Giuseppe Bianchi Signal-level collision occurs on C&D RX links RX C Ethernet bridge Data-link layer device Signal retransmission takes into account destination address D C B B A A sends frame to B; Bridge recognizes that station B is on the same side the signal has been received and DOES NOT retransmit D C B B A A sends frame to D; Bridge recognizes that station D is on the other side: retransmits Giuseppe Bianchi Multiport bridge Switch HUB broadcasts signal on all links Logically behaves as a bus Only one tx at a time A HUB B SWITCH Repeats signal on specifically addressed link Bridging function Many tx-rx pairs at a time More bw! Giuseppe Bianchi A C D E F E F SWITCH B C D Switches & collisions A sends frame to C; D sends frame to E No collision Simultaneous transmission occurs SWITCH A B C D E F E F A sends frame to C; E sends frame to C SWITCH Switch understand that two frames are destined to a same link “Collision” solved by buffering one frame & transmitting the other Giuseppe Bianchi A B C D Broadcast domain vs collision domain HUB Switch HUB Without Switching With switching Collision Domain LAN Collision Domain Broadcast Domain Giuseppe Bianchi Collision Domain Switch Collision Domain Collision Domain Broadcast Domain Full-duplexing Switched star network: only possible collision is on a same link When both station and switch simultaneously start transmission But rx and tx are carried out on different pairs collision is fictitious detected by the network interface card (activity sensed on Rx pair while NIC is transmitting) But it is not a real collision between the signals! it would be with a central hub; it is not with central switch 1997: full duplex standard (802.3x) Simultaneously transmit and receive (2x speed increase) In a switched star network collision is no more possible!! CSMA/CD no more necessary Network diameter no more a concern Arbitrary increase of the link speed is now possible! 1998-1999: Gigabit Ethernet 2002 (july): 10 GigaEthernet Ethernet in the metropolitan area (e.g. Fastweb, Telecom IT) Future: 40 Giga-Ethernet, 160 Giga-Ethernet Giuseppe Bianchi Buffering A B A A A B C D D C A D A Giuseppe Bianchi X B C D buffering A B A A A B C D D A D Giuseppe Bianchi A X B C C D buffering A B A A A B C D D A D Giuseppe Bianchi A X B C C D buffering A B A A A A B C X D D D Giuseppe Bianchi A B C C D buffering A B A A A A B C D D Giuseppe Bianchi D X A B C D C Buffers Solve output port contention 1 packet transmitted Other stored in waiting line May have finite capacity Max number of stored bytes or packets Introduce loss!! Packet arriving when buffer full gets lost Introduce latency!! Latency is NOT deterministic, but statistical QUEUEING THEORY: we need a mathematical tool to quantitatively evaluate loss/delay introduced by networking devices …. and much more Giuseppe Bianchi Bridge/Switch operation Preamble + SFD DEST lookup SRC LEN or type Data PAD FCS Store & Forward: read frame (memorize into onboard buffer) Check CRC Discard frame if » CRC fails » too short (<64 bytes, “runt”) » too long (>1518 bytes, “giant”) Look up destination into forwarding (switching) table Forward packet to outgoing port Cut-through Just read first few bytes (until destination address) Don’t do any check Look up forwarding table and select destination forward frame while receiving it Giuseppe Bianchi Store & forward vs cut-through latency 1518 bytes frame Assume full 8 bytes preamble received S&F @ 10 mbps ≥ 1526*8/10 ms = 1222 ms C-T @ 10 mbps ≥ 14*8/10 ms = 11.2 ms S&F @ 100 mbps ≥ 122 ms C-T @ 100 mbps ≥ 1.1 ms Not a real problem at high rate Giuseppe Bianchi S&F vs CT: Fragment-free mode Compromise between cut-through and store-andforward Reads first 64 bytes includes the frame (+LLC) header Then starts send packet before the entire data field is read and the FCS is checked. Advantages: Verify reliability of header information (addresses, frame type, LLC header information) Detects & discards runts & collisions Preamble + SFD DEST SRC Cut-through Giuseppe Bianchi LEN or type Data Fragment-free PAD FCS Store & Forward Further issues with C-T Cut-through possible only if source and destination ports have same bit rate Symmetric switching. Different rates buffering necessary S&F only Asymmetric switching Asymmetric switching typical in client/server environments More bandwidth dedicated to the server port to prevent a bottleneck Giuseppe Bianchi Forwarding database Mapping between MAC addresses and ports Ports: module/port-# Static entries: Configured by sysadmin Permanent database Dinamic entries: “Learned” Expire after ageing process reaches upper value E.g. 300 seconds configurable Giuseppe Bianchi Dest MAC Address ----------------00-00-08-11-aa-01 00-b0-8d-13-1a-f1 a8-11-06-00-0b-b4 08-01-00-00-a7-64 00-ff-08-10-44-01 Ports ----1/1 1/7 2/3 2/4 2/6 Age --1 4 0 1 5 Address Learning /1 STA 1 00-11-22-33-44-01 P1 00-11-22-33-44-01 08-55-66-77-88-02 08-aa-bb-cc-dd-03 08-01-02-f1-f2-04 P1 P1 P2 P3 P3 STA 4 08-01-02-f1-f2-04 STA 2 08-55-66-77-88-02 P2 Frame arrives at port X Hence it has come from LAN attached to port X Giuseppe Bianchi STA 3 08-aa-bb-cc-dd-03 SRC address used to update forwarding DB SRC MAC Port Address Learning /2 STA 1 00-11-22-33-44-01 P1 STA 2 08-55-66-77-88-02 00-11-22-33-44-01 08-55-66-77-88-02 08-aa-bb-cc-dd-03 08-01-02-f1-f2-04 08-00-0f-cc-cc-a2 P1 P1 P2 P3 P1 5 7 0 6 0 P3 STA 4 08-01-02-f1-f2-04 P2 08-00-0f-cc-cc-a2 Incoming frame whose SRCaddr not in forwarding DB: Create new entry Ageing-time=0 Giuseppe Bianchi STA 3 08-aa-bb-cc-dd-03 Incoming frame whose SRCaddr already in forwarding DB: Refresh ageing-time Ageint-time=0 Address Learning /3 STA 1 00-11-22-33-44-01 P1 STA 2 08-55-66-77-88-02 00-11-22-33-44-01 08-55-66-77-88-02 08-aa-bb-cc-dd-03 08-01-02-f1-f2-04 08-00-0f-cc-cc-a2 08-00-0f-cc-cc-a2 P1 P1 P2 P3 P1 P2 5 7 4 6 2 0 P3 STA 4 08-01-02-f1-f2-04 P2 08-00-0f-cc-cc-a2 STA 3 08-aa-bb-cc-dd-03 Giuseppe Bianchi Incoming frame whose SRCaddr already in forwarding DB but associated to different port: Update associated port Refresh ageing time Frame forwarding Very first operation performed by the bridge/switch upon frame reception Before learning Preamble + LEN or DEST SRC SFD type Data PAD FCS 1. Frame OK? Port X CRC check Only for Store & Forward 2. Incoming port enabled (in forwarding state)? Switch port may be disabled e.g. to isolate malfunctioning stations/LANs Port Y 3. If DEST is NOT in forwarding DB broadcast frame (flooding) forward frame to all ports EXCEPT incoming one 4. If DEST is in forwarding DB Check whether DEST port = incoming port If YES, discard packet (dest on same LAN of src) If NO, forwards packet to output port » Unless output port blocked Flooding occurs also for broadcast frames (obvious) and for multicast frames (unless more sophisticated policies are set) Giuseppe Bianchi Example / 1 start-up P1 P3 P2 Initial state: forwarding DB = empty Giuseppe Bianchi Example / 2 STA 1 STA 2 STA 1 00-11-22-33-44-01 00-11-22-33-44-01 P1 P1 0 P3 P2 STA 1 transmits frame to STA 2 Flooding occurs (STA2 not registered in DB) Bridge learns STA1=P1 Giuseppe Bianchi Example / 3 STA 2 STA 1 STA 1 00-11-22-33-44-01 00-11-22-33-44-01 00-aa-bb-cc-dd-02 P1 P1 P3 STA 2 00-aa-bb-cc-dd-02 2 0 P3 P2 STA 2 may respond depends on involved protocol/app rules (e.g. TCP handshake) transmits frame to STA 1 Destination selected Bridge learns STA2=P3 Giuseppe Bianchi Example / 4 STA 3 STA 1 STA 1 00-11-22-33-44-01 P1 00-11-22-33-44-01 00-aa-bb-cc-dd-02 08-80-f0-00-ff-03 P1 P3 P1 12 10 0 STA 2 00-aa-bb-cc-dd-02 P3 STA 3 08-80-f0-00-ff-03 P2 STA 3 on LAN 1 transmits to STA 1 Frame arrives to STA1 on LAN 1 But arrives also to Bridge Bridge discards frame (STA1 on same port of incoming frame) This operation is referred to as FILTERING FUNCTION Bridge learns STA3=P1 Giuseppe Bianchi Example / 5 STA 1 moves; STA 1 STA 3 P1 00-11-22-33-44-01 00-aa-bb-cc-dd-02 08-80-f0-00-ff-03 00-11-22-33-44-01 P1 P3 P1 P2 13 11 1 0 STA 2 00-aa-bb-cc-dd-02 P3 STA 3 08-80-f0-00-ff-03 P2 STA 1 00-11-22-33-44-01 STA 1 moves on LAN 2 Then transmits to STA 3 Frame arrives to Bridge on P2, and forwarded to P1 According to forwarding DB information Bridge learns that STA 1 moved Deletes previous entry with P1 Adds new entry with P2 Giuseppe Bianchi Example / 6 STA 2 moves; STA 1 STA 2 ??? STA 2 00-aa-bb-cc-dd-02 P1 00-aa-bb-cc-dd-02 08-80-f0-00-ff-03 00-11-22-33-44-01 P3 P1 P2 13 3 2 P3 STA 3 08-80-f0-00-ff-03 P2 STA 1 00-11-22-33-44-01 STA 2 moves on LAN 1 STA 1 transmit frame to STA 2 Frame forwarded on old port P3!! Bridge will learn only when STA2 will transmit first frame OR when ageing time will expire and STA2 P3 entry will be removed from forwarding DB Giuseppe Bianchi Why a station should move? Fault-tolerant architectures! P1 P2 Link 1 Link 2 As link 1 fails, server switches on link 2 server MOVES from original port P2 to new port P1 !! (need to reduce ageing time – but trade-off required: too short ageing time, too much burden on switch) (effective solution: i) periodically send “advertisement” frames ii) send frame after switching to link 2) Giuseppe Bianchi Wireless LANs (Wi-Fi) Just a very basic overview Giuseppe Bianchi WLAN history Original goal: Deploy “wireless Ethernet” First generation proprietary solutions (end ’80, begin ’90): WaveLAN (AT&T) HomeRF (Proxim) Abandoned by major chip makers (e.g. Intel: dismissed HomeRF in april 2001) IEEE 802.11 Committee formed in 1990 Charter: specification of MAC and PHY for WLAN First standard: june 1997 1 and 2 Mbps operation Reference standard: september 1999 Multiple Physical Layers Two operative Industrial, Scientific & Medical (ISM) shared unlicensed band » » 2.4 GHz: Legacy; 802.11b/g 5 GHz: 802.11a 1999: Wireless Ethernet Compatibility Alliance (WECA) certification Later on named Wi-Fi Boosted 802.11 deployment!! Giuseppe Bianchi WLAN data rates Legacy 802.11 Work started in 1990; standardized in 1997 1 mbps & 2 mbps The 1999 revolution: PHY layer impressive achievements 802.11a: PHY for 5 GHz published in 1999 Products available since early 2002 802.11b: higher rate PHY for 2.4 GHz Published in 1999 Products available since 1999 Interoperability tested (wifi) 2003: extend 802.11b 802.11g: OFDM for 2.4 GHz Published in june 2003 Products available, though no extensive interoperability testing yet Backward compatibility with 802.11b Wi-Fi Ongoing standardization effort: 802.11n Launched in september 2003 Minimum goal: 108 Mbps (but higher numbers considered) Giuseppe Bianchi Standard Transfer Method Freq. Band Data Rates Mbps 802.11 legacy FHSS, DSSS, IR 2.4 GHz, IR 1, 2 802.11b DSSS, HRDSSS 2.4 GHz 1, 2, 5.5, 11 "802.11b+" non-standard DSSS, HRDSSS, (PBCC) 2.4 GHz 1, 2, 5.5, 11, 22, 33, 44 802.11a OFDM 5.2, 5.5 GHz 6, 9, 12, 18, 24, 36, 48, 54 802.11g DSSS, HRDSSS, OFDM 2.4 GHz 1, 2, 5.5, 11; 6, 9, 12, 18, 24, 36, 48, 54 Why multiple rates? “Adaptive” (?) coding/modulation Example: 802.11a case Giuseppe Bianchi Wireless Medium Unreliability 11 Mbps 802.11b outdoor measurements - Roma 2 Campus - roof nodes Giuseppe Bianchi Must rely on explicit ACKs Successful DATA transmission: ONLY IF an ACK is received ACK transmission provided by MAC layer Immediate retransmission » Don’t get confused with higher layer rtx DATA-ACK exchange: Also called two-way handshake Or Basic Access Mechanism Giuseppe Bianchi SENDER RECEIVER DATA ACK Must forget Collision Detection! One single RF circuitry Either TX or RX… Half-duplex Even if two simultaneous TX+RX: large difference (100+ dB!) in TX/RX signal power Impossible to receive while transmitting On a same channel, of course tx STA rx Collision detection at sender: meaningless in wireless! Ethernet = collision detection at sender Wireless = large difference in the interference power between sender & receiver! Collision OCCURS AT THE RECEIVER A detects a very low interference (C is far) no “collision” A B Giuseppe Bianchi C B detects a disructive interference (C is near) collision occurs Carrier Sense Multiple Access Station may transmit ONLY IF senses channel IDLE for a DIFS time DIFS = Distributed Inter Frame Space Key idea: ACK replied after a SIFS < DIFS SIFS = Short Inter Frame Space Other stations will NOT be able to access the channel during the handshake Provides an atomic DATA-ACK transaction Packet arrival TX DIFS DATA SIFS ACK RX OTHER STA Packet arrival DIFS Must measure a whole DIFS Giuseppe Bianchi OK! Grasping wi-fi (802.11b) numbers DIFS = 50 ms Rationale: 1 SIFS + 2 slot-times Slot time = 20 ms, more later SIFS = 10 ms Rationale: RX_TX turnaround time The shortest possible! (28+payload) [bytes] x 8 / TX_rate [mbps] = ms DATA PHY MAC header 24 (30) 16 128 Preamble 48 SFD PLCP hdr 1 mbps DBPSK 192 ms Payload FCS DATA frame: TX time = f(rate) Impressive PHY overhead! 192 ms per every single frame Total data frame time (1500 bytes) @1 Mbps: 192+12288= 12480 ms » PHY+MAC overhead = 3.3% » PHY+MAC overhead = 16.% @11 Mbps: 192+ 1117.1 = 1309.1 ms ACK PHY ACK 14 192 ms 112 ms Giuseppe Bianchi Overhead increases for small frames! ACK frame: TX at basic rate Typically 1 mbps but 2 mbps possible… ACK frame duration (1mbps): 304 ms And when an ACK is “hidden”? 1) 2) 3) Sender TX Receiver RX STA defers STA SENDER RECEIVER STA SENDER RECEIVER STA SENDER RECEIVER Receiver ACKs (after SIFS) STA cannot hear… STA tranmits And destroys ACK! STA BUSY DETECT (DATA) DIFS STA TX! SIFS ACK Giuseppe Bianchi The Duration Field Frame Control Duration / ID Address 1 Address 2 6 6 2 2 # microseconds 0 1 2 3 4 5 6 7 8 Address 3 6 0 Sequence Control Address 4 Data Frame check sequence 6 0-2312 4 2 When bit 15 = 1 NOT used as duration (used by power-saving frames to specify station ID) 9 10 11 12 13 14 15 Allows “Virtual Carrier Sensing” Other than physically sensing the channel, each station keeps a Network Allocation Vector (NAV) Continuously updates the NAV according to information read in the duration field of other frames DIFS DATA SIFS OTHER STA Giuseppe Bianchi Physical carrier sensing ACK Virtual carrier sensing NAV (data) And when a terminal is “hidden”? STA RECEIVER SENDER … this can be “solved” by increasing the sensitiveness of the Carrier Sense… Quite stupid, though (LOTS of side effects – out of the goals of this lecture) … this can’s be “solved” by any means! The Hidden Terminal Problem SENDER and STA cannot hear each other SENDER transmits to RECEIVER STA wants to send a frame RECEIVER Not necessarily to RECEIVER… STA senses the channel IDLE Carrier Sense failure SENDER STA Giuseppe Bianchi Collision occurs at RECEIVER Destroys a possibly very long TX!! The RTS/CTS solution Packet arrival TX DIFS RTS DATA SIFS CTS SIFS RX others SIFS ACK NAV (RTS) NAV (CTS) RX RTS CTS TX CTS hidden (Update NAV) Giuseppe Bianchi RTS/CTS: carry the amount of time the channel will be BUSY. Other stations may update a Network Allocation Vector, and defer TX even if they sense the channel idle (Virtual Carrier Sensing) Why backoff? DIFS DATA STA1 SIFS ACK DIFS STA2 STA3 Collision! RULE: when the channel is initially sensed BUSY, station defers transmission; THEN,when channel sensed IDLE again for a DIFS, defer transmission of a further random time (Collision Avoidance) Giuseppe Bianchi Slotted Backoff STA2 DIFS w=7 Extract random number in range (0, W-1) Decrement every slot-time s w=5 STA3 Note: slot times are not physically delimited on the channel! Rather, they are logically identified by every STA Slot-time values: 20ms for DSSS (wi-fi) Accounts for: 1) RX_TX turnaround time 2) busy detect time 3) propagation delay Giuseppe Bianchi Backoff freezing When STA is in backoff stage: It freezes the backoff counter as long as the channel is sensed BUSY It restarts decrementing the backoff as the channel is sensed IDLE for a DIFS period STATION 1 DIFS DATA DIFS SIFS ACK STATION 2 DIFS SIFS ACK 6 5 Giuseppe Bianchi BUSY medium Frozen slot-time 4 DIFS 3 2 1 Why backoff between consecutive tx? A listening station would never find a slot-time after the DIFS (necessary to decrement the backoff counter) Thus, it would remain stuck to the current backoff counter value forever!! S1 DIFS DATA DIFS SIFS ACK DATA DIFS SIFS ACK S2 BUSY medium DIFS 6 5 DIFS Frozen slot-time 4 Giuseppe Bianchi BUSY medium DIFS 3 Backoff rules First backoff value: Extract a uniform random number in range (0,CWmin) If unsuccessful TX: Extract a uniform random number in range (0,2×(CWmin+1)-1) If unsuccessful TX: Extract a uniform random number in range (0,22×(CWmin+1)-1) Etc up to 2m×(CWmin+1)-1 Exponential Backoff! For 802.11b: CWmin = 31 CWmax = 1023 (m=5) Giuseppe Bianchi Further backoff rules Truncated exponential backoff After a number of attempts, transmission fails and frame is dropped Backoff process for new frame restarts from CWmin Protects against cannel capture unlikely when stations are in visibility, but may occur in the case of hidden stations Two retry limits suggested: Short retry limit (4), apply to frames below a given threshold Long retry limit (7), apply to frames above given threshold (loose) rationale: short frames are most likely generated bu realk time stations Of course not true in general; e.g. what about 40 bytes TCP ACKs? Giuseppe Bianchi DCF overhead Sstation E[ payload ] E[TFrame _ Tx ] DIFS CWmin / 2 TFrame _ Tx TMPDU SIFS TACK TFrame _ Tx TRTS SIFS TCTS SIFS TMPDU SIFS TACK TMPDU TPLCP 8 (28 L) / RMPDU _ Tx TACK TPLCP 8 14 / RACK _ Tx TRTS TPLCP 8 20 / RRTS _ Tx TCTS TPLCP 8 14 / RCTS _ Tx Giuseppe Bianchi Example: maximum achievable throughput for 802.11b backoff DATA SIFS DATA DIFS ACK Cycle time Data Rate = 11 mbps; ACK rate = 1 mbps Payload = 1500 bytes Data Rate = 11 mbps; ACK rate = 1 mbps Payload = 576 bytes TMPDU 192 8 ( 28 1500) / 11 1303 TMPDU 192 8 ( 28 576) / 11 631 TACK 192 8 14 / 1 304 TACK 192 8 14 / 1 304 SIFS 10; DIFS 50 31 E[ Backoff ] 20 310 2 1500 8 Thr 6.07 Mbps 1303 10 304 50 310 SIFS 10; DIFS 50 31 E[ Backoff ] 20 310 2 576 8 Thr 3.53Mbps 631 10 304 50 310 REPEAT RESULTS FOR RTS/CTS Not viable (way too much overhead) at high rates! Giuseppe Bianchi DCF overhead (802.11b) Giuseppe Bianchi DCF overhead (802.11b) 1 0,8 0,7 0,6 0,5 0,4 0,3 BAS-2M bps 0,2 RTS-2M bps 0,1 BAS-11M bps 0 RTS-11M bps 10 0 30 0 50 0 70 0 90 0 11 00 13 00 15 00 17 00 19 00 21 00 23 00 Nor malized T hr oughput 0,9 Payload Size (B ytes) Giuseppe Bianchi Performance Anomaly Question 1: Assume that throughput measured for a single 11 mbps greedy station is approx 6 mbps. What is per-STA throughput when two 11 mbps greedy stations compete? Answer 1: Approx 3 mbps (easy ) Question 2: Assume that throughput measured for a single 2 mbps greedy station is approx 1.7 mbps. What is per-STA throughput when two 2 mbps greedy stations compete? Answer 2: Approx 0.85 mbps (easy ) Question 3: What is per-STA throughput when one 11 mbps greedy station compete with one 2 mbps greedy station? Answer 3: ... Giuseppe Bianchi Understanding Answers 1&2 (neclect collision – indeed rare – just slightly reduce computed value) backoff Frozen backoff STA 1 SIFS DIFS STA 2 ACK SIFS DIFS ACK Cycle time Thr[1] Thr[2] E[ payload ] 1500 8 E[cycle time] TMPDU [1] SIFS ACK DIFS TMPDU [2] SIFS ACK DIFS E[backoff ] Data Rate = 11 mbps; ACK rate = 1 mbps Payload = 1500 bytes Data Rate = 2 mbps; ACK rate = 1 mbps Payload = 1500 bytes TMPDU 192 8 ( 28 1500) / 11 1303 TMPDU 192 8 ( 28 1500) / 2 6304 TACK 192 8 14 / 1 304 TACK 192 8 14 / 1 304 SIFS 10; DIFS 50 31 E[ Backoff ] 20 310 2 1500 8 Thr 3.3Mbps 2 (1303 10 304 50) 310 SIFS 10; DIFS 50 31 E[ Backoff ] 20 310 2 1500 8 Thr 0.88 Mbps 2 (6304 10 304 50) 310 Giuseppe Bianchi Emerging “problem”: long-term fairness! If you have understood the previous example, you easily realize that 802.11 provides FAIR access to stations in terms of EQUAL NUMBER of transmission opportunities in the long term! But this isSTA2 INDEPENDENT OF STA1 STA2 STA1 STA2 STA1 transmission speed! Giuseppe Bianchi Computing answer 3 Frozen backoff STA (2mbps) SIFS DIFS STA 11 SIFS ACK DIFS ACK Cycle time RESULT: SAME THROUGHPUT (in the long term)!! Thr[1] Thr[2] E[ payload ] E[cycle time] 1500 8 TMPDU [1] SIFS ACK DIFS TMPDU [2] SIFS ACK DIFS E[backoff ] 1500 8 1.39 Mbps!!!!!! 6304 1303 2(10 304 50) 310 DRAMATIC CONSEQUENCE: throughput is limited by STA with slowest rate (lower that the maximum throughput achievable by the slow station)!! Giuseppe Bianchi Performance anomaly into action Why the network is soooo slow today? We’re so Close, we have a 54 mbps and “excellent” channel, and we get Less than 1 mbps … Hahahahahah!! Poor channel, Rate-fallbacked @ 1mbps Giuseppe Bianchi