link layer wireless media access control (mac)...
TRANSCRIPT
Page 1
Link Layer: Wireless Media Access Control
Y. Richard Yang
11/08/2012
2
Outline
❒ Admin. and recap ❒ Wireless Media access control (MAC)
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
Admin. ❒ Project check point I: next Tuesday
❒ Feedback on topics to cover
3 4
Recap: Wireless Access Problem
❒ Problem: single shared medium, hence if two transmissions overlap on all dimensions [time, space, frequency, and code], then it is a collision
❒ Solution covered: Aloha (random access with collision recovery) A
B
5
Recap: Slotted Aloha [Norm Abramson]
❒ Time is divided into equal size slots (= pkt trans. time)
❒ Node with new arriving pkt: transmit at beginning of next slot with probability p
❒ If collision: retransmit pkt in future slots with probability p, until successful.
Success (S), Collision (C), Empty (E) slots
A
B
6
Recap: Slotted Aloha: Goodput vs. Offered Load Curve
S =
thro
ughp
ut =
“go
odpu
t”
(
succ
ess
rate
)
Define G = offered load = np 0.5 1.0 1.5 2.0
Slotted Aloha
❒ Goodput is optimal when offered load G (=p*n) = 1 ❒ Goodput is less than 1/e (~37%) at optimal
Page 2
7
Recap: Slotted Aloha Dynamics
n backlogged each transmits with prob. p
m-n: unbacklogged each transmits with prob. pa
8
Recap: Slotted Aloha Dynamics
n: number of backlogged stations
0 m
successful transmission rate at
offered load np + (m-n)pa
new arrival rate: (m-n) pa
desirable stable point
undesirable stable point
Slotted Aloha can have an undesirable stable point
offered load = 1
- assume a total of m stations - pa << p - success rate is the departure rate, the rate the backlog is reducing
dep. and arrival rate of backlogged stations
9
Summary of Problems of Slotted Aloha ❒ Advantages
o Simple, decentralized random access protocol
q Issues o Low efficiency
o Only ~37% at optimal transmission rate o Even lower efficiency at non-optimal (fixed p)
o No rate allocation/fairness
10
Ethernet Fix for Efficiency
❒ Introduce collision detection: instead of wasting the whole frame transmission time (a slot), we waste only the time needed to detect collision.
❒ Introduce adaptive probability: reduce probability of
trans. as # of collisions increases ❍ If more collisions => p is high => should reduce p
P
P: packet size, C: contention window
C C C
11
Ethernet Fix: Carrier-Sense Multiple Access /Collision Detection/Exponential Backoff
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
The Ethernet algorithm
Q: Does Ethernet alg work well in wireless?
Carrier sense
Detect Collision
Adapt Probability
12
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
Page 3
13
The Hidden Terminal Problem
B A C
❒ A is sending to B, but C cannot detect the transmission
❒ Therefore C sends to B
❒ In summary, A is “hidden” from C
D E
CSMA/CD + Hidden Terminals
14
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
Q: what is the outcome of CSMA/CD + hidden terminals, assume two senders with infinite backlog?
Hidden terminals => 0 goodput!
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
15 A B C
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
16
17
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
18
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
B A C RTS
CTS CTS D
DATA
Page 4
19
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
20
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
21
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
22
802.11: Infrastructure Mode
❒ 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
Distribution System
Portal
802.x LAN
Access Point
802.11 LAN
BSS2
802.11 LAN
BSS1
Access Point
STA1
STA2 STA3
ESS
23
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 1999 2.4 GHz 11 Mbps
DSSS ~38 m
802.11g 2003 2.4 GHz 54 Mbps
OFDM/DSSS ~38 m
802.11n 2009 2.4/5 GHz
540 Mbps
OFDM ~70 m
24
802.11 – MAC Traffic Services q Asynchronous Data Service (ADS)
o Objective: exchange data packets based on distributed random access
o Approach: Implement ADS using distributed coordinate function (DCF): o DCF CSMA/CA (mandatory)
- collision avoidance via randomized “back-off“ - ACK packet for acknowledgements/detection
- DCF w/ RTS/CTS (optional) - additional virtual “carrier sensing
q Time-Bounded Service (TBS) o Objective: Exchange of bounded delay service o Approach: implemented TBS using point (access point) coordinated
function (PCF)
Page 5
25
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
26
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 15 slots
27
Congestion Avoidance: Example
data
wait B1 = 5
B2 = 15
B1 = 25
B2 = 20
data
wait
B1 and B2 are backoff intervals at nodes 1 and 2 cw = 31
B2 = 10 busy
busy
28
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
t
SIFS
DIFS
data
ACK
defer access
other stations
receiver
sender data
DIFS
new contention
RTS
CTS SIFS SIFS
NAV (RTS) NAV (CTS)
29
Integrating PCF and DCF
❒ Using different inter frame spacing values to implement priority ❒ 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
direct access if medium is free ≥ DIFS
t
medium busy SIFS PIFS DIFS DIFS
next frame contention
30
802.11b 802.11a 802.11g aSIFSTime 10 usec 16 usec 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 – Inter Frame Spacing
Page 6
31
802.11: PCF for Polling (Infrastructure Mode)
t NAV
polled wireless stations
point coordinator
NAV
PIFS D
U SIFS
SIFS D
contention period
contention free period medium busy
D: downstream poll, or data from point coordinator U: data from polled wireless station
802.11b Frame Format
32
Sync SFD PLCP header CRC
2
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
MAC Data
preamble
33
802.11 – MAC Format
❒ 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
Frame Control
Duration/ ID
Address 1
Address 2
Address 3
Sequence number
Address 4 Data CRC
2 2 6 6 6 6 2 4 0-2312 bytes
Protocol version Type Subtype To
DS More Frag Retry Power
Mgmt More Data WEP
2 2 4 1 From DS
1
Order
bits 1 1 1 1 1 1
34
Example: 802.11b/ACK Timing
❒ Suppose TCP with 1460 bytes data payload ❍ TCP data frame size (not including preamble)
• 1536 bytes (1460 + 40 TCP header + 36 802.11 header) ❍ 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
35 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack
36
Page 7
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack DIFS (us) 50 50
37
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack DIFS (us) 50 50 802.11 Data (us) 192 + 1536 / 1.375
= 1,310 192 + 76 / 1.375 = 248
38
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack DIFS (us) 50 50 802.11 Data (us) 192 + 1536 / 1.375
= 1,310 192 + 76 / 1.375 = 248
SIFS (us) 10 10
39
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack DIFS (us) 50 50 802.11 Data (us) 192 + 1536 / 1.375
= 1,310 192 + 76 / 1.375 = 248
SIFS (us) 10 10 802.11 ACK (us) 192 + 14 / 1.375
=203 203
40
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack DIFS (us) 50 50 802.11 Data (us) 192 + 1536 / 1.375
= 1,310 192 + 76 / 1.375 = 248
SIFS (us) 10 10 802.11 ACK (us) 192 + 14 / 1.375
=203 203
Frame total (us) 1,573 511 Transactions total (us)
2,084
41
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
42 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Page 8
802.11g Basic Timing (1460B data)
TCP Data TCP Ack DIFS (us) 28 28 802.11 Data (us) 20 + 57 *4 + 6
= 254 20 + 3 * 4 + 6 = 38
SIFS (us) 10 10 802.11 ACK (us) 20 + 1 * 4 + 6
=30 30
Frame total (us) 322 106 Transactions total (us)
428
43
Example: TCP/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
44 http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11g + CTS Timing (1460B data)
TCP Data TCP Ack DIFS (us) 28 -> 50 28 -> 50 CTS 192 + 14/1.375
= 203 = 203
SIFS 10 10 802.11 Data (us) 20 + 57 *4 + 6
= 254 20 + 3 * 4 + 6 = 38
SIFS (us) 10 10 802.11 ACK (us) 20 + 1 * 4 + 6
=30 30
Frame total (us) 322 106 Transactions total (us)
428 -> 898
45
Summary
46
Technology Transac.ons
per sec Mbps of TCP
Rela.ve to 802.11b
11b, 11Mbps 479 5.6 1
11a, 54 Mbps 2,336 27.3 4.9
11g, no CTS/RTS 2,336 27.3 4.9
11g, CTS 1,113 13.0 2.3
11g, RTS/CTS 750 8.8 1.6
47
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
Hidden Terminal with 802.11
Collision!
Alice Bob
No ACK
Page 9
Hidden Terminal with 802.11
Alice Bob
One more Collision Retransmission
802.11 Setting: Two Collisions of Two Packets
Pa Pb
Pa Pb
ZigZag Decoding Exploits 802.11’s behavior ❒ Retransmissions
àSame packets collide again ❒ Senders use random jitters
à Collisions start with interference-free bits
∆1 ∆2 Pa Pb
Pa Pb
Interference-free Bits
How Does ZigZag Work?
∆1 ∆2
Find a chunk that is interference-free in one collisions and has interference in the other
1
∆1 ≠∆2
Decode and subtract from the other collision
1
∆2 1
2
1 ∆1
How Does ZigZag Work?
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
∆2 1
2 2 ∆1
How Does ZigZag Work?
3
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
Page 10
∆2 1
2 4 ∆1
How Does ZigZag Work?
3 3
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
∆2 1
2 4 4 ∆1
How Does ZigZag Work?
3 5
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
∆2 1
6 ∆1
How Does ZigZag Work?
3 5 5
2 4
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
∆2 1
6 6 ∆1
How Does ZigZag Work?
2 4
3 5 7
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
Decode and subtract from the other collision
∆2 1
6 8 ∆1
How Does ZigZag Work?
2 4
3 5 7 7
Find a chunk that is interference-free in one collisions and has interference in the other
∆1 ≠∆2
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
❒ Collision detection ❒ Chunk subtraction ❒ Deployment
60
∆2 1
2
1 ∆1
Page 11
61
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
• Overall idea • Technical issues
– Collision detection
62
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
Packets start with known preamble
AP correlates known preamble with signal
Correlation
Time
Correlate
∆
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’(Δ’)
Pa Pb
P’a P’b
65
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
• Overall idea • Technical issues
– Collision detection – Subtracting chunks
How Does the AP Subtract the Signal?
• 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
1 2
1 2
Page 12
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
1 2
1 2 What if AP Makes a Mistake?
∆1 ∆2 1 1
22
Bad News: Errors can propagate
3
Can we deal with these errors?
What if AP Makes a Mistake?
∆1 ∆2
What if AP Makes a Mistake?
Good News: Temporal Diversity A bit is unlikely to be affected by noise in both collisions
Get two independent decodings
Errors propagate differently in the two decodings
For each bit, AP picks the decoding that has a higher PHY confidence
Which decoded value should the AP pick?
∆1 ∆2
1 1
22
3
AP Decodes Backwards as well as Forwards
72
Outline
❒ Admin. and recap ❒ Media access control
❍ Slotted Aloha ❍ Hidden terminal ❍ Example: 802.11 ❍ Hidden terminal with 802.11 revisited
• Overall idea • Technical issues
– Collision detection – Subtracting chunks – Deployment
Page 13
Acknowledgement
❒ Use as much synchronous acknowledgement as possible for backward compatibility
Implementation
• USRP Hardware • GNURadio software • Carrier Freq: 2.4-2.48GHz • BPSK modulation
USRPs Testbed
• 10% HT,
• 10% partial HT,
• 80% perfectly sense each other
802.11a Throughput Comparison
802.11
Throughput
CD
F of
con
curr
ent f
low
pai
rs
Hidden Terminals
Partial Hidden Terminals
Perfectly Sense
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
1
0 0.5 1 1.5 2
Throughput Comparison
ZigZag
Throughput
CD
F of
con
curr
ent f
low
pai
rs
802.11
Hidden Terminals get high throughput
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
1
0 0.5 1 1.5 2
ZigZag Exploits Capture Effect
Capture Effect ❒ Subtract Alice and combine Bob’s packet
across collisions to correct errors
∆1 ∆2 Pa1
Pb
Pa2 Pb
3 packets in 2 time slots à better than no collisions
Page 14
Extension of Zigzag Decoding
❒ Focuses on single channel collisions, but many real time hidden terminals are due to overlapping channel collisions
❒ Need same packet pair
❒ Need timeshift to bootstrap decoding
79
∆1 ∆2 Pa
Pb
Pa Pb
80 80
802.11 Background
❒ Using 802.11g as an example ❍ Each channel has 4 groups of
subcarriers: C1 consists of G1, G2, G3, G4; C2 consists of G2, G3, G4, G5
❍ C1 and C2 are overlapping adjacent channels;
❍ C1 and C3 are overlapping non-adjacent channels
❍ Bits are assigned to subcarriers • E.g. bit sequences Ai is assigned
to subcarrier Gi, i=1,2,3,4
Subcarrier Group G1 G2 G3 G4
A1
A2
A3
A4
81
802.11g Overlapping-Channel Collision
Bob
APa on channel Ca
Collision!
Alice
APb on channel Cb
Collision!
Chuck
82
802.11g Overlapping-Channel Collision
Bob
APa on channel Ca
More Collision!
Alice
APb on channel Cb
More Collision!
Chuck
l Retransmission
83 83
Remap Basic Idea: Structured Permutation
Subcarrier Group G1 G2 G3 G4
A1
A2
A3
A4 Mapping π1
A4
A3
A2
A1 Mapping π2
A2
A1
A4
A3 Mapping π3
A3
A4
A1
A2 Mapping π4
84
How Permutation Helps ❒ Non-matching collisions on adjacent
channels C1 and C2 Subcarrier Group
G1 G2 G3 G4
A1
A2
A3
A4 1st transmission
2nd transmission
A4
A3
A2
A1
A2
A1
A4
A3 3rd transmission
A3
A4
A1
A2 4th transmission
Page 15
85 85
How Permutation Helps (cont’d)
❒ Non-matching collisions on non-adjacent channels C1 and C3
Subcarrier Group G1 G2 G3 G4
A1
A2
A3
A4 1st transmission
2nd transmission
A4
A3
A2
A1
86
Remap Basic Idea: Matching-collision setting
Collision!
Alice Bob
Collision!
APa on channel Ca
APb on channel Cb
l Matching collisions on adjacent channels
87
Remap for Matching Collisions
❒ collisions at adjacent channels C1 and C2 : a time and frequency view
Pb
∆1
∆2
A1 A2
A3 A4
S1 S2 Sn
Time
Freq
Pa
B5
B2
B3 B4
A4 A3
A2 A1
S1 S2 Sn
B2
B5
B4 B3
P′b
P′a
G1
G3
G2
G5
G4 G2
1
5 9
13
4 10
14
3
7 11
2
6 8
12
Backup Slides
88
89
IEEE 802.11 Requirements
❒ Design for small coverage (e.g. office, home) ❒ Low/no mobility ❒ High data-rate applications ❒ Ability to integrate real time applications and
non-real-time applications (implications?) ❒ Use un-licensed spectrum
90
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