Wireless LAN - MAC layer
Omer Ben-shalom
references 802.11 Wireless Networks: The Definitive
Guide, M.Gast, O’Reilly, 2002 Some drawings are taken from the O’Reilly book
White papers at Intersil Few drawings and slides borrowed from other
lectures in the IEEE and universities
Introduction The 802.11 MAC is common to all 802.11
flavors provides transmission of user data into the air Uses Carrier sense multiple access (CSMA) Uses Collision avoidance (CA) rather than
detection Uses a distributed access function like Ethernet
with no central controller but has a controller based mode
Lecture brief 802.11 terminology and challenges 802.11 services Media access coordination functions
Distributed coordination Point coordination
Frame types and formats
802.11 Vs 802.3 (Ethernet) 802.11 is an 802 (i.e. Ethernet) protocol for
use in a wireless environment The protocol has to deal with some significant
differences from wired Ethernet Power management – Common devices are
mobile, battery life is of utmost important Bandwidth The ISM spread spectrum do not offer
BW similar to the wired options and is shared Security – The wireless signal can be picket up
without direct attachment removing the option of physical security.
802.11 Vs 802.3 (Ethernet) Addressing -The topology of a wireless network
is dynamic since the stations are free to move around. The protocol is expected to allow and support such roaming
Noise - Radio networks are very noisy Narrowband transmissions Microwaves and other Multi path fading
Media sense The transmitter cannot listen while talking The Hidden node problem - Not all the users are
guarantied to hear each other, unlike Ethernet
Hidden node problem not everyone hears everyone
Distance Physical barriers (walls etc) A traffic to B can collide with C traffic to B without
A or C being in the know
CBA
Basic 802.11 terminology AP – Access Point. A central controller that can
extend the range of the service set stations in the BSS talk through a central controller (AP) The AP sets configurable parameters that all must match Those are carried in special packets called beacons
BSS – Basic service set (‘cell’) Group of stations using the same media and in a Basic Set
Area (BSA) Stations communicate directly or using an AP If no central controller exist this is an iBSS
Membership in a BSS is defined by the Service Set Identifier (SSID) and the BSSID (Normally controlled by the AP) Multiple APs per SSID. Potentially multiple SSID per AP
Basic 802.11 terminology Different APs connect through a distribution
system (DS). Normally a wired backbone All the APs connected on the DS and their
BSS form the ESS - Extended service set The ESS is a single L2 environment
/broadcast domain Stations send packets other stations in the same
ESS ‘directly’ Stations can freely move within the ESS
An EBSS environment
DS
802.11 MAC layer details 802.11 is a “listen before talk” protocol with two
basic modes of operation: Basic access – send whenever media is free RTS/CTS – asking request for sending
Based on a series of timers governing the sending of frames (Interframe spaces)
Uses ARQ Scheme based on positive acknowledgment of packets (ACK) for unicast No ACK mechanism for broadcast/multicast
Distributes the resources ‘fairly’ among clients In spite of using ‘Collision avoidance’ collisions can
and do occur
Associations and Mobility There are three kinds of mobility:
No AP transition: A wireless station is either stationary or moves only within a
single BSS. Nothing special is needed. BSS transition:
The wireless station is moving from one BSS to another BSS inside the same ESS. Uses the reassociation service to support the move. No packets should be lost
ESS transition: Requires a disassociation and a new association in the new
ESS. Usually involves change of IP address and sessions are broken unless using mobile IP or similar.
Power save modes 802.11 allows for a power save mode Clients go to ‘sleep’ for intervals set by the AP AP buffers frames to the client for that period When client wakes up it will retrieve missing frames
by sending a DS-poll to the AP The AP can respond in two ways
Immediately send the packet Send a simple ACK on the request with no data. Station
than has to stay awake until data is delivered and the AP beacon specifies it has no waiting data
Defined 802.11 services – station services MAC Services Data Unit (MSDU) delivery
This is the service of passing a data unit from sender to receiver in the same BSS
WEP/security services Authentication: supplying identity to the other
station in order to be allowed to for relationship De-authentication: informing the other side that
you are terminating the relationship Privacy includes the use of WEP for encryption
Those are the only services allowed in an iBSS (no AP)
Defined 802.11 services – distribution services
Distribution Data delivery service from any station to any other station in the
ESS though the AP For this to work any AP has to know all the stations associated to
it and be a proxy for them on the DS Association services
Association: The act of joining a BSS and registering in the AP for distribution to work (initiated by station)
Disassociation: The act of terminating the relations between AP and station (initiated by both sides)
Reassociation: The act of letting an AP know you are joining his BSS from another BSS and specifying the last AP. New AP can instruct the old AP to void the station registration
Integration Allows stations on an ESS to talk to devices on different kinds of
LAN (Ethernet for example)
802.11 distribution services
There are two basic types of distribution services define controlling how stations can access the medium Distributed coordination function (DCF) – not
using a central controller. More similar to normal Ethernet. Mandatory Two sub implementations with and without RTS/CTS
Point coordination function (PCF) – access is regulated by a central controller (the AP). Not mandatory and usually not implemented Will be discussed at the end of the lecture only
DCF (Distributed coordination function)
Fundamental channel access method in 802.11
Used by asynchronous data services implements explicit Acknowledgements Does not use a central controller Based on CSMA/CA (Collision Avoidance) Collision detection is not used, because a
station cannot listen to the (air) channel for collisions when transmitting Uses Collision Avoidance (CA) with timers
Contention function timers Inter frame space (IFS): Time interval
between transmission of frames Three IFS values are specified
Time slot is defined to 9 microseconds Short-IFS (SIFS) defined to 16 microseconds DCF-IFS (DIFS) = SIFS + 2*time slot PCF-IFS (PIFS) = DIFS + time slot for PCF SIFS < PIFS < DIFS
Access to the media is controlled through these three IFS intervals
Media sense DCF implements two different kinds of media
sense Physical Carrier sense/Clear Channel
assessment is carried out in the physical layer and is based on energy levels and/or 802.11 protocol activity detection
network allocation vector (NAV) or Logical Carrier sense – indicates amount of time that must elapse before channel can be tested again for idle. For simple DCF the NAV is Initiated by hearing the duration field of a data frame
Collision Avoidance in DFS If a node wants to broadcast, it checks if the channel
is idle for a little while (DIFS microseconds). DIFS is the distributed inter frame spacing
If the channel is idle, it broadcasts. When the receiver gets the frame, it check the CRC and if all is ok, it transmits an ACK after a shorter (SIFS microseconds) interval. Else source will resent. Means ACK has preference over any other frame transmission
Essentially collision detection is performed by not receiving an ACK
Fragmentation support The short IFS (SIFS) was created to support
fragmentation and resending of corrupted packets That is the real difference from Ethernet
Another fragment or a resent packet only have to wait SIFS microseconds and not DIFS So resent/fragment has preference over new
packets and the same preference as the ACK
Exponential backoff algorithm
If the channel is busy, waits until it is clear + DIFS interval
Allows more fragments or ACKs After DIFS add a random interval between 0
and the CW (contention window) time slots CW is started at 31 and decremented by 1 while
medium is free If medium becomes busy, the timer is frozen
Collision Avoidance in 802.11
More collision avoidance Having different counters does not guarantee
that transmissions will not collide When two stations transmit simultaneously a
collision will occur The collision is resolved as by both stations
doubling the CW and restarting the random access process again Exponential backoff algorithm
CSMA/CA flowchartstart
NAV=0?
sense channel
yes
ChannelIdle
?
transmit frame
yes
collision?
No - success
random backoff
no
no?
Limitation of simple DCF Assumes stations can hear each other susceptible to the ‘Hidden node’ problem Sender cannot detect a collision during
transmission Wasteful if collision happen for a long frame
Solution – RTS/CTS RTS/CTS allows a station to seize the channel for a
short time avoiding collisions A requests to send to B (RTS) for duration X after contending
for the channel If B senses does not know of a conflict will clear A to send
(CTS) with same timer after waiting SIFS microseconds A will send the packet after waiting just SIFS microseconds If C hears the CTS it will not transmit itself
All stations in the BSS, read the RTS frame and adjust their NAV accordingly
RTS/CTS frames are very short (20 bytes), so collision is unlikely and if it happens less BW is wasted
Implications of CTS/RTS CTS/RTS has overhead
Need to send both for each packet send Used only for packets over a certain length
threshold (XXX bytes by default) Taken into consideration when implementing
logical carrier sense The NAV can be now set by the duration fields in
CTS/RTS Solves the hidden node problem because every
‘hidden’ node will hear RTS or CTS
TimingSIFS = 16s, PIFS = 25s, DIFS = 34s, EIFS = 43s, Slottime = 9s
begin to sense
channel
DIFS
decide that the channel to be idle
RTS CTS SIFS DATA ACK
How long does it take to send an RTA, CTA, Data or ACK? Later
SIFS
channel sense
Sending a single data packetSIFS DIFS
DIFS RTS CTS SIFS Frag 1 ACKSIFS SIFS SIFS Frag 2 ACKSIFS SIFS
Sending a fragmented data packet
DIFS RTS CTS SIFS Data ACKSIFS SIFS
Sending back to back packets
DIFS
Wait an random backoff, i.e., random(0,CW)*slottime)But don’t increment/decrement CW.
RTS CTSSIFS
RTS/CTS overhead (intersil)
Virtual Channel Sensing (no RTS/CTS)
Virtual Channel Sensing (RTS/CTS)
DCF –without CTS/RTS
DCF – RTS/CTS
802.11 MAC Frame types Management Frames: Used for
Station association, dissociation, timing and synchronization, authentication and more
Control Frames: Used for controlling medium access Handshaking during contention periods (RTS/CTS) ACK frames during contention period
Data Frames: Used for Sending data
Frame formats
Address fields The address fields are used differently for
different frame types Normally 3 addresses are used:
Source Address Destination Address BSSID – network identifier. May be the AP MAC
The 4 address format is only used with WLAN bridges Source/address bridges Source/address of original packet
802.11 Frame control field
ProtocolVersion
Type SubTypeToDS
RetryPwrMgt
MoreData
WEP Rsvd
Frame Control Field
Bits: 2 2 4 1 1 1 1 1 1 1 1
DSFrom More
Frag
802.11 frame types
Management frames Management frames carry in the MSDU a
payload made of information elements and fixed fields
Are very versatile and contain two types of fields Fixed length fields defined by the standard Variable length fields that can be extended in the
future by vendors. Support proprietary/extension features called information elements
Fixed fields Fixed fields are used for the various
management operations and include: Authentication details Beacon interval Capacity information AP address Listen interval Time stamp Reason and status codes for authentication and
association
Information elements Information elements are variable length
components. Each has the ID, length and data. New ones can be created as needed Examples include: SSID Supported rates Traffic indication map (TIM) – an indication of
waiting traffic for stations coming up from a sleep period
Main management frame types Beacon – Sent by the AP to coordinate
Allow finding and identifying networks Includes the SSID and the BSSID Set timers and other parameters for the cell Has the traffic indication map (TIM) for all stations
Probe request/response A request to get service for a specific SSID and
transmission rates. Candidate APs will answer
Association/Authentication request, responses and the relevant de-association/de-authentication
PCF
PCF is an optional capability which is connection oriented and provides contention free frame transfer
PCF is based on a central coordinator (PC which is usually at the AP
The PC arbitrates the media using polling. Polling interval is not standardized and left to implementers
Polled stations are allowed to transmit data sequentially, thus removing contention
PCF PCF sits of top of DCF (shown earlier) PCF and DCF times alternate
PCF uses the contention free period (CFP) DCF uses the contention period (CP) A CFP followed by a CP form a superframe
CFP_Rate is parameter used to determine the frequency with which CFP occurs
A limit is set on the duration of CFP so that the DCF traffic is not starved. It has to allow for a minimum of one maximum size frame
PCF operation AP initiates the PCF by sending a beacon
frame announcing the CFP and its duration Beacon is sent every target beacon transmission
time (TBTT) The CFP is ended by the PC sending an CF-End
management frame All clients must honor the CFP, if they do not
implement the PCF they are simply not able to transmit during the CFP and wait for the CP
In any case PCF has priority over DCF since a sending station only has to wait a shorter time (PIFS) to transmit
Stations register for the CFP in the AP and are on a polled station vector
Once CFP starts, the PC polls the stations in its polling vector
SIFS interval after the beacon frame, the PC sends a CF-Poll frame sequentially to each station that required service
A station on receiving this, sends a CF-ACK (no data) or a CF-ACK + Data frame, after SIFS duration
PCF operation
PCF
A station can send data to the AP in this way
Problems with PCF The beacon starting the CFP is subject to the
DCF contention as so its timing is not guarantied in spite of using PIFS (Deferred beacon problem)
The duration of transmission from a station is not really under the control of the PC
WLAN QoS WLAN QoS deals with two main contention types
Priority between packets internal to the host Priority in media access between hosts
Another consideration is the direction of the traffic Downlink QoS – from the AP to all stations much simpler since it is normally done on a single station –
AP Uplink QoS – from each station to the AP
Requires application awareness to register for the queues Arbitrates access to the media from multiple stations Therefore much more problematic
802.11e The 802.11e is a working group charged with
making changes to the MAC layer to allow for QoS (Quality of service) in WLAN Formally: “The purpose of Task Group E is to: Enhance the
current 802.11 MAC to expand support for applications with Quality of Service requirements, and in the capabilities and efficiency of the protocol.”
The standard is in a late draft (draft 13 at this time) form and expected to be rectified this year.
Implements two main methods of QoS control Extended DCF – also implemented as WMM HCF – Hybrid Coordination function – uses PCF functions
and only available as part of the final 802.11e spec
802.11e EDCF/WMM queues WMM is an interim spec on the way to 802.11e
implementing only eDCF EDCF is based on using different contention
parameters (CW) to differentiate queues WMM has 4 priority levels and queues:
Audio/real time Video Best effort Background
EDCF will support 8 priority levels but still 4 queues
Contention with eDCF Packets from different traffic categories (TCs).
Traffic compete unevenly in two ways: The CW for each TC is different so the time a station has to
wait to access the media is different The time available for transmission when the media is
taken (transmit opportunity or TXOP) is different between classes and may allow more than a single packet to be sent
The access is still statistical due to the randomness of the backoff part of the DCF Very good for providing different BW over time Far from optimal for time sensitive traffic
eDCF backoff algorithm details During the PC a station in each TC waits a
different timer called AIFS (Arbitrated Inter Frame space) AIFS uses backoff starting from CWmin and
growing for each For each collision as in DCF However the starting CWmin depends on the TC
and the increase after collision is also different as is newCW [TC] = (oldCW [TC] +1) * PF [TC] . 1
PF is the ‘persistence factor’
HCF There is a Hybrid Coordinator (HC) usually in the AP
like the PCF PC The Hybrid Contention function is active in both CFP
and CP with a similar frame exchange but different access rules. A station can get TXOP in both times The length of TXOP for each TC is published in the beacon During CP a station gets TXOP either by using eDCF or
getting a CF-Poll from the HC During CFP the TXOP are defined by the HC in the CF-poll.
Stations cannot transmit without getting a CF-Poll. The HC may allocate time to itself waiting only the
PIFS (shorter than any DIFS/AIFS) CFP ends with CF-End or the expiration of the timer
set in the beacon
HCF (cont) There are new acknowledge rules
The HC can use two new ack rules block acknowledge (optional) is more efficient. It is negotiated and allows the
sending station to use the TXOP to send multiple frames seperated only by SIFS and the HC will acknowledge all together.
no acknowledges is useful for VOIP and other traffic types were retransmit makes no sense
This is a per-station not per station x TC priority scheme ! There are also new frame definitions
The HC can send any combination of data, ack and poll in a single frame The TXOP granted is defined in the poll frame
HCF controlled contention To guarantee the ability of high priority stations to
request sending data the HC also create periods of ‘controlled contention’ in which only certain stations are allowed to send.
This is used to send a resource request to ask for a TXOP
The controlled contention is a number of windows separated by SIPS
Each station allowed (vector) chooses one and tries to request resources
The HC will Ack each request so the station knows if it succeeded in requesting or collision occurred
Client resource request Clients request resources through special
request frames called TSPECs The HC may or may not accept a TSPEC,
this is implementing access control The AP may offer an optional TSPEC
If a TSPEC is denied the sending station has to do with a lower priority level
TSPECs are not used to gain access to the best effort and background queues
Other optional features in 802.11e Direct link protocol (DLP) – allows stations to send
traffic directly to each other without the AP Very useful for things like WLAN projectors and such
Automatic power save delivery (APSD) – allows setting up scheduled delivery of packets The station now does not have to wake up for every
beacon Time offset in the beacon interval can be specified so
stations wake up in different parts of the beacon interval to listen