Understanding 802.11 Medium Contention
In my previous post, I outlined the major factors affecting network performance, including geographic delay (latency), serialization delay (commonly referred to as bandwidth or speed), and variable contention delay (another form of latency, often forgotten). I described how geographic delay is essentially a constant for wireless local area networks and serialization delay is reaching maximum realistic limits with 256-QAM modulation which requires a considerably strong signal strength and SNR to be used. Therefore, contention delay is the biggest factor affecting WLAN performance that WLAN administrators have direct control over to optimize the performance of their networks.
In this post, I’d like to dive deeper into 802.11 medium contention to understand how it works as a precursor to the final blog post in this series where I’ll detail the two main sources of medium contention and how to properly design and optimize wireless networks to prevent medium contention from killing your WLAN performance.
Comparing and Contrasting Wi-Fi and Ethernet
To understand medium contention, it is helpful to understand the wireless medium upon which Wi-Fi operates. Wireless technologies use radio frequencies transmitted across open air, which is inherently an unbounded and shared medium. Wi-Fi in particular uses a medium contention protocol called CSMA/CA (Carrier Sense Multiple Access, Collision Avoidance). In comparison, Ethernet uses CSMA/CD (Carrier Sense Multiple Access, Collision Detection). What they both have in common is the need to perform Carrier Sense (CS) for medium idle/busy detection on a Multiple Access (MA) network segment. One main difference between Ethernet and Wi-Fi is how collisions are identified (Collision Avoidance versus Collision Detection) and how stations are granted access to the medium once it is found to be idle.
Note – CSMA/CD is used by legacy half-duplex shared Ethernet. With the advent of full-duplex switched Ethernet, the need to for CSMA/CD was eliminated and is no longer used when a full-duplex link is present.
Ethernet stations can detect collisions over the wire because a portion of energy is reflected back to the transmitter when a collision occurs. Therefore, Ethernet uses a “transmit, then check for collisions” approach to medium contention and collision detection. Technically, this is called 1-persistent CSMA because Ethernet stations transmit with 100% probability when the network is idle. This allows Ethernet stations to minimize overhead by transmitting immediately after the previous frame transmission once the medium is idle. Additionally, Ethernet stations can detect collisions on the wire very fast, within the first 50μs of the frame, which is why Ethernet frames must be padded out to a 64-byte minimum length. When stations detect a collision, it immediately ceases transmission of the remaining frame to reduce wasted network overhead and reactively implements a backoff procedure to minimize the probability of a subsequent collision.
However, Wi-Fi stations cannot detect collisions over the air and use a more cautious “randomized access” medium contention approach. Technically, this is called p-persistent CSMA, where "p" indicates the probability of transmission when the medium is found to be idle after it was previously busy (perhaps due to a previous frame transmission). This is largely due to the inherent differences of electromagnetic signaling over guided versus unguided media (copper or fiber cabling versus the air). Therefore, Wi-Fi stations must implement collision avoidance instead of collision detection, which randomizes network access among multiple stations. Randomized network access is beneficial when multiple stations have queued traffic awaiting transmission, yet the medium is busy. The previous frame transmission and access deferral serve to align subsequent transmission attempts by multiple stations, and without randomized access, there is a much higher probability of frame collisions. Coupled with the inability to detect collisions over the air, multiple stations would continue transmitting at the same time for the full length of the frame, wasting large amounts of airtime and causing significant network overhead.
Wi-Fi Collision Avoidance Mechanisms
Wi-Fi collision avoidance mechanisms include inter-frame spacing for different high-level frame types (for instance, control versus data frames) and a contention window to introduce randomness into the distributed medium contention logic of radio transmitters since there is no central source of coordination between Wi-Fi stations.
Inter-frame spacing provides priority access for a select few types of control frames necessary for proper network operation. The Short InterFrame Spacing (SIFS) value is used for acknowledgements that must directly follow the previous data frame; DCF InterFrame Spacing (DIFS) is used for non-QoS data frames; Arbitrated InterFrame Spacing (AIFS) is used for QoS data frames and is variable based on the WMM Access Category (AC) to which the frame is assigned. Before every frame transmission, Wi-Fi stations select a random timer value within the contention window range and countdown until the timer expires (unless the medium was idle immediately prior, in which case the contention window timer may be skipped). Only then are stations allowed to transmit the frame if the medium is still idle. If a collision occurs (as implied by the absence of an acknowledgement frame), then the transmitting stations double the contention window size to reduce the probability of a subsequent collision, up to a fixed maximum contention window size. This is called Truncated Binary Exponential Backoff. The initial small contention window size is referred to as the Contention Window Minimum (CWMin) and the capped maximum size is referred to as Contention Window Maximum (CWMax). When WMM QoS is in use, both inter-frame spacing and the contention window size vary based on the WMM AC to which the frame belongs, providing a statistical advantage for higher priority traffic over lower priority traffic. This method of probability-based medium contention introduces a large amount of network overhead to minimize the possibility of a frame collision.
Note – the term “frame collision” is technically inaccurate for wireless networks. The RF energy from two simultaneous transmitters do not actually collide in the air and affect one another; rather the radio receiver is unable to distinguish between the two signals to accurately decode the data from the desired transmission.
Positive Frame Acknowledgement
Wi-Fi transmitters are incapable of detecting collisions since there is no direct return path for the RF energy that is dispersed out into an expanding wave front over the air. Therefore, both stations fail to realize that a collision has occurred until the entire frame has been transmitted and there is an absence of frame acknowledgement from the intended receiver. Each retransmission attempt results in the contention window doubling in size (binary exponential backoff), from which the random backoff timer is selected. For these reasons, collisions on a Wi-Fi network are more severe and result in more network overhead than on an Ethernet network where frame collisions can be detected very quickly during transmission of the frame preamble.
Positive frame acknowledgements are required since Wi-Fi stations cannot directly detect collisions over the air and because the medium is not reliable, which can result in frame loss or corruption due to various sources of signal attenuation or RF interference. Therefore, for the Wi-Fi network to provide a reliable link-layer transport of frames between stations, the receiver must inform the transmitter that the frame was properly received. This occurs when the receiver sends back a short acknowledgment frame indicating successful reception of the immediately preceding data frame. Positive frame acknowledgement is a large source of network overhead on Wi-Fi networks. 802.11n/ac stations can minimize both medium contention and acknowledgement overhead by using frame aggregation and block acknowledgements, which allow the transmitting station to send multiple data frames at once and receive one acknowledgement from the receiver. By eliminating the need to acknowledge each individual frame, more network capacity is available for data transmission, resulting in better system performance. This is due, in part, to the half-duplex nature of 802.11, which relies on the same channel (frequency) for bi-directional communication. The block acknowledgement indicates which frames were received successfully and which were not, allowing selective retransmission of only the frames that were not properly received (similar to TCP selective acknowledgements at Layer 4 in the OSI model).
802.11 protection mechanisms provide backwards compatibility to ensure the coexistence of older WLAN clients with newer ones as well as to ensure all Wi-Fi stations on the channel are made aware of a pending frame transmission and defer access to prevent frame collisions, reducing hidden node problems. Backwards compatibility is necessary because older clients cannot interpret transmission at higher data rates by newer clients due to different modulation and encoding techniques. Therefore, newer clients need to transmit RTS/CTS or CTS-to-Self control frames at the legacy data rate before transmitting their higher-speed data frames. RTS/CTS ensures that all clients receive the frame and appropriately set their NAV (“network allocation vector”, which is a type of internal back-off timer) to defer transmission for the length of time indicated for completion of the subsequent higher-speed data frame transmission. Most modern clients automatically implement CTS-to-Self mechanisms for protection when the AP indicates that older clients are associated or detected within range. RTS/CTS must be manually enabled, but is more thorough in protecting a frame transmission from collision because it prevents hidden node issues and allows all clients within the cell to hear the CTS frame when it is transmitted by the AP. Protection mechanisms occupy network airtime and increase network overhead by as much as 40%, but can improve network performance in situations where there are hidden nodes or a mixture of old and new Wi-Fi clients.
Channel Utilization – The Canary in the Coal Mine
Network load (channel utilization) has a large effect on medium contention, frame collisions, the amount of network overhead, and ultimately WLAN performance. As channel utilization increases within an environment, the likelihood grows that multiple stations will select the same random backoff timer from the initially small contention window range. This applies to all Wi-Fi transmitters operating on the same frequency, whether they are APs or clients. When multiple stations select the same timer value they will transmit frames at the same time resulting in a collision.
It is important to understand that there is a breaking point at which channel utilization degrades WLAN performance. As WLAN administrators we need to understand how the network is used, how it changes over time, and continually plan for new use-cases. These days this typically requires the need to perform adequate capacity planning on a recurring basis. The more data that you have to work with from your current NMS the better. Historical data and trends will allow you to understand what applications and devices are on your network, in what quantities, and how your network evolves over time to identify areas of high utilization and plan for growth. Pay particular attention to the channel utilization metrics that your NMS provides for access points in your network. Establish a baseline for each area, trend these metrics over time, and identify appropriate thresholds for alarms to proactively identify areas that need attention to remediate issues or provision greater capacity (re-design).
Now that you know how 802.11 medium contention works, the next step is to learn how to apply this knowledge to improve WLAN planning and design with the goal of optimizing WLAN performance. In my next post I’ll detail the two main sources of medium contention, explore Wi-Fi's breaking point(s), and I'll show you how to integrate this into WLAN planning and design.
Andrew von Nagy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.