Sunday, December 15, 2013

802.11e (Quality of Service) : EDCA

Have you ever visited a famous temple in India? In many temples, there are different "queues" based on the ticket price. If you buy a more expensive ticket, it is most "likely" that your queue will move faster compared to the less expensive one.

802.11e provides a similar facility for different types of user data in a WLAN. The different types of user data are: Voice, Video, Best Effort and Background. 802.11e defines Hybrid Coordination Function (HCF), that includes two new channel access methods:
  • HCF Controlled Channel Access (HCCA). This is based on PCF and like PCF, is not used in real-world implementations.
  • Enhanced Distributed Channel Access (EDCA). This is based on DCF and is a mandatory feature for WMM certification.

Channel Access in DCF

As EDCA is based on DCF, lets first understand how DCF works.
802.11 works on the principles of "carrier sensing" and "collision avoidance". Carrier sensing is achieved through Clear Channel Assessment(CCA) and/or Network Allocation Vector (NAV).

Collision avoidance is achieved using a back-off procedure. The channel access procedure in DCF is depicted in the below diagram.

Channel Access in DCF
The above diagram considers an example in which two stations have data to transmit.

  1. "BUSY":  The stations initially find the medium to be busy (some other station already transmitting). The stations find this either through CCA or NAV.
  2. "DIFS Wait": After the channel is found to be free, both stations need to wait for a fixed duration of DIFS (DCF Interframe Space).   
    • DIFS = SIFS + 2*slot_time
      • slot_time = 9 (OFDM), 16 (DSSS) micro seconds
  3. "Contention": The stations now contend for the medium using random wait.
    • 0 <= Random Wait <= Contention Window (CW)
    • CWMin <= CW <= CWMax
      • CW = 2^x - 1  where x = (4,31)(for OFDM)
      • CWMin = 2^4 - 1 = 15
      • CWMax = 2^31 - 1 = 1023  
  4. "Data": STA1 uses a lower random wait and wins the medium
  5. "SIFS", "ACK": After the data frame is transmitted, the AP waits for SIFS (< DIFS) before sending an ACK.
    • SIFS = 10 (2.4 GHz) or 16 (5 GHz)  micro seconds
  6. Both stations need to contend for the medium after the "ACK" (i.e., start from "Step 2: DIFS wait").

Channel Access in EDCA

EDCA improves on DCF by changing the IFS, Contention Window and the Contention free period based on the "Access Class" of the data. 

EDCA IFS

EDCA uses two Interframe Spaces: SIFS (Same as the one used in DCF) and AIFS. AIFS is similar to DIFS but it varies based on the type of data.
  • AIFS = SIFS + AIFSN * slot_time
  • AIFS Voice, AIFS Video = DIFS 
    • SIFS + 2 * slot_time
  • AIFS Best Effort
    • SIFS + 3 * slot_time
  • AIFS Background
    • SIFS + 7 * slot_time
EDCA Contention Window
The maximum and minimum values of contention window values are dependent on the type of data. The values of CWMin and CWMax are shown below (in slots). Please note that Contention Window is equal to  2^x - 1. The minimum and maximum values are derived from minimum and maximum values of x. x is incremented whenever a transmission failure is detected (e.g., No ACK is received).

CWMin CWMax
DCF
15 
(OFDM) 
(x = 4)
1023
(x = 10)
EDCA VO
3
(x = 2)
7
(x = 3)
EDCA VI
7
(x = 3)
15
(x = 4)
EDCA BE
15
(x = 4)
1023
(x = 31)
EDCA BK
15
(x = 4)
1023
(x = 10)

The effect of AIFS and modified CWMin values can be seen in the below figure.


As a result of the modified wait period, Voice traffic has the highest "probability" of accessing the medium. Video comes next followed by Non-QoS (DCF), Best Effort and Background.

EDCA Contention Free Period (TXOP)
Contention free period can be defined as the duration during which a station can send or receive data without contending for the medium. For e.g., in case of DCF, the contention free period starts with "DATA" and ends after receiving an "ACK". So the contention free period is effectively for one frame. EDCA allows this to be more than one frame and is called a TXOP (Transmission Opportunity).

The TXOP limits are set by the QoS AP. TXOP limit is described in terms on number of 32 micro second intervals.

Typical values for TXOP limits for OFDM (a/g/n) are

  • Voice: 47 (47 *32 =  1504 micro seconds)
  • Video: 94 (94 * 32 = 3008 micro seconds)
  • Best Effort, Background: 0 (Only one frame at a time and then contend again for the medium)

EDCA parameters advertised by the QoS AP

The below snippet from an air-trace shows the EDCA parameters from WMM information element in the beacon of a QoS AP. Note: ECWmin/ECWmax is "x" describe earlier (CW = 2^x -1).


8 comments: