802.11 and Hidden Terminals Y. Richard Yang 2/3/2009
Admin. Homework 2 linked on the schedule page
Recap: The Hidden Terminal Problem A is sending to B, but C cannot detect the transmission Therefore C sends to B In summary, A is “hidden” from C
Recap: Media Access Techniques Handling Hidden Terminals CSMA/CD -> CSMA/CA (congestion avoidance) default in 802.11 even if media is not sensed busy, transmits with a probability in real implementation, with a random delay Busy-tone multiple access used in CDPD (cellular digital packet data) the base station sends a busy tone on the down link when receiving data Virtual carrier sense: RTS/CTS/DATA/ACK
Outline Admin. and recap 802.11
IEEE 802.11 Requirements Design for small coverage (e.g. office, home) (implication?) Low/no mobility (implications?) High data-rate applications Ability to integrate real time applications and non-real-time applications (implications?) Use un-licensed spectrum
802.11: Infrastructure Mode Architecture similar to cellular 802.11 LAN Architecture similar to cellular 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
IEEE 802.11 Physical Layer Family of IEEE 802.11 standards: unlicensed frequency spectrum: 900Mhz, 2.4Ghz, 5.1Ghz, 5.7Ghz 300 MHz 5.15-5.35 GHz 5.725-5.825 GHz and 802.11b/g 802.11a
5000 + 5*channel number [MHz] 802.11a Physical Channels 36 40 44 48 52 56 60 64 channel# 5150 5180 5200 5220 5240 5260 5280 5300 5320 5350 [MHz] center frequency = 5000 + 5*channel number [MHz] 149 153 157 161 channel# 5725 5745 5765 5785 5805 5825 [MHz]
The IEEE 802.11 Family Protocol Release Data Freq. Rate (typical) Rate (max) Range (indoor) Legacy 1997 2.4 GHz 1 Mbps 2Mbps ? 802.11a 1999 5 GHz 25 Mbps 54 Mbps ~30 m 802.11b 6.5 Mbps 11 Mbps 802.11g 2003 802.11n 2008 2.4/5 GHz 200 Mbps 540 Mbps ~50 m
802.11a Modulation Use OFDM to divide each physical channel (20 MHz) into 52 subcarriers (20M/64=312.5 KHz each) 48 data, 4 pilot Adaptive modulation BPSK: 6, 9 Mbps QPSK: 12, 18 Mbps 16-QAM: 24, 36 Mbps 64-QAM: 48, 54 Mbps
802.11 - MAC Layer Traffic services Asynchronous Data Service (mandatory) exchange of data packets based on “best-effort” support of broadcast and multicast Time-Bounded Service (optional) exchange of bounded delay service
802.11 MAC Layer: Access Methods DFWMAC-DCF CSMA/CA (mandatory) collision avoidance via randomized “back-off“ ACK packet for acknowledgements DFWMAC-DCF w/ RTS/CTS (optional) additional virtual “carrier sensing: to avoid hidden terminal problem DFWMAC- PCF (optional) access point polls terminals according to a list
802.11 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
20 usec (mixed); 9 usec (g-only) 802.11 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
Congestion Avoidance: 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 Q: how is the performance of a mixed mode 802.11b/g network?
802.11 – 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 DIFS RTS data sender SIFS SIFS CTS SIFS ACK receiver NAV (RTS) DIFS data other stations NAV (CTS) t defer access new contention
direct access if medium is free DIFS 802.11 – Inter Frame Spacing Defined different inter frame spacing SIFS (Short Inter Frame Spacing); 10 us in 802.11b highest priority, for ACK, CTS, polling response PIFS (PCF IFS); 30 us in 802.11b medium priority, for time-bounded service using PCF DIFS (DCF, Distributed Coordination Function IFS); 50 us in 802.11b 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
802.11: PCF for Polling (Infrastructure Mode) PIFS 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
802.11b Frame Format preamble Sync SFD PLCP header MAC Data CRC Preamble (192 usec; or optional 96 short version) - Sync: alternating 0s and 1s (DSSS 128 bits) - SFD: Start Frame delimiter: 0000 1100 1011 1101 PLCH (Phsical Layer Convergence Procedure) Header - payload length - signaling field: the rate info. - CRC: 16 bit protection of header
802.11 – MAC Data Format Types Sequence numbers Addresses 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 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
Example: 802.11b Throughout Suppose TCP with 1460 bytes payload 802.11b data frame size (not including preamble): 1536 bytes TCP ACK data frame size (not including preamble): 76 bytes 802.11b ACK frame size 14 bytes Suppose 802.11b at the highest rate 8 bits per symbol 1.375 Msps Q: What is TCP/802.11b throughput? http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Example: 802.11g Throughout 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 payload data: 57 symbols; ACK: 3 symbols 802.11b ACK frame size 14 bytes 1 symbol Q: What is TCP/802.11g throughput? 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: TCP/802.11g + RTS/CTS RTS/CTS uses 802.11b DIFS (50 usec) RTS/CTS uses 802.11b frame coding 20 bytes RTS 14 bytes CTS Q: What is throughput? http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Outline Admin. and recap 802.11 Improving 802.11 hidden-terminal decoding
A Testbed Result USRPs 10% HT, 10% partial HT, 80% perfectly sense each other Each run randomly picks an AP and two clients 802.11a Blah blah blah… Since Software radios do all operations in software in user mode, they cannot perform carrier sense accurately. So, to capture carrier sense, each of our nodes have both 802.11 and USRP radios. We first run the experiment using the 802.11 nodes which apply carrier sense. Then we repeat the same experiment the USRP nodes, while forcing them to have the same number of collisions as the corresponding 802.11 nodes.
Throughput Comparison Perfectly Sense Partial Hidden Terminals Hidden Terminals CDF of concurrent flow pairs 802.11 We see three regions. Some nodes are complete hidden terminals and hardly get any throughput. Others are partial hidden terminals and get sub-optimal throughput, and the rest are get good throughput. Throughput
The Hidden Terminal Problem No ACK Collision! Alice Bob
The Hidden Terminals Problem 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. Q: how likely you have a second collision?
Can we take two collisions and produce the 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
Decode and subtract from the other collision How Does ZigZag Work? 1 1 ∆1 ∆2 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 1 ∆1 ∆2 2 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 3 ∆1 2 ∆2 2 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 3 3 ∆1 ∆2 2 4 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 3 5 ∆1 4 ∆2 2 4 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 3 5 5 ∆1 ∆2 2 4 6 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
Decode and subtract from the other collision How Does ZigZag Work? 1 3 5 7 ∆1 6 ∆2 2 4 6 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Decode and subtract from the other collision
How Does ZigZag Work? ∆1 ≠∆2 3 5 7 7 ∆1 ∆2 2 4 6 8 ∆1 ≠∆2 Find a chunk that is interference-free in one collisions and has interference in the other Thus, even in the face of collisions, we are able to correctly receive 2 packets in 2 timeslots. Decode and subtract from the other collision Delivered 2 packets in 2 timeslots As efficient as if the packets did not collide
ZigZag Technical Issues 1 1 ∆1 ∆2 2 Collision detection Chunk subtraction Backward ACK compatibility
Outline Admin. and recap 802.11 Zigzag 802.11 decoding Overall idea Technical issues Collision detection
Collision detection: How does the AP know it is a collision and where the second packet starts? Time ∆
Detecting Collisions and the Value of ∆ Time AP received signal Correlate Packets start with known preamble AP correlates known preamble with signal ∆ Correlation Time
Correlation
Pa Pb P’a P’b Matching Collision Given (P1 + P2()) and (P1’, P2’(’)), how to determine that P1 = P’ and P2 = P2’ Determine offset first Correlation of P2() and P2’(’)
Outline Admin. and recap 802.11 Zigzag 802.11 decoding Overall idea Technical issues Collision detection Subtracting chunks
How Does the AP Subtract the Signal? 1 2 Channel’s attenuation or phase may change between collisions Can’t simply subtract a chunk across collisions Alice’s signal in first collision Alice’s signal in second collision Now that the AP knows where the second packet starts, it is going to take the interference-free chunk from at the start of the first collision and subtract it from the second. In practice, it is not that simple…………..
Re-modulate bits to get channel-free signal 1 2 Subtracting a Chunk Decode chunk into bits Removes effects of channel during first collision Re-modulate bits to get channel-free signal Apply effect of channel during second collision Use correlation to estimate channel despite interference The solution to this problem however is simple. …….. Now the AP can subtract the first chunk. The AP iterates this process to decode both the whole packet.
What if AP Makes a Mistake? But, as is the usual case, channel adds noise which could lead to decoding errors.
What if AP Makes a Mistake? Bad News: Errors can propagate 1 3 1 ∆1 ∆2 2 2 For example, if the channel was noisy it can cause a decoding error in chunk 1. Since we subtract chunks across collisions, errors in the first collision can propagate to the second collision For example, Now when we subtract, the error in chunk 1 can lead to a decoding mistake in chunk 2, which itself could propagate further. Can we deal with these errors?
What if AP Makes a Mistake? Good News: Temporal Diversity A bit is unlikely to be affected by noise in both collisions ∆1 ∆2 The good new is that we have temporal diversity. Each bit appears twice on the channel. It is unlikely that the same bit is in error in both collisions. We can leverage this property by decoding each bit twice using two independent decodings. But how do we get these two independent decodings? I have already described to u … one way of decoding. Get two independent decodings
AP Decodes Backwards as well as Forwards ∆1 ∆2 2 2 3 1 1 Errors propagate differently in the two decodings Which decoded value should the AP pick? But in addition to this forward decoding method we can also decode backwards. For each bit, AP picks the decoding that has a higher PHY confidence
Outline Admin. and recap 802.11 Zigzag 802.11 decoding Overall idea Technical issues Collision detection Subtracting chunks ACK for backward compatibility
Acknowledgement Use as much synchronous acknowledgement as possible for backward compatibility
Backup Slides
Does ZigZag Handle Flipped Order? Pa Pa Pb Pb Flipped order Pa Pa Pb Pb
ZigZag Generalizes Flipped order ∆2 1 1 2 2 ∆1
Does ZigZag Handle Diff. Packet Sizes? 1 1 2 2 ∆1 ∆2
} subtraction is Technical Barriers How do I know packets collide Matching collision happened? (P1, P2) and (P1’, P2’) Frequency offset between transmitter and receiver Sampling offset Inter-symbol interference What if errors occur in chunks Acknowledgement? } subtraction is non-trivial
Decode matching collision Decode iteratively Re-encoding Computing channel parameters Channel gain estimated from Frequency offset and sampling error 1) coarse estimation from previously successful reception 2) iterative estimation Inter-symbol interference: take the inverse of linear filter (for removal of ISI)
Decode matching collision (cont’d) Re-encoding Account for sampling error
What about errors? Will errors in decoding have a cascading effect? Error propagation dies out exponentially Error correction capability of modulation Forward and backward decoding
3 packets in 2 time slots better than no collisions ZigZag Generalizes Flipped order Different packet sizes Multiple colliding packets Capture effect Subtract Alice and combine Bob’s packet across collisions to correct errors Pa1 Pa2 Finally, ZigZag makes a better use of capture effects. Capture effect can happen when the AP can decode Alice’s packets despite interference from Bob. But in ZigZag, the AP also subtract Alice’s packets from the collision signals to get Bob’s packets. Since Bob’s signal is so weak it is unlikely that one collision is sufficient to decode it. But ZigZag can combine the results of decoding Bob’s packet across both collisions to improve performance. ∆1 ∆2 Pb Pb 3 packets in 2 time slots better than no collisions
Implementation USRP Hardware GNURadio software Carrier Freq: 2.4-2.48GHz BPSK modulation
Testbed USRPs 10% HT, 10% partial HT, 80% perfectly sense each other Each run randomly picks an AP and two clients Co-located 802.11a nodes to find out about HTs and created the same collision patterns by the USRPs 802.11a Blah blah blah… Since Software radios do all operations in software in user mode, they cannot perform carrier sense accurately. So, to capture carrier sense, each of our nodes have both 802.11 and USRP radios. We first run the experiment using the 802.11 nodes which apply carrier sense. Then we repeat the same experiment the USRP nodes, while forcing them to have the same number of collisions as the corresponding 802.11 nodes.
Throughput Comparison CDF of concurrent flow pairs Throughput
Throughput Comparison Perfectly Sense Partial Hidden Terminals Hidden Terminals CDF of concurrent flow pairs 802.11 We see three regions. Some nodes are complete hidden terminals and hardly get any throughput. Others are partial hidden terminals and get sub-optimal throughput, and the rest are get good throughput. Throughput
Throughput Comparison CDF of concurrent flow pairs Hidden Terminals get high throughput ZigZag 802.11 … what used to be hidden terminals, they get excellent throughput. Throughput
Throughput Comparison ZigZag Exploits Capture Effect CDF of concurrent flow pairs ZigZag 802.11 Also its interesting to note that some of the scenarios that used to get high throughput now get even higher throughput. This correspond to capture effect because as we said earlier ZigZag can exploit capture effect to deliver more than one packet per time slot. …… Throughput ZigZag improved average Throughput by 25%
Throughput Comparison Hidden Terminals CDF of concurrent flow pairs ZigZag 802.11 Zooming in on the hidden terminals, ZigZag improves ……. This means that you can transform scenarios which were completely unusable to completely fine . Improved hidden terminals loss rate from 72% to 0.7% Throughput
Is ZigZag as efficient as if the colliding packets were sent in separate slots? For every SNR, Check that ZigZag can match the BER of collision-free receptions …. But, is ZigZag really as efficient as if the colliding packets were sent in separate time slots? To answer this question, it is not sufficient to look at packet loss rate because a packet may be lost because of one bit error or many bit errors. Thus, to answer this question we check …….
Is ZigZag as efficient as if packets were collision-free Receptions? Bit Error Rate (BER) SNR in dB
Is ZigZag as efficient as if packets were collision-free Receptions? Bit Error Rate (BER) SNR in dB
Is ZigZag as efficient as if packets were collision-free Receptions? Bit Error Rate (BER) ZigZag-Decoded Collisions As you can see at every SNR, ZigZag has slightly lower BER than collision free reception……… ……How come packets that are decoded from collisions have a lower BER than those sent in separate time slots. This is because of temporal diversity. With ZigZag, every bit is received twice, once in every collision, improving its chance of being correctly decoded. By decoding both forward and backward, we can collect this diversity gain and use it to combat bit errors. ZigZag is as efficient as if the colliding packets were sent separately SNR in dB
Three Colliding Senders Collision! Alice Bob Chris Nodes picked randomly from testbed
Three Colliding Senders Alice CDF of runs Bob Chris The real point here is that ZigZag can decode collisions involving more than two senders. Per-Sender Throughput ZigZag extends beyond two colliding senders
ZigZag Generalizes Flipped order Different packet sizes Multiple colliding packets 1 1 2 3 Intuitively, this is similar to solving three linear equations with three unknowns. The collisions are the equations and the packets are the unknowns. 1 1 2 2 2 3 3 3