The question itself is not one that gets a lot of thought, but it is also a question which provides insight into a number of common wireless problems. Many network engineers are familiar with carrier sense multiple access (CSMA) with collision detection (CD). However, a wireless network does not detect collisions like a wired network does. Instead, the 802.11 standard defines a system for collision avoidance (CSMA/CA). The vendor-neutral CWNP white paper on 802.11 Arbitration goes into great detail explaining CSMA/CA, but here we hope to just give a basic overview of the topic in order to help wireless network administrators and engineers understand how wireless devices access the wireless medium (WM).
An easy analogy for WLAN communication is a polite conversation. Imagine a group of people sitting around a table. One person may have organized the discussion and will announce the start of it. Then each person will look around and listen to see if anyone else is talking. If no one is talking, one person will speak while everyone else is silent. When that person has finished, the intended recipient will acknowledge that the speaker was heard. Then everyone looks around and listens again. Another random person may begin speaking, but it is possible two or more people may begin speaking at the same time. This creates noise and the speakers will stop. They will look and listen again, and at a random time another speaker will start again. In this example, the participants easily detect a "collision" because they hear each other. However, an 802.11 WLAN is half-duplex, and so to fix this analogy we have to imagine that once a person starts speaking, they cannot listen at the same time. They only know they were not heard because they never received an acknowledgement.
This analogy translates into a simple outline for CSMA/CA. We are not going to define every term used in this outline, but if something is unclear, please leave a comment. One item that does need to be explicitly defined is the use of station. A wireless station (STA) refers to both access points (APs) and client devices. This means that both APs and clients abide by the same set of rules.
- The STA uses a physical carrier sense (Clear Channel Assessment - CCA) to detect if the WM is busy.
- The STA will also listen for 802.11 frames and try to set their Network Allocation Vector (NAV) based on the Duration/ID field when possible. This is virtual carrier sense.
- The NAV must count down to zero before a STA can continue.
- If physical medium is clear and the NAV has reached zero, the STA will wait for a defined period of time (interframe space - IFS) as prescribed by the protocol.
- After the IFS, if the medium is still clear and the NAV is still zero, the STA will generate a random backoff number using a value selected from the contention window (CW).
- The backoff number is reduced by one for every time slot the medium is idle.
- If the STA hears another transmission during this countdown, then steps 1, 2, and 3 are repeated.
- Once this backoff timer reaches zero, if the medium is still idle, the STA will then transmit its frame.
- Repeat after a successful transmission
In closing, we should mention that each channel is, in theory, a different collision domain. So, for example, a STA on channel 36 does not have to contend with a STA on channel 161. In practice, adjacent channels may still cross into channels even when we think of them as non-overlapping. We also briefly mention access categories (ACs) since this helps explain the CW values, and it also clarifies how quality of service (QoS) functions in a WLAN. A device must support 802.11e (often times listed as WMM certified) in order to use these ACs. There are four ACs: Voice, Video, Best Effort, and Background. Each AC is assigned a minimum and maximum CW value. For example, the voice AC has a minimum value of 3 and maximum value of 7. So the backoff number for a VoWiFi frame will between 3 and 7. The values for Best Effort are 15 to 1023. This means a VoWiFi frame is more likely to win contention but does not guaranteed that it will. QoS in a WLAN is only probabilistic since all devices must contend for the same medium.