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
ughput
= “
goodput
” (
succ
ess
rate
)
Define G = offered load = np0.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
7
Recap: Slotted Aloha Dynamics
n backloggedeach 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 ofm stations- pa << p- success rate is thedeparture rate, the rate the backlog is reducing
dep.andarrivalrateofbackloggedstations
9
Summary of Problems of Slotted Aloha
Advantageso Simple, decentralized random access protocol
Issueso Low efficiency
o Only ~37% at optimal transmission rateo 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 collisionsrepeat: 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
DetectCollision
AdaptProbability
12
Outline
Admin. and recap Media access control
Slotted Aloha Hidden terminal Example: 802.11 Hidden terminal with 802.11 revisited
13
The Hidden Terminal Problem
BA C
A is sending to B, but C cannot detect the transmission
Therefore C sends to B
In summary, A is “hidden” from C
DE
CSMA/CD + Hidden Terminals
14
get a frame from upper layer;K := 0; n := 0; // K: control wait time; n: no. of collisionsrepeat: 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
15A 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
BA CRTS
CTSCTS D
DATA
19
Comparisons: Media Access Techniques Handling Hidden Terminals
Slotted Alohavery 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 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
Time-Bounded Service (TBS)o Objective: Exchange of bounded delay serviceo Approach: implemented TBS using point (access point)
coordinated function (PCF)
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
waitB1 = 5
B2 = 15
B1 = 25
B2 = 20
data
wait
B1 and B2 are backoff intervalsat nodes 1 and 2cw = 31
B2 = 10busy
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
otherstations
receiver
senderdata
DIFS
new contention
RTS
CTSSIFS 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 SIFSPIFS
DIFSDIFS
next framecontention
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
31
802.11: PCF for Polling (Infrastructure Mode)
tNAV
polledwirelessstations
point coordinator
NAV
PIFSD
USIFS
SIFSD
contentionperiod
contention free periodmediumbusy
D: downstream poll, or data from point coordinatorU: 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
FrameControl
Duration/ID
Address1
Address2
Address3
Sequencenumber
Address4
Data CRC
2 2 6 6 6 62 40-2312bytes
Protocolversion
Type SubtypeToDS
MoreFrag
RetryPowerMgmt
MoreData
WEP
2 2 4 1
FromDS
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
35http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
802.11b/ACK Timing (1460B data)
TCP Data TCP Ack
36
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
42http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
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
44http://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
TechnologyTransactions
per secMbps of
TCPRelative 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
Hidden Terminal with 802.11
Alice Bob
One more CollisionRetransmission
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 ∆2Pa
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
11
∆1 ≠∆2
Decode and subtract from the other collision
11
∆2
11
22
11
∆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
∆211
2222∆1
How Does ZigZag Work?
33
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
∆211
22 44∆1
How Does ZigZag Work?
33 33
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
∆211
22 4444∆1
How Does ZigZag Work?
33 55
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
∆211
66∆1
How Does ZigZag Work?
33 55 55
22 44
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
∆211
6666∆1
How Does ZigZag Work?
22 44
33 55 77
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
11
66 88∆1
How Does ZigZag Work?
22 44
33 55 7777
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 timeslotsAs efficient as if the packets did not collide
ZigZag Technical Issues
Collision detection Chunk subtraction Deployment
60
∆2
11
22
11
∆1
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 signalCorrelati
onTime
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’aP’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
1122
1122
Subtracting a Chunk11
2211
22
What if AP Makes a Mistake?
∆1 ∆211 11
2222
Bad News: Errors can propagate
33
Can we deal with these errors?
What if AP Makes a Mistake?
∆1 ∆2
What if AP Makes a Mistake?
Good News: Temporal DiversityA 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
11 11
2222
33
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
Acknowledgement
Use as much synchronous acknowledgement as possible for backward compatibility
Implementation
• USRP Hardware• GNURadio software• Carrier Freq: 2.4-2.48GHz• BPSK modulation
USRPsTestbed
• 10% HT,
• 10% partial HT,
• 80% perfectly sense each other
802.11a
Throughput Comparison
802.11
Throughput
CD
F o
f co
ncur
rent
flo
w p
airs
Hidden Terminals
Partial Hidden Terminals
Perfectly Sense
Throughput Comparison
ZigZag
Throughput
CD
F o
f co
ncur
rent
flo
w p
airs
802.11
Hidden Terminals get high throughput
ZigZag Exploits Capture Effect
Capture EffectSubtract Alice and combine Bob’s packet
across collisions to correct errors
∆1 ∆2Pa1
Pb
Pa2
Pb
3 packets in 2 time slots better than no collisions
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 ∆2Pa
Pb
Pa
Pb
8080
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 GroupG1 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
Retransmission
8383
Remap Basic Idea: Structured Permutation
Subcarrier Group
G1 G2 G3 G4
A1 A2 A3 A4Mapping π1
A4 A3 A2 A1Mapping π2
A2 A1 A4 A3Mapping π3
A3 A4 A1 A2Mapping π4
84
How Permutation Helps Non-matching collisions on adjacent
channels C1 and C2Subcarrier Group
G1 G2 G3 G4
A1 A2 A3 A41st transmission
2nd transmission A4 A3 A2 A1
A2 A1 A4 A33rd transmission
A3 A4 A1 A24th transmission
8585
How Permutation Helps (cont’d) Non-matching collisions on non-adjacent
channels C1 and C3
Subcarrier Group
G1 G2 G3 G4
A1 A2 A3 A41st 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
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 S2Sn
Time
Freq
Pa
B5
B2
B3
B4
A4 A3
A2
A1
S1 S2Sn
B2
B5
B4
B3
P′b
P′a
G1
G3
G2
G5
G4
G2
1
59
13
410
14
3
711
2
68
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