Details on CWmin and CWmax (Contention Window Minimum and Maximum)
CW = Contention Window. CWmin and CWmax mean Minimum Contention Window and Maximum Contention Windows. Let’s understand where we need these two parameters.
If you have already gone through the CSMA/CA post then it will be easy to understand where these are used. In CSMA/CA flow chart there is one step
=> “Select a random backoff value if one is not chosen already”.
This random backoff value is chosen from the defined CWmina and CWmax value for device.
♣ CWmin and CWmax table:
PHY | CWmin | CWmax |
802.11b | 31 | 1023 |
802.11g | 15 or 31 | 1023 |
802.11a | 15 | 1023 |
802.11n | 15 | 1023 |
802.11ac | 15 | 1023 |
♣ Example to understand easily:
Let’s say one device (802.11a supported) wants to send a frame.
According to the table,
CWmin=15 and Cwmax is 1023.
♦ 1st attempt: This device has option to select a random value form
0 – 15 and following CSMA/CA rule the selected random value will be decremented for each slot time [As long as Wireless Medium is free].
♦ 2nd attempt: If the 1st attempt is failed then this device has below CW range.
0 – 31. Why ☻?
Each time a device is failed to transmit any frame the CW window will be increased exponentially keeping the CWmax constant. As the device failed on 1st attempt so the new CW range for choosing random backoff number is 0-31.
For any further failure the CW range will be
0-63
0-127
0-255
0-511
0-1023(CWmax)
♠ Note: Minimal value of CW is 0 but Maximum value of CW at any particular time always varies.
♣ When device stops transmitting a frame if there is contentious (nth attempt) failure?
In simple there below conditions:
♦ CWmax is reached as CW range. This means when device gets the CW range as 0-CWmax.
♦ Maximum retry count is reached for a particular frame.
♣ Understand exponential behavior:
We generally use ECWmin and ECWmax for representing “exponential CWmin” and “exponential CWmax”.
PHY | CWmin | CWmax | ECW Min | ECW Max |
802.11b | 31 | 1023 | 5 | 10 |
802.11g | 15(bg) or 31 (g) | 1023 | 4 or 5 | 10 |
802.11a | 15 | 1023 | 4 | 10 |
802.11n | 15 | 1023 | 4 | 10 |
802.11ac | 15 | 1023 | 4 | 10 |
Let’s understand 802.11b row: 25-1=31, 210-1=1023
The CW range for 1st attempt for 802.11b is: 0-31
The CW range for 2nd attempt for 802.11b is: 0-(26-1) = 0-63
The CW range for 3rd attempt for 802.11b is: 0-(27-1) = 0-127
Following this we can do the calculation for others easily.
♣ Where do we see CWmin, CWmax values in sniffer capture?
In Beacon or Probe Response we can see this value under WMM field.
♣ CWmin and CWmax values for WMM ACs:
Let’s assume CWmin = 15 and CWmax = 1023 for below table.
AC | AIFSN | CWmin | CWmax |
BK | 7 | CWmin=15 | CWmax=1023 |
BE | 3 | CWmin=15 | CWmax=1023 |
VI | 2 | (CWmin+1)/2 – 1 =7 | CWmin=15 |
VO | 2 | (CWmin+1)/4 – 1 =3 | (CWmin+1)/2 – 1 =7 |
Here is screenshot for above values advertised in Beacon.
In another way:
Initial CW range for
BK: 0-15
BE: 0-15
VI: 0-7
VO: 0-3
With above configurations we can easily understand how VO,VI are given highest priority for transmitting frames.
♣ Conclusion:
From above article we understand where CWmin and CWmax are used and what the importance of these values are.
♥♥ If you have any doubts or query please let me know in comment section or send mail at feedback@wifisharks.com. ♥♥
Siva
Even when sending management frames and control frames also will there be a contention for a window?
Bamdeb
Yes.
Anshul Bhargava
Hi Bamdeb..
Thanks for Explaining , i have one query ,we calculate random back of time with the help of cwmin & max that is present in the WMM field , when there is no WMM IE then how we get this random backoff time?
Bamdeb
From “https://wifisharks.com/2021/02/13/cwmin-cwmax/” and as per “CWmin and Cwmax table ” CWmin and CWmax values are fixed for any particular PHY [11a, 11ac, 11n etc]. So if WMM IE is not there then the default values will be used as per table. Another way , when there is no WMM IE, there is no other AC than BE.