802.11 Contention Mechanisms: Explained

802.11 is the designation for what is more popularly known as WiFi. It’s the section of IEEE Standards that strictly defines how WiFi works. Think of it kind of like a blueprint for how your AP or router operates over the air. Contention, then, is focused on the idea that more than one device is going to be needed at a time. Contention in a general sense describes exactly how they negotiate this to make sure they don’t “step on each other” or what happens when they do.
In this article, we are going to deep dive into the two most popular methods that Wi-Fi uses to contend, or “arbitrate” how frames are transmitted. We’ll be discussing the base, Distributed Coordination Function, and the enhancement, Enhanced Distributed Channel Access.
What is Distributed Coordination Function (DCF)?
DCF, or distributed coordination function, is the contention method used when EDCA isn’t. In other words, it’s the default for non-QOS stations in WiFi. DCF uses Carrier sense to find out when someone else is using the medium. This can be virtual or physical.
Physical carrier sense is looking mostly for transmissions that can be decoded or energy on the same carrier frequency. Virtual carrier sense instead takes frames that can be decoded and extracts a value from them called the NAV which is stored in the MAC header’s duration field. The duration field essentially tells stations how long the transmission is expected to be. If the NAV is 0, then the station is done and the receiving station may then contend for the medium as soon as the transmission ends. If it is not, that means the “speaking” station is still using the medium, and the listener must add the duration of the NAV to its own timer.
When the NAV is 0, or the duration has expired, the station may then begin to contend again for the medium. It must complete a clear-channel-assessment (CCA) to see if it’s available each and every time that it wants to transmit. Let’s assume that the station does this, and the PHY reports clear, and the medium isn’t busy. The station still can’t transmit just yet; It must wait for something called interframe space. There are different kinds of interframe spaces for differing reasons and QoS reasons.
Next, after the interframe space, the station then applies what’s called a Back-off timer. The Back-off timer is a pseudorandom number that is computed by the station itself, multiplied by the slot time, a designated length of time unique to each PHY. 802.11 a,b, g, n..etc all have different slot times. This is referred to as the contention window, and the process governing it is the contention algorithm.
Once all of these various timers and waits have elapsed, and the station conducts a final CCA, it then transmits. It seems like a lot, but it’s relevant when you think about both how quickly these exchanges happen (microseconds!) and how many stations can be trying to do this all at once. It’s truly amazing that Wi-Fi as a protocol (or suite, really) not only works, but is as incredibly resilient as it is.
There’s one final part, however. Collisions can still happen, even with all the precautions. To avoid this (remember it can’t detect a collision since it’s in the air and half duplex!) the IEEE implemented a feature which has been, with one exception, unchanged since inception, the acknowledgment frame (ACK).
The humble ACK frame must be sent after each and every transmission, or in 802.11ac’s case, after a block of them. If the station doesn’t receive an ACK back from the AP, or vice versa, it assumes that it hasn’t been heard and immediately retransmits. It doesn’t wait, or rest the back-off timer, but retransmits immediately. It only waits a short interframe space (SIFS), and the duration of an ack before attempting again. It will cease only when it has been acknowledged, or if for some reason the protocol has been instructed otherwise. Some vendors have adjustable caps on how many times a frame can be retransmitted before being dropped.
What is Enhanced Distributed Channel Access (EDCA)
Introduced with 802.11e, EDCA is a QoS implementation unique to 802.11. It shouldn’t be construed to be end-to-end QoS, that has to be implemented at every level and enabled on the relevant switches and routers.
If even one of them doesn’t retain and read QoS, the tagging is lost for the rest of the journey, and nearly all of the return. 802.11e added four QoS “categories” to 802.11 frames. They are, from highest to lowest priority:
AC_VO - Voice traffic
AC_VI - Video traffic
AC_BE - Best effort traffic
AC_BK - Background traffic
The main alteration is that each of these categories use a different value to modify the contention window we just discussed, resetting the variables they use to compute this value. The higher the priority, the lower the range of values that are used.
For example, AC_VO, which is the highest priority, has a minimum value for the window of 3, and a maximum of 7, whereas the lowest AC_BK uses a minimum of 15 and a maximum of 1023. This results in the chances of a frame being sent sooner being higher for the higher priority.
Note this is a probabilistic version of QoS, not a deterministic one like the wired protocols often use. This means there is a chance that a background frame will be transmitted before a video one, even if it is queued after, though it has a “worse” value. One can visualize this in a way kind of like hoppers all leading to the same endpoint.
The “Better” the QoS value, the larger the hole at the bottom of the hopper, letting more through for the same time, and the converse. Only one can emerge at a time, but you’re much more likely to get any chosen ball from the “better” hoppers more quickly than you are from the narrow, “worse” hopper.
What is Wireless Multimedia (WMM)?
We should note something called WMM, which standardized this behavior in the consumer market vendors started making these AC values configurable. Almost every vendor now in the enterprise space will allow you to change these values, as well as assign a permanent AC value to individual clients.
As a professional, I would caution anyone wanting to overly customize the values. These aren’t always ideal, but leaving them as-is allows most devices to be prioritized properly nearly automatically. If you change it, be SURE and test it off the production network.
Final Thoughts
If you want to implement QoS, as mentioned earlier, it’s worth the time to capture a couple of frames off the network on both the wireless and wired sides- Your frames on the wire should have 802.1d tags on them that mirror the 802.11e QoS tags from EDCA we just discussed. If they don’t, you need to go back a step in the chain and check the last switch or router configuration. QoS is meaningless if it’s not reciprocated.
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.