Wireless is a shared medium so all clients and access points need to wait on each other before they can transmit data. This is to avoid collisions. Wireless uses Carrier Sense Multiple Access / Collision Avoidance. As we know, 802.3 uses CSMA/Collision Detection. You can compare wireless with a phone call—it is a shared medium and both can talk, but when you both talk, you cannot hear each other. We need to wait before we can talk, to avoid any collisions. This is covered in 802.11 medium contention.
The first step is to check the carrier sense. There are two carrier senses, the physical carrier sense (CCA) and the virtual carrier sense (NAV, in the MAC header). The physical carrier sense is the clear channel assessment (CCA) and happens at layer 1. It has Energy Detection and Carrier Sense (CS). The virtual carrier sense is the Network Allocation Vector (NAV) and happens at layer 2. The NAV timer is based on the RTS/CTS information that tells how long a client wants to transmit. Those two steps are parallel to each other. The CCA checks if the medium is busy on the physical layer, the NAV need to be 0 and is in the MAC header. When both are met (CCA = idle, NAV = 0) the next step is the IFS and at the end the random back off timer. The arbitration flow chart is shown below.
Source: 802.11 Arbitration CWNP white paper
Interframe Spacing
This is after the medium is idle and the NAV timer is 0. The frame, before it wants to transmit, need to wait for time interval. The time interval depends on the sort of frame that need to transmit.
Shortest Inter Frame Space (SIFS)
This is the shortest IFS beside RIFS. SIFS is used for ACK frames, CTS frames, and data frames that immediately follow on a CTS frame.
SIFS for FHSS is 28 microseconds
SIFS for DSSS/HR DSSS/ERP is 10 microseconds
SIFS for OFDM (HT/VHT) is 16 microseconds
Reduced Inter Frame Space (RIFS)
RIFS is only used in 802.11n. RIFS can be used in place of the SIFS in 802.11n. It is only possible in 802.11n networks that don’t support legacy devices (greenfield mode).
Point Coordination Function Interframe Space (PIFS)
When the access point is in Point Coordination Function mode (not implemented) it will use PIFS. PIFS use the SIFS + a slot time. The slot times are listed below.
DSSS/HR DSSS/ERP (long preamble)/HT (long preamble) is 20 microseconds
ERP (short preamble)/HT (short preamble)/OFDM/VHT is 9 microseconds
So, for an OFDM it will be 16 (SIFS) + 9 (slot time) = 25 microseconds.
Distributed Coordination Function Interframe Space (DIFS)
When the access point is in Distributed Coordination Function mode. DIFS will be used with the standard data frames. The formula for DIFS is SIFS + 2 x slot time. The slot times are the same as the slot times for PIFS.
DSSS/HR DSSS/ERP (long preamble)/HT (long preamble) is 20 microseconds
ERP (short preamble)/HT (short preamble)/OFDM/VHT is 9 microseconds
So, for an OFDM it will be 16 (SIFS) + (2 x 9 (slot time)) = 34 microseconds.
Arbitration Inter Frame Space (AIFS)
AIFS is used for all QoS data frames, all the management frames and PS-Poll, RTS, CTS (not in response to an RTS), BlockAckReq and BlockAck.
802.11e (QoS) specifies 4 QoS categories and has its own slot time.
AV_VO (Voice): 2
AV_VI (Video): 2
AV_BE (Best Effort): 3
AV_BK (Background): 7
The formula for the AIFS is: AIFS = (QoS slot time x slot time) + SIFS.
So, for OFDM Best Effort is that (3 (best effort) x 9 (slot time)) + 16 (SIFS) = 43 microseconds
Extended Inter Frame Space (EIFS)
EIFS is used for corrupted frames, based on the Frame Check Sequence. EIFS is the longest IFS that exists and is calculated as follows: EIFS = SIFS + (8 x ACKsize) + Preamble Length + PLCP Header length + DIFS
From short to long, it is RIFS, SIFS, PIFS, DIFS, AIFS, EIFS.
Contention Window (Random back off timer)
After the IFS there will be a generated back off timer that counts down. When the back off timer is 0 the frame can be finally transmitting. The random back off timer is based on the PHY.
DSSS HR is 31
ERP/OFDM is 15