CS434/534: Topics in Networked (Networking) Systems Wireless Foundation: Wireless MAC; 802.11 MAC; New Designs Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email: yry@cs.yale.edu http://zoo.cs.yale.edu/classes/cs434/
Admin. PS2 questions Please make appointments with me to discuss potential projects
Recap: Wireless PHY
Recap: Link Layer Services Framing separate bits into frames; each frame has header, trailer and error detection/correction Multiplexing/demultiplexing use frame headers to identify src, dest Media access control implement sharing of wireless resources Reliable delivery between adjacent nodes seldom used on low bit error link (fiber, some twisted pair) common for wireless links: high error rates
Recap: MAC Protocols Taxonomy Channel partitioning SDMA, TDMA, FDMA and CDMA are basic media partitioning techniques divide media into smaller “pieces” (space, time slots, frequencies, codes) for multiple transmissions to share Non-channel partitioning random access “taking-turns”
Recap: Aloha Protocol as a Random Access Protocol call setup from an MS MS BTS RACH (request signaling channel) Slotted Aloha AGCH (assign signaling channel) SDCCH (request call setup) SDCCH message exchange A SDCCH (assign TCH) Communication B
Recap: Slotted Aloha Advantages Simple, decentralized random access protocol Issues Low efficiency Only ~37% at optimal transmission rate Even lower efficiency at non-optimal (fixed p) No rate allocation/fairness
Recap: Ethernet Fix for Efficiency Introduce carrier sense (CS): do not interrupt others Introduce collision detection (CD): instead of wasting the whole frame transmission time (a slot), we waste only the time needed to detect collision. Introduce adaptive probability using exponential backoff (EB): reduce probability #collisions increases If more collisions => p is high => should reduce p P P: packet size, C: contention window C
Q: Does Ethernet alg work well in wireless? Ethernet Fix: Carrier-Sense Multiple Access /Collision Detection/Exponential Backoff Carrier sense The Ethernet algorithm get a frame from upper layer; K := 0; n := 0; // K: control wait time; n: no. of collisions repeat: wait for K * 512 bit-time; while (network busy) wait; wait for 96 bit-time after detecting no signal; transmit and detect collision; if detect collision stop and transmit a 48-bit jam signal; n ++; m:= min(n, 10), where n is the number of collisions choose K randomly from {0, 1, 2, …, 2m-1}. if n < 16 goto repeat else give up else declare success Detect Collision Exponential backup Q: Does Ethernet alg work well in wireless?
Outline Recap Wireless background Wireless MAC design Frequency domain Modulation and demodulation Wireless channels Wireless PHY design Wireless MAC design wireless access problem and taxonomy wireless resource partitioning dimensions media access protocols ALOHA protocol The Ethernet protocol Hidden terminals in wireless
The Hidden Terminal Problem C A is sending to B, but C cannot detect the transmission Therefore C sends to B In summary, A is “hidden” from C
CSMA/CD + Hidden Terminals get a frame from upper layer; K := 0; n := 0; // K: control wait time; n: no. of collisions repeat: wait for K * 512 bit-time; while (network busy) wait; wait for 96 bit-time after detecting no signal; transmit and detect collision; if detect collision stop and transmit a 48-bit jam signal; n ++; m:= min(n, 10), where n is the number of collisions choose K randomly from {0, 1, 2, …, 2m-1}. if n < 16 goto repeat else give up else declare success Hidden terminals => 0 goodput! Q: what is the outcome of CSMA/CD + hidden terminals, assume two senders with infinite backlog?
Hidden Terminals Why cannot senders C and A detect collisions or potential collisions? Collision is spatially dependent C/A is at a different location than B Only receiver can detect a collision happened or potential collisions A B C
Roadmap: Wireless MAC Problem: single shared medium, hence if two transmissions overlap on all dimensions [time, space, frequency, and code], then it is a collision +CS+CD+EB Slotted ALOHA Ethernet Hidden-terminal Collision detection/ prevention ?
Solution I: Receiver Notifies Collision Happened Solution: receiver sends ACK to sender to indicate a collision happened or not If no ACK from receiver, sender assumes a collision
Solution II: Receiver Signals Potential Collision Receiver sends busy-tone Used in CDPD (cellular digital packet data) The base station sends a busy tone on the down link when receiving data
Short signaling packets (virtual carrier sense) Solution III: Receiver Signals Potential Collision Using Virtual Carrier Sense/ACK Short signaling packets (virtual carrier sense) Sender: RTS (request to send) Receiver: CTS (clear to send) contain sender address, receiver address, transmission duration, called network allocation vector (NAV) A node keeps quiet for NAV in CTS DATA RTS A B C D CTS
Comparisons: Media Access Techniques Handling Hidden Terminals Slotted Aloha very simple to implement but low efficiency CSMA/CD (Ethernet alg.) hidden terminals can cause 0 goodput CSMA/CD + ACK simple to implement low efficiency (CD is not effective)
Comparisons: Media Access Techniques Handling Hidden Terminals Busy tone simple to implement but need a channel for busy signal Virtual carrier sensing (RTS/CTS) higher efficiency when a collision occurs (not waste the whole duration) But energy consumption can be high because a node needs to monitor the environment all the time Idle:receive:send: 1:1.05:1.4 [Stemm and Katz]; Digitan 2 Mbps WLAN 1:2:2.5 many measurements show that overhead hurts performance
Outline Recap Wireless background Wireless MAC design Frequency domain Modulation and demodulation Wireless channels Wireless PHY design Wireless MAC design wireless access problem and taxonomy wireless resource partitioning dimensions media access protocols ALOHA protocol The Ethernet protocol Hidden terminals in wireless IEEE 802.11
IEEE 802.11 (Requirements) Design for small coverage (e.g. office, home) Use un-licensed spectrum High data-rate applications Ability to integrate real time applications and non-real-time applications (implications?)
802.11: Infrastructure Mode Components 802.11 LAN networks station (STA) terminal with access mechanisms to the wireless medium and radio contact to the access point access point (AP) station integrated into the wireless LAN and the distribution system basic service set (BSS) group of stations using the same AP portal bridge to other (wired) networks distribution system interconnection network to form one logical network (EES: Extended Service Set) based on several BSS 802.x LAN STA1 BSS1 Portal Access Point Distribution System Access Point ESS BSS2 STA2 STA3 802.11 LAN 9
The IEEE 802.11 Family Protocol Release Data Freq. Rate (max) Modulation Range (indoor) Legacy 1997 2.4 GHz 2Mbps DSSS/FHSS ~20 m 802.11a 1999 5 GHz 54 Mbps OFDM ~35 m 802.11b 11 Mbps DSSS ~38 m 802.11g 2003 OFDM/DSSS 802.11n 2009 2.4/5 GHz 540 Mbps ~70 m
Long preamble & header (192 usec; or optional 96 short version) 802.11b PHY Format Long preamble & header (192 usec; or optional 96 short version) Preamble & header always transmitted at 1Mbps DBPSK Preamble - Sync: alternating 0s and 1s (DSSS 128 bits) - SFD: Start Frame delimiter: 0000 1100 1011 1101 PLCH (Phsical Layer Convergence Procedure) Header - SIGNAL: the rate info - SERVICE: mostly future use - payload length - CRC: 16 bit protection of header
802.11 – MAC Format Types Sequence numbers Addresses Miscellaneous bytes 2 2 6 6 6 2 6 0-2312 4 Frame Control Duration/ ID Address 1 Address 2 Address 3 Sequence number Address 4 Data CRC bits 2 2 4 1 1 1 1 1 1 1 1 Protocol version Type Subtype To DS From DS More Frag Retry Power Mgmt More Data WEP Order Types control frames, management frames, data frames Sequence numbers important against duplicated frames due to lost ACKs Addresses receiver, transmitter (physical), BSS identifier, sender (logical) Miscellaneous sending time, checksum, frame control, data
802.11 – MAC Asynchronous Data Service (ADS) Objective: exchange data based on distributed random access Approach: Implement ADS using distributed coordinate function (DCF): DCF CSMA/CA (mandatory) - collision avoidance via randomized “back-off“ ACK packet for acknowledgements/detection DCF w/ RTS/CTS (optional) additional virtual “carrier sensing Time-Bounded Service (TBS) Objective: Exchange data with bounded delay service Approach: implemented TBS using point (access point) coordinated function (PCF)
802.11 ADS/DCF: CSMA/CA CSMA: Listen before transmit Collision avoidance when transmitting a packet, choose a backoff interval in the range [0, CW] CW is contention window Count down the backoff interval when medium is idle count-down is suspended if medium becomes busy Transmit when backoff interval reaches 0
802.11 ADS/DCF: CSMA/CA Example busy B1 = 25 B2 = 20 B1 = 5 data wait data wait B2 = 10 B2 = 15 busy B1 and B2 are backoff intervals at nodes 1 and 2 cw = 31
802.11 ADS/DCF: CSMA/CA Backoff IEEE 802.11 contention window CW is adapted dynamically depending on collision occurrence after each collision, CW is doubled thus CW varies from CWmin to CWmax 802.11b 802.11a 802.11g aSlotTime 20 usec 9 usec 20 usec (mixed); 9 usec (g-only) aCWmin 31 slots 15 slots
802.11 ADS/DCF: RTS/CTS + ACK Sender sends RTS with NAV (Network allocation Vector, i.e. reservation parameter that determines amount of time the data packet needs the medium) Receiver acknowledges via CTS (if ready to receive) CTS reserves channel for sender, notifying possibly hidden stations Sender can now send data at once, acknowledgement via ACK Other stations store NAV distributed via RTS and CTS RTS data sender CTS ACK receiver NAV (RTS) data other stations NAV (CTS) t defer access new contention
802.11 TBS/PCF: Polling (Infrastructure Mode) point coordinator U polled wireless stations NAV NAV contention free period t medium busy contention period D: downstream poll, or data from point coordinator U: data from polled wireless station
direct access if medium is free DIFS Integrating PCF and DCF Using different inter frame spacing values to implement priority SIFS (Short Inter Frame Spacing) highest priority, for ACK, CTS, polling response PIFS (PCF IFS) medium priority, for time-bounded service using PCF DIFS (DCF, Distributed Coordination Function IFS) lowest priority, for asynchronous data service t medium busy SIFS PIFS DIFS next frame contention direct access if medium is free DIFS
802.11 – Inter Frame Spacing 802.11b 802.11a 802.11g aSIFSTime 10 usec aSlotTime 20 usec 9 usec 20 usec (mixed); 9 usec (g only) aDIFTime (2xSlot+SIFS) 50 usec 34 usec 50 usec; 28 usec
Example: RTS-CTS-data-ACK DIFS RTS data sender SIFS SIFS CTS SIFS ACK receiver NAV (RTS) DIFS data other stations NAV (CTS) t defer access new contention
Example: PIFS D: downstream poll, or data from point coordinator SIFS D D point coordinator SIFS U polled wireless stations NAV NAV contention free period t medium busy contention period D: downstream poll, or data from point coordinator U: data from polled wireless station
Outline Recap Wireless background Wireless MAC design Frequency domain Modulation and demodulation Wireless channels Wireless PHY design Wireless MAC design wireless access problem and taxonomy wireless resource partitioning dimensions media access protocols ALOHA protocol The Ethernet protocol Hidden terminals in wireless IEEE 802.11 Design Timing example
Example: 802.11b/ACK Timing Analysis Suppose TCP with 1460 bytes data payload TCP data frame size (not including preamble) 1536 bytes (1460 + 40 TCP/IP header + 36 802.11 header) TCP ACK data frame size (not including preamble) 76 TCP/IP header bytes 802.11b ACK frame size 14 bytes Suppose 802.11b at the highest rate 8 bits per symbol 1.375 Msps See page 4 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11b/ACK Timing (1460B data) TCP Data TCP Ack
802.11b/ACK Timing (1460B data) TCP Data TCP Ack DIFS (us) 50
802.11b/ACK Timing (1460B data) TCP Data TCP Ack DIFS (us) 50 802.11 Data (us) 192 + 1536 / 1.375 = 1,310 192 + 76 / 1.375 = 248
802.11b/ACK Timing (1460B data) TCP Data TCP Ack DIFS (us) 50 802.11 Data (us) 192 + 1536 / 1.375 = 1,310 192 + 76 / 1.375 = 248 SIFS (us) 10
802.11b/ACK Timing (1460B data) TCP Data TCP Ack DIFS (us) 50 802.11 Data (us) 192 + 1536 / 1.375 = 1,310 192 + 76 / 1.375 = 248 SIFS (us) 10 802.11 ACK (us) 192 + 14 / 1.375 =203 203
802.11b/ACK Timing (1460B data) TCP Data TCP Ack DIFS (us) 50 802.11 Data (us) 192 + 1536 / 1.375 = 1,310 192 + 76 / 1.375 = 248 SIFS (us) 10 802.11 ACK (us) 192 + 14 / 1.375 =203 203 Frame total (us) 1,573 511 Transactions total (us) 2,084
Example: 802.11g/ACK Timing Suppose 802.11g at the highest rate (54Mbps) symbol duration: 4 usec; 216 bits/symbol 20 usec preamble; 6 usec “signal extension time” at the end of each frame Data: 28 (DIFS) + (20 + 57 * 4 + 6) + 10 (SIFS) + (20 + 1 * 4 + 6) = 322 Ack: 106 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Example: 802.11g/ACK Timing Suppose 802.11g at the highest rate (54Mbps) symbol duration: 4 usec; 216 bits/symbol 20 usec preamble; 6 usec “signal extension time” at the end of each frame Suppose TCP with 1460 bytes data payload data: 57 (=1536*8/216) symbols; ACK: 3 (=76*8/216) symbols 802.11b ACK frame size 14 bytes 1 symbol Data: 28 (DIFS) + (20 + 57 * 4 + 6) + 10 (SIFS) + (20 + 1 * 4 + 6) = 322 Ack: 106 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11g Basic Timing (1460B data) TCP Data TCP Ack DIFS (us) 28 802.11 Data (us) 20 + 57 *4 + 6 = 254 20 + 3 * 4 + 6 = 38 SIFS (us) 10 802.11 ACK (us) 20 + 1 * 4 + 6 =30 30 Frame total (us) 322 106 Transactions total (us) 428
Example: 802.11g + CTS RTS/CTS uses 802.11b DIFS (50 usec) and long preamble (192 usec) RTS/CTS uses 802.11b frame coding 20 bytes RTS 14 bytes CTS http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11g + CTS Timing (1460B data) TCP Data TCP Ack DIFS (us) 28 -> 50 CTS 192 + 14/1.375 = 203 = 203 SIFS 10 802.11 Data (us) 20 + 57 *4 + 6 = 254 20 + 3 * 4 + 6 = 38 SIFS (us) 802.11 ACK (us) 20 + 1 * 4 + 6 =30 30 Frame total (us) 322 106 Transactions total (us) 428 -> 898
Summary Technology Transactions per sec Mbps of TCP Relative to 802.11b 11b, 11Mbps 479 5.6 1 11a, 54 Mbps 2,336 27.3 4.9 11g, no CTS/RTS 11g, CTS 1,113 13.0 2.3 11g, RTS/CTS 750 8.8 1.6
Outline Recap Wireless background Wireless MAC design Frequency domain Modulation and demodulation Wireless channels Wireless PHY design Wireless MAC design wireless access problem and taxonomy wireless resource partitioning dimensions media access protocols ALOHA protocol The Ethernet protocol Hidden terminals in wireless IEEE 802.11 New designs
Roadmap: Wireless MAC Problem: single shared medium, hence if two transmissions overlap on all dimensions [time, space, frequency, and code], then it is a collision +CS+CD+EB Slotted ALOHA Ethernet Hidden-terminal Collision detection/ prevention ACK/RTS-CTS Contrarian design
Hidden Terminal with 802.11 No ACK Collision! Alice Bob
Hidden Terminal with 802.11 Retransmission One more Collision Alice Bob The problem does not stop here. Alice and Bob retransmit their packets after increasing their contention window. But this does not help. Their transmissions still overlap causing more collisions. Alice and Bob will continue increasing their contention window and retransmitting, until after many trials they get a packet through or they time out.
802.11 Setting: Two Collisions of Two Packets Pb
Interference-free Bits ZigZag Decoding Exploits 802.11’s behavior Retransmissions Same packets collide again Senders use random jitters Collisions start with interference-free bits Pa Pa ………… How do we leverage these interference free bits to decode the collisions? ∆1 Pb ∆2 Pb Interference-free Bits
ZigZag Algorithm ∆1 ≠∆2 ∆1 ∆2 1 1 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 1 2 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 2 2 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 3 2 4 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 5 4 2 4 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 5 5 2 4 6 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 5 7 6 2 4 6 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision }
How Does ZigZag Work? ∆1 ≠∆2 ∆1 ∆2 1 3 5 7 7 2 4 6 8 while (exists a chunk that is interference-free in one collision and has interference in the other) { decode and subtract from the other collision } Thus, even in the face of collisions, we are able to correctly receive 2 packets in 2 timeslots. Delivered 2 packets in 2 timeslots As efficient as if the packets did not collide