Wireless Communication Systems
@CS.NCTU
Lecture 9: MAC Protocols for WLANs
Instructor: Kate Ching-Ju Lin ( 林靖茹 )
1
Reference
1. A Technical Tutorial on the IEEE 802.11 Protocol By Pablo Brenner
online: http://www.sss-mag.com/pdf/802_11tut.pdf 2. IEEE 802.11 Tutorial
By Mustafa Ergen
online: http://wow.eecs.berkeley.edu/ergen/docs/
ieee.pdf
3. 802.11 Wireless Networks: The Definitive Guide By Matthew Gast
4. 802.11ac: A Survival Guide By Matthew Gast
online: http://chimera.labs.oreilly.com /books/1234000001739
Agenda
• Basic 802.11 Operation
• Collision Avoidance (CSMA/CA)
• Hidden Terminal
• QoS guarantee
• Other Issues
• Performance Analysis
3
Why MAC for WLANs is Challenging?
• Wireless medium is prone to errors
• One station cannot “hear” all other stations
⎻Local view != global view
• Channel quality, and thereby the achievable data rate, is closely related to link distance, and could change with time due to mobility
• Again, because of mobility, need management mechanisms to
(de)associating with APs as location changes
⎻Need efficient handoff to ensure seamless access
4
MPDU
What is MAC?
• Medium access control
• Layer 2 (link layer)
• Allowing multiple
stations in a network to share the spectrum
resources and
communicate (1-hop)
• Type of communications
⎻Unicast: one-to-one
⎻Multicast: one-to-many
⎻Broadcast: one-to-all
5
LLC LLC
MAC MAC
PHY PPDU PHY
MSDU MSDU
PSDU PSDU
STA 1 STA 2
Basic Service Set (BSS)
• BSS
⎻Basic building block
⎻Infrastructure mode
• IBSS (independent BSS)
⎻Ad-hoc network
• ESS (extended service set)
⎻Formed by interconnected BSSs
6
Infrastructure Mode
7
• Each station (STA) associates with a central station Access point (AP)
• An AP and its stations form a basic service set (BSS)
• AP announces beacons periodically
AP
STA
BSS (Basic Service Set)
Infrastructure Mode
8
• Several BSSs could form an ESS
• A roaming user can move from one BSS to another within the ESS by re-association
AP
STA
AP
ESS (Extended Service Set)
Infrastructure Mode
9
• Issues
⎻Inter-BSS interference: via proper channel assignment
⎻Load balancing: via user management
AP
STA
AP
ESS (Extended Service Set)
Ad-Hoc Networks
• Clients form a peer-to-peer network without a centralized coordinator
• Clients communicate with each other via multi-hop routing
⎻Will introduce ad-hoc routing
10
IBSS (independent BSS)
Beacon and Association
• The AP in each BSS broadcasts beacon frames periodically (every 100ms by default)
• Each beacons includes information such as SSID and AP’s address
• A STA discovers a BSS by switching channels and scanning to look for beacons Associate
11
100 ms
Two Operational Modes
• Distributed coordination function (DCF)
⎻Stations contend for transmission opportunities in a distributed way
⎻Rely on CSMA/CA
• Point coordination function (PCF)
⎻AP sends poll frames to trigger transmissions in a centralized manner Less
used
CSMA/CA
• Carrier sense multiple access with collision avoidance
• Similarity and difference between CSMA/CD and CSMA/CA
⎻Both allow a STA to send if the medium is sensed to be
“idle”
⎻Both defer transmission if the medium is sensed to be
“busy”
⎻CD: immediately stop the transmission if a collision is detected
⎻CA: apply random backoff to avoid collisions!
13
samediff Why?
a half-duplex STA cannot detect collisions during transmission
DCF
• Start contention after the channel keeps idle for DIFS
• Avoid collisions via random backoff
• AP responds ACK if the frame is delivered correctly (i.e., passing the CRC check) No NACK
• Retransmit the frame until the retry limit is reached
14
Prioritized Interframe Spacing
• Latency: SIFS < PIFS < DIFS Priority: SIFS > PIFS > DIFS
• SIFS (Short interframe space): control frames, e.g., ACK and CTS
• PIFS (PCF interframe space): CF-Poll
• DIFS (DCF interframe space): data frame 15
Find specific timing in the Spec. or Wiki
Frame Format
• How to estimate protocol overhead without considering backoff
⎻1 - TData / (TDIFS + TPLCP + TMAC + TData + TSIFS + TACK)
⎻Control frames are sent at the base rate
(lowest bit-rate) 16
Page 11
Wireless Communications Breeze Wireless Communications Ltd.
Atidim Technological Park, Bldg. 1, P.O.Box 13139, Tel Aviv 61131, ISRAEL Tel: 972-3-6456262
http://www.breezecom.com Fax: 972-3-6456290
All 802.11 frames are composed of the following components:
Preamble PLCP Header MAC Data CRC
Preamble
This is PHY dependent, and includes:
n Synch: An 80-bit sequence of alternating zeros and ones, which is used by the PHY circuitry to select the appropriate antenna (if diversity is used), and to reach steady-state frequency offset correction and synchronization with the received packet timing.
n SFD: A Start Frame delimiter which consists of the 16-bit binary pattern 0000 1100 1011 1101, which is used to define frame timing.
PLCP Header
The PLCP Header is always transmitted at 1 Mbit/s and contains Logical information used by the PHY Layer to decode the frame. It consists of:
n PLCP_PDU Length Word: which represents the number of bytes contained in the packet. This is useful for the PHY to correctly detect the end of packet.
n PLCP Signaling Field: which currently contains only the rate information, encoded in 0.5 MBps increments from 1 Mbit/s to 4.5 Mbit/s.
n Header Error Check Field: Which is a 16 Bit CRC error detection field.
MAC Data
The following figure shows the general MAC Frame Format. Part of the fields are only present in part of the frames as described later.
Figure 5: MAC Frame Format
Page 11
Wireless Communications Breeze Wireless Communications Ltd.
Atidim Technological Park, Bldg. 1, P.O.Box 13139, Tel Aviv 61131, ISRAEL Tel: 972-3-6456262
http://www.breezecom.com Fax: 972-3-6456290
All 802.11 frames are composed of the following components:
Preamble PLCP Header MAC Data CRC
Preamble
This is PHY dependent, and includes:
n Synch: An 80-bit sequence of alternating zeros and ones, which is used by the PHY circuitry to select the appropriate antenna (if diversity is used), and to reach steady-state frequency offset correction and synchronization with the received packet timing.
n SFD: A Start Frame delimiter which consists of the 16-bit binary pattern 0000 1100 1011 1101, which is used to define frame timing.
PLCP Header
The PLCP Header is always transmitted at 1 Mbit/s and contains Logical information used by the PHY Layer to decode the frame. It consists of:
n PLCP_PDU Length Word: which represents the number of bytes contained in the packet. This is useful for the PHY to correctly detect the end of packet.
n PLCP Signaling Field: which currently contains only the rate information, encoded in 0.5 MBps increments from 1 Mbit/s to 4.5 Mbit/s.
n Header Error Check Field: Which is a 16 Bit CRC error detection field.
MAC Data
The following figure shows the general MAC Frame Format. Part of the fields are only present in part of the frames as described later.
Figure 5: MAC Frame Format
Data ACK
Check other frame format in Spec.
Overhead vs. Throughput
• Effective throughput
number of successfully delivered bits total occupied time
• Packet size vs. Effective throughput
• Bit-rate vs. Effective throughput
17
header 1500-byte data tail
header 1- byte
data tail Effective throughput ~ 0
✘
?
header 1500-byte data sent at 24 mb/s tail
header 1500-byte data tail Sent at 48 mb/s
(halve the tx time)
Throughput(48) !=
2 x Throughput (24)
Fragmentation and Aggregation
• Success probability v.s. frame size
⎻Large frame reduces overhead, but is less reliable
⎻Discard the frame even if only one bit is in error
⎻Packet delivery ratio of an N-bit packet: (1-BER)N
• Fragmentation
⎻Break a frame into into small pieces
⎻All are of the same size, except for the last one
⎻Interference only affects small fragments
• Aggregation
⎻Aggregate multiple small frames in order to reduce the overhead
⎻Supported in 802.11e and 802.11n
Agenda
• Basic 802.11 Operation
• Collision Avoidance
• Hidden Terminal
• QoS guarantee
• Other Issues
• Performance Analysis
19
Random Backof
• STAs listen to the channel before transmission after DIFS
• Avoid collision by random backoff
20
Exponential Random Backof
21
1. Each STA maintains a contention window
⎻Initialized to CWmin = 32
2. Randomly pick a number, say k, between [0,CW- 1]
3. Count down from k when the channel becomes idle
4. Start transmission when k = 0 if the channel is still idle
5. Double CW for every unsuccessful transmission, up to CWmax (1024)
6. CW is reset to CWmin after every successful transmissionWhen will collisions occur?
What’s the probability a collision occurs?
Agenda
• Basic 802.11 Operation
• Collision Avoidance
• Hidden Terminal
• QoS guarantee
• Other Issues
• Performance Analysis
22
Hidden Terminal Problem
• Two nodes hidden to each other transmit at the same time, leading to collision
802.11’s Solution:
RTS/CTS
• STA1 sends RTS whenever it wins contention
• AP broadcasts CTS
• Other STAs that receive CTS defer their transmissions
AP
STA1
STA2
802.11’s Solution:
RTS/CTS
Usually disabled in practice due to its expensive overhead NAV (Network allocation vector): STA performs
virtual carrier sense for the specified time interval
Recent Solutions to Hidden Terminals
• Embrace collisions and try to decode collisions
⎻ZigZag decoding
⎻S. Gollakota and D. Katabi, “ZigZag decoding:
combating hidden terminals in wireless networks,” ACM SIGCOMM, 2008
• Rateless code
⎻Continuously aggregate frames and stop until decoding succeeds
⎻A. Gudipati and S. Katti, “Strider: automatic rate adaptation and collision handling,” ACM
SIGCOMM, 2011
26
Agenda
• Basic 802.11 Operation
• Collision Avoidance
• Hidden Terminal
• QoS guarantee
• Other Issues
• Performance Analysis
27
802.11 Family
• 802.11a/b/g: conventional DCF
• 802.11e: support quality of service (QoS) enhancements for wireless LANs
• 802.11n: support single-user MIMO (lecture 4)
• 802.11ac: support multi-user MIMO (lecture 5)
• 802.11ad: define a new physical layer in the 60GHz (mmWave, last lecture)
• 802.11p: for vehicular networks
28
802.11e EDCA MAC
• Enhance distributed channel access (EDCA)
• Support prioritized quality of service (QoS)
• Define four access categories (ACs)
29
priority low
high
802.11e EDCA MAC – Priority Queues
30
Manage frames using priority queues
How to Prioritize Frames in 802.11e?
• Again, by controlling the waiting time
⎻A higher-priority frame waits for shorter time
⎻Frames with the same priority contend as usual
31
priority high
low
How to Prioritize Frames in 802.11e?
• Again, by controlling the waiting time
⎻A higher-priority frame waits for shorter time
⎻Frames with the same priority contend as usual
• AIFS (Arbitration Inter-Frame Spacing)
32
guarantee probabilistic
(between ACs) (Within an AC)
Agenda
• Basic 802.11 Operation
• Collision Avoidance
• Hidden Terminal
• QoS guarantee
• Other Issue
• Performance Analysis
33
Other Issues
• Performance anomaly
⎻M. Heusse, et al., "Performance anomaly of 802.11b," IEEE INFOCOM, 2003
• Expensive overhead as the PHY rate increases
⎻K. Tan, et al., "Fine-grained channel access in wireless LAN,"
ACM SIGCOMM, 2011
⎻S. Sen, et al., “No time to countdown: migrating backoff to the frequency domain,” ACM MobiCom, 2011
Unequal band-width and flexible channelization
⎻20MHz in 802.11a/b/g/n/ac, 40MHz in 802.11n/ac, 80MHz and 160Hz in 802.11ac
⎻S. Rayanchu, et al., ”FLUID: improving throughputs in
enterprise wireless LANs through flexible channelization,“
ACM MOBICOM, 2012
Performance Anomaly
• The throughput of a STA sending at a high rate (e.g., 54Mbps) is degraded by that sending at a low rate (e.g., 6Mbps)
• Root causes?
⎻802.11 supports multiple transmission bit-rates, each of which has a different modulation and coding
scheme
⎻802.11 ensure packet fairness, instead of time fairness
35
Packet fairness: each STA has an equal probability to win the contention the average number of delivered packets for all STAs are roughly the same (802.11)
Time fairness: each STA occupies roughly the same proportion of channel time
rij=54 Mb/s
ruv=6 Mb/s
t
p/b54 p/b6
b54=36.2 Mb/s when l54 sends alone c54=4.14 Mb/s as contending with l6 b6=5.4 Mb/s when l6 sends alone c6=4.37 Mb/s as contending with l54
Performance Anomaly
Channel is almost occupied by low-rate links Everyone gets a similar throughput,
regardless of its bit-rate
Agenda
• Basic 802.11 Operation
• Collision Avoidance
• Hidden Terminal
• QoS guarantee
• Other Issues
• Performance Analysis
37
Performance Analysis for CSMA/CA
• Model to compute the 802.11 DCF throughput
• Assumptions
⎻Finite number of stations
⎻Ideal channel, i.e., no packet errors and no hidden terminals
⎻Consider “saturation throughput”, i.e., the maximal load a system can achieve
• Core ideas:
⎻At each transmission attempt (either first transmission or retransmissions), each packet collides with constant and independent probability p
⎻p: conditional probability related to contention window W and number of stations N
G. Bianchi, "Performance analysis of the IEEE 802.11 distributed coordination function," Selected Areas in Communications, IEEE Journal on 18, no. 3 (2000):
535-547
Model as a bi-dimensional discrete-time Markov chain {s(t), b(t)}
s(t): backoff stage at time t, b(t): backoff time counter at time t
Stage 0
Stage 1
Stage m
Random backoff
count down
Performance Analysis for CSMA/CA
fail succeed
Model as a bi-dimensional discrete-time Markov chain {s(t), b(t)}
s(t): backoff stage at time t, b(t): backoff time counter at time t
Stage 0
Stage 1
Stage m succeed
fail
Random backoff
Find the stationary distribution of the chain: bi,k = limt∞P{s(t)=i,
s(t)=k}
Performance Analysis for CSMA/CA
count down
• Find the stationary distribution of the chain
• The probability that a station transmits in a randomly chosen slot time
• The probability that there is at least one transmission
• The success probability of a transmission
Performance Analysis for CSMA/CA
Summary
• Nice properties of WiFi
⎻Unlicensed band Free!!
⎻Distributed random access and no coordination
⎻Ensuring fairness
• Common issues
⎻Expensive overhead and lower spectrum efficiency
⎻Hard to avoid collisions
⎻No QoS guarantee
Every protocol balances the trade-off between
performance and overhead
Quiz
• Assume the control frames and the
overhead occupies the channel time of 100us
• Compare the throughput if a 135-byte
(1080 bits) packet is sent at 6 Mb/s and 54 Mb/s, respectively
⎻(Hint:1080/54 = 20, 1080/6=180)
43