Showing posts with label wmm. Show all posts
Showing posts with label wmm. Show all posts

Thursday, August 5, 2010

Wireless QoS Part 5 - Contention Window and Final Thoughts

Read the Entire Wi-Fi Quality of Service 5-Part Series:
  1. Part 1 - Background Information
  2. Part 2 - IEEE 802.11e Principles
  3. Part 3 - User Priorities, Access Categories and Queues
  4. Part 4 - Arbitration Interframe Spacing
  5. Part 5 - Contention Window and Final Thoughts
Part 5 - Contention Window and Final Thoughts
The third major QoS design change implemented as part of the 802.11e amendment and WMM certification is replacement of the PHY-specific contention window scaling with PHY / QoS Access Category specific values. Just as with AC dependent AIFS values, contention window values are now AC dependent and will provide a statistical advantage for higher priority frames.

The Contention Window

Once the station has waited the appropriate arbitration inter-frame space time, it randomly selects a value for its random backoff timer. The timer value must be within the Contention Window values defined for the priority queue. Each of the 4 priority queues has a defined Contention Window range, initially defined as ranging from 0 to CWmin, where CWmin varies between each of the queues.

Once the appropriate AIFS time has been waited, each station begins decrementing the random backoff timer by one for every slot time that passes. If another station begins transmitting before its timer has reached zero, the station defers access until the medium is available again, at which time it continues decrementing the timer from where it previously left off. Once the timer reaches zero, the station is allowed to transmit the frame over the air.

If a collision occurs where two stations transmit at the same time, no acknowledgment of the frame will be received and the station will increment its retry counter and increase its contention window according to the binary exponential backoff algorithm, up to a maximum contention window size of CWmax. The stations must then wait the appropriate AIFS time, select a new random backoff timer using the new contention window range, and proceed as before.

Similar to AIFS, the differences in the contention window values serve to prioritize traffic in higher priority queues by allowing them to wait shorter time intervals before being allowed to transmit over the air. The CWmin and CWmax values vary based on the PHY and the AC queue in use.

For review, the DCF (non-QoS) contention window values are:

  • 802.11b    aCWmin 31    aCWmax 1023
  • 802.11g    aCWmin 31    aCWmax 1023 (when 802.11b stations are present)
  • 802.11g    aCWmin 15    aCWmax 1023
  • 802.11a    aCWmin 15    aCWmax 1023
  • 802.11n    aCWmin 15    aCWmax 1023

Notice how the contention window range is the same across all OFDM PHYs, with legacy CCK PHY being the only dissimilar value. Traffic prioritization is therefore very coarse, and is based not on application traffic but on the PHY used for transmission. Effectively, all frames in a legacy DCF Basic Service Set (BSS) have the same priority and access to the medium. This can lead to problems, especially for latency sensitive applications such as voice and videoconferencing.

The new EDCA contention window values vary based on the Access Category (AC) and are derived from the DCF base values shown above. These values are administrator configurable, with default values defined as:

  • AC_VO (Voice)       CWmin = (aCWmin+1)/4 – 1   CWmax = (aCWmin+1)/2 – 1
  • AC_VI (Video)       CWmin = (aCWmin+1)/2 – 1   CWmax = aCWmin
  • AC_BE (Best Effort) CWmin = aCWmin             CWmax = aCWmax
  • AC_BK (Background)  CWmin = aCWmin             CWmax = aCWmax
Note – Default values for non-AP QoS stations are defined in IEEE 802.11e amendment section 7.3.2.27 and the current IEEE 802.11-2007 standard section 7.3.2.29.

The default EDCA contention window values for the 802.11b PHY in a QoS BSS are defined as:
  • Voice Queue        CWmin = 7      CWmax = 15
  • Video Queue        CWmin = 15     CWmax = 31
  • Best Effort Queue  CWmin = 31     CWmax = 1023
  • Background Queue   CWmin = 31     CWmax = 1023
The default EDCA contention window values for the 802.11g/a/n PHY in a QoS BSS are defined as:
  • Voice Queue        CWmin = 3      CWmax = 7
  • Video Queue        CWmin = 7      CWmax = 15
  • Best Effort Queue  CWmin = 15     CWmax = 1023
  • Background Queue   CWmin = 15     CWmax = 1023
Notice the differences from legacy DCF contention window ranges. In a QoS BSS, each queue clearly has differentiated access to the medium. For instance frames in the voice queue will initially select a random backoff timer between 0 - 3, versus frames in the video queue which will initially select values between 0 - 7. In this manner, frames in the voice queue have a statistically greater chance of selecting a random timer value that is lower than frames in the video, best effort, and background queues. It is still possible that a frame from a lower priority queue will select a lower random backoff timer, but most of the time they will not. 

Also, notice how the maximum contention window range for voice and video are still relatively small compared to the other queues. On a heavily utilized network, as retransmission attempts increase, the statistical advantage for voice and video frames gets even better. 

The CWmin and CWmax values are encoded in exponent form, base 2, then decremented by 1 in the EDCA Parameter Set information element, and each field is 4 bits long. Therefore, the minimum contention window values is 0 and the maximum value is 32,767. However, in practice the typical maximum value is never set above 1,023.

Contention Window Scaling
Contention window scaling between CWmin and CWmax is easier to understand when illustrated. For the first transmission attempt, the random backoff timer is set to a value between 0 – CWmin. Only when a retransmission is required due to the lack of a returned frame acknowledgement will the possible range grow. For the first and each subsequent retransmission attempt, the contention window will double by a power of 2. This is called binary exponential backoff. Once the window grows to CWmax, it will grow no further. Subsequent retransmission attempts will use the largest contention window range when selecting a random backoff timer value until the frame is either successfully transmitted (and acknowledged) or the maximum number of retransmission attempts is reached (typically somewhere between 7 and 64 attempts; Cisco APs default to 64 attempts for example).

As an interesting side note, when optimizing networks for VoWLAN, many vendors have a feature to quickly age out latency-sensitive voice frames after fewer retransmission attempts. This is done because a voice packet that is delayed too long will be useless to the receiver since it cannot insert it back into the voice stream if it processed and sent the analog stream to the human recipient past the point where the frame was delayed. On Cisco equipment, this feature is called Low Latency MAC, it applies only to voice frames in the Voice Access Category, and it only attempts 3 retransmissions for voice frames before dropping them.


(Figure 2-5 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-7, by Cisco Systems)

Putting it all Together
Therefore, the design of priority schemes for IEEE 802.11 wireless networks are dictated by the definition 8 user priorities mapped to 4 access categories, 4 priority queues, Arbitrated Inter-Frame Spacing (AIFS) values for each queue, and Contention Window values for each queue. Higher priority traffic waits less time statistically before being allowed to transmit a frame over the network. 

Since wireless is shared medium, and medium contention is distributed among all clients under DCF and EDCA, higher priority traffic cannot be guaranteed to be able to transmit before lower priority traffic from other stations, or even internally within a station between its internal queues. 802.11e and WMM only provide for a statistical advantage for higher priority traffic. On average, higher priority frames will wait less time prior to transmission and have greater access to the medium than will lower priority frames. In a shared medium, there is no such thing as a guarantee!

The IEEE 802.11e AIFS and CWmin values are illustrated in the following figure, based on the 802.11b PHY.


(Figure 2-8 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-10, by Cisco Systems)

External Resources
Be sure to check out these additional references for more information on 802.11 arbitration (medium contention), 802.11e, and WMM:


There are many other features in the 802.11e and WMM certification relating to QoS, such as Transmit Opportunities (TXOP), (Un)Scheduled Automatic Power Save Delivery (APSD), WMM Power Save, etc.

As a wireless network administrator / engineer / architect / consultant, understanding the fundamentals of 802.11 wireless network medium arbitration and frame prioritization is essential to planning, designing, implementing, and supporting a production network. Wi-Fi networks are mission-critical for many organizations these days, and skilled wireless IT staff is typically hard to find. Arm yourself with the knowledge and skills and you'll be sure to find success following you!

-Andrew

Wednesday, August 4, 2010

Wireless QoS Part 4 - Arbitration Interframe Spacing

Read the Entire Wi-Fi Quality of Service 5-Part Series:
  1. Part 1 - Background Information
  2. Part 2 - IEEE 802.11e Principles
  3. Part 3 - User Priorities, Access Categories and Queues
  4. Part 4 - Arbitration Interframe Spacing
  5. Part 5 - Contention Window and Final Thoughts
Part 4 - Arbitration Interframe Spacing
The second QoS design change implemented as part of the 802.11e amendment and WMM certification is replacement of the one-size-fits all Distributed Inter-Frame Spacing (DIFS) for all data and management frames, with Arbitration Inter-Frame Spacing (AIFS) which is dependent on the access category and queue of the frame waiting transmission.


Arbitration Inter-Frame Spacing (AIFS) defines different inter-frame gaps for traffic from each of the 4 priority queues. This replaces the original DCF Inter-Frame Spacing (DIFS) which defined only a single inter-frame gap value for all data frames. Using AIFS, each frame awaiting transmission must wait until the medium is declared to be available through Clear Channel Assessment (CCA) and the Network Allocation Vector (NAV), not discussed here for brevity. Once the medium is available, each logical station (one for each priority queue) must wait the defined inter-frame space time based on the queue to which the traffic is assigned.

Each of the 4 priority queues has a defined inter-frame space value corresponding to the priority assigned to the queue. For example, the Voice queue is the highest priority and as such has the lowest inter-frame space timer. The AIFS timers assigned by IEEE 802.11e are all defined as 1 Short Inter-Frame Spacing (SIFS) value plus a variable number of slots times (AIFSN) which are defined by the physical layer encoding method in-use (CCK, DSSS, OFDM).

The AIFS Number (AIFSN) values are administrator configurable, with default values defined as the following:
  • Voice Queue                 1 SIFS + 2 * slot time (AIFSN = 2)
  • Video Queue                 1 SIFS + 2 * slot time (AIFSN = 2)
  • Best Effort Queue          1 SIFS + 3 * slot time (AIFSN = 3)
  • Background Queue        1 SIFS + 7 * slot time (AIFSN = 7)
Note – Default values for non-AP QoS stations are defined in IEEE 802.11e amendment section 7.3.2.27 and the current IEEE 802.11-2007 standard section 7.3.2.29.

Therefore, the default AIFS values for each PHY are as follows:


Note – 802.11g and 802.11n when operating in the 2.4 GHz spectrum use long slot times when legacy 802.11b is present, and use the short slot times when no legacy stations are present. This is done for backwards compatibility.

Here is an illustration of AIFS in action, with [X] representing sample User Priorities for differentiated inter-frame spacing between access categories. Clearly, frames with UP = 0 (AC_BE) will wait a longer IFS than frames with UP = 6 (AC_VO), thereby prioritizing voice AC traffic.


(Figure 2-9 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-11, by Cisco Systems)

The AIFSN field within the EDCA Parameter Set information element is 4 bits long, with a minimum value of 2 defined in the standard and a maximum value of 15 based on the field length limitation.

In this manner, arbitration inter-frame spacing allows a statistical advantage for traffic in higher priority queues because those frames are not required to wait as long prior to decrementing their random backoff timers.

We're almost, but not quite, finished with the technical details of wireless QoS. In my final post, I'll detail enhancements to the contention window value selection, which determines the random backoff range used by stations prior to transmitting. I'll also wrap it all up together in a nice bow, and provide a few very useful external links for further reading.

-Andrew

Monday, August 2, 2010

Wireless QoS Part 3 - User Priorities, Access Categories, and Queues

Read the Entire Wi-Fi Quality of Service 5-Part Series:
  1. Part 1 - Background Information
  2. Part 2 - IEEE 802.11e Principles
  3. Part 3 - User Priorities, Access Categories and Queues
  4. Part 4 - Arbitration Interframe Spacing
  5. Part 5 - Contention Window and Final Thoughts
Part 3 - User Priorities, Access Categories and Queues
The first QoS design change implemented as part of the 802.11e amendment and WMM certification, are User Priorities, Access Categories, and Queuing Structures.


The IEEE 802.11e amendment defines 8 user priorities (UP) for class of service (CoS) definition. These user priorities were established for layer 2 data link frame prioritization in alignment with earlier CoS standards including 802.1D (based on the work within the 802.1p task group).


These 8 user priorities are grouped into 4 access categories, containing two user priorities each. User priority 0 is placed into the Best Effort AC instead of the Background AC for backwards compatibility with non-QoS stations. This was done to preserve compatibility, as the IEEE deemed QoS functionality as an optional component for certification citing the lack of need for QoS by many legacy devices and applications. The mapping between 802.1D, 802.11e UP, and Access Category is show below.




(Table 9-1 courtesy of the IEEE Std. 802.11-2007 section 9.1.3.1 on page 253)

As an example implementation, the relationship between User Priority, Access Category, and Cisco’s AVVID architecture standard (which provides different guidelines for voice and video than the IEEE standards) is detailed in the table below. Also referenced are the default markings applied by the Cisco Unified wireless network.



(Table 10-6 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 10-33, by Cisco Systems)


Queuing Structure
4 priority queues are established to prioritize data frames within each station. These 4 priority queues align with the 4 access categories mentioned previously. Each frame that a station wishes to transmit is classified and placed into one of the appropriate queues.

The inter-frame spacing and random backoff timers are calculated independently and decremented in parallel for each queue. If an internal collision occurs, whereby frames from two or more queues are ready to transmit at the same time, the higher priority queue is granted access to transmit and the other queues act as if a physical collision occurred during transmission, increment their retry counter, and increase their contention window values according to binary exponential backoff. In this manner, one physical station emulates four logical stations, one for each traffic queue. The following figure illustrates these priority queues.




(Figure 2-7 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-10, by Cisco Systems)


Through user priorities, access categories, and queuing structures, the 802.11e amendment and WMM certification provides differentiated classification of frames and the framework for frame prioritization. In the next two posts, I'll describe how frame prioritization occurs through Adaptive Inter-Frame Spacing and Contention Window scaling.


-Andrew

Wireless QoS Part 2 - IEEE 802.11e Principles

Read the Entire Wi-Fi Quality of Service 5-Part Series:
  1. Part 1 - Background Information
  2. Part 2 - IEEE 802.11e Principles
  3. Part 3 - User Priorities, Access Categories and Queues
  4. Part 4 - Arbitration Interframe Spacing
  5. Part 5 - Contention Window and Final Thoughts
Part 2 - IEEE 802.11e Principles
Now, let's dig into the guiding principles behind wireless QoS design and the 802.11e amendment. This is part 2 of this series on wireless QoS, building on the background information from the first post in this series, which described the original Distributed Coordination Function (DCF) 802.11 medium contention protocol.


802.11e and WMM QoS Overview

The amended IEEE 802.11 wireless protocol supports a priority scheme that can provide up to 8 priority classes for traffic. This work was done as part of the IEEE 802.11e working group and was added as an amendment to the standard. Certifications of compliance with portions of this amendment are done by the WiFi Alliance through the WiFi Multimedia (WMM) certification process.

802.11e defines 8 user priorities for Quality of Service (QoS) of wireless traffic. These 8 user priorities are grouped into 4 Access Categories (AC) defined as Voice, Video, Best Effort, and Background. Each access category contains 2 different user priorities.

The design of this priority scheme is based on three major changes to the operation of the original 802.11 Distributed Coordination Function (DCF), which is now called Enhanced Distributed Coordination Access (EDCA). The three major changes are:

  1. Establishment of 4 priority queues for traffic (Access Categories), implemented on a per-station basis

  2. Arbitrated Inter-Frame Spacing (AIFS) values for each of the 4 priority queues to replace the single Distributed Coordination Inter-Frame Spacing (DIFS) value previously used for all data and management frames

  3. Random Backoff timers defining Contention Window minimum (CWmin) and maximum (CWmax) values for each of the 4 priority queues

Further information on WMM certification can be found the Wi-Fi Alliance website. In addition, the IEEE 802.11e amendment and current 802.11-2007 standard can be found on the IEEE website.


In future posts, I'll detail each of these design changes and how they're implemented. We'll also see why wireless QoS provides a statistical advantage for higher priority traffic, but cannot go so far as to perform or guarantee strict priority queuing due to the use of a shared medium and distributed contention among multiple stations. This is a fundamental difference for those familiar with QoS on wired switches, which have the ability to implement strict priority-queues over a contention-free full-duplex link.


-Andrew

Wednesday, July 28, 2010

Wireless QoS Part 1 - Background Information

Read the Entire Wi-Fi Quality of Service 5-Part Series:
  1. Part 1 - Background Information
  2. Part 2 - IEEE 802.11e Principles
  3. Part 3 - User Priorities, Access Categories and Queues
  4. Part 4 - Arbitration Interframe Spacing
  5. Part 5 - Contention Window and Final Thoughts
Part 1 - Background Information
Prior to the 802.11e amendment, legacy 802.11 wireless network operated under the Distributed Coordinate Function (DCF). DCF is built on the CSMA/CA medium contention protocol to regulate access to a shared medium, wireless airtime. On multiple access networks, a method is required to determine an orderly method for stations to determine whose turn it is to transmit a frame, how to avoid collisions, how to detect collisions, and how to gracefully recover from failed transmissions due to collisions or other errors such as interference. The CSMA/CA protocol fills this need.

The basic principles of CSMA/CA are:
  1. Carrier Sense to detect incoming transmissions
  2. Clear Channel Assessment (CCA) and Network Allocation Vector (NAV) to determine if the medium is idle and it is acceptable for the station to transmit a frame
  3. Positive acknowledgement of frames to pro-actively avoid collisions since wireless receivers cannot passively determine if a collision has occurred as the RF energy is dispersed. This is in contrast to wired Ethernet’s use of CSMA/CD and collision detection where the receiver is able to detect collisions since the energy is reflected through the wire back to the transmitter.
802.11 networks are further built upon two principles to regulate access to the medium:
  1. Inter-frame Spacing (IFS)
  2. Random Backoff Contention Window
First, inter-frame spacing establishes baseline intervals that certain types of frames are required to wait prior to being able to transmit. These basic IFS values serve as a coarse method of frame prioritization. However, this prioritization is not based on the application priority but rather on frame priority for basic functionality within the 802.11 protocol. Three IFS values are defined in a non-QoS legacy 802.11 basic service set:
  1. Short Inter-frame Space (SIFS) is used for frames that need to immediately follow the preceding frame, generally for control purposes. Examples include control frames that are required to positively acknowledge receipt of an immediately pre-ceding frame (ACK), to reserve the medium when an explicit request to send (RTS) has been sent by a station and are responded to with a clear-to-send frame (CTS) frame, data frames immediately following a CTS, and the second or greater fragment of a fragmented frame.

  2. Point-Coordinated Inter-frame Space (PIFS) is used when the BSS is placed into a contention-free period by the access point. This mode of operation uses the AP as a point coordinator to poll capable stations for data frames, rather than let stations contend for access in a distributed fashion. This IFS is dependent on the Point-Coordinated Function (PCF) of the standard being implemented by both the AP and stations. To date, no product implements PCF, so this IFS remains un-used in the marketplace.

  3. Distributed-Coordinated Inter-Frame Space (DIFS) is used when the BSS is operating in DCF mode, where stations contend with one another for access to the medium using the CSMA/CA protocol. DIFS is used for all frames for which SIFS is not applicable, typically data and management frames.
All IFS values are dependent on the physical layer (PHY) implementation. DIFS values are defined with the formula: 1 x SIFS + (2 x Slot Time). The SIFS and DIFS values are as follows:



Note – 802.11g and 802.11n values are specified for both legacy interoperability with 802.11b (long) and greenfield operation (short) in the 2.4 GHz frequency band.




(Figure 2-3 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-5, by Cisco Systems)

Second, the random backoff contention window further specifies how long a station must continue to wait if attempting to transmit a frame after detecting a busy medium. If the medium was busy when the station deferred access and queued a frame for transmission, there is a high likelihood that other stations also deferred access and have frames to transmit as well. Without a random backoff timer, multiple stations would then attempt to transmit frames at the exact same time, leading to a very high probability of collisions and degradation in network performance. The deferral of access due a busy medium serves to align the transmission of subsequent frames and increases the probability of collisions on the network.

By implementing a random backoff contention window on a per-station basis, frame transmissions are no longer aligned in most instances and allow for proper access by only one station to reserve the medium and transmit a frame; all other stations will recognize the beginning of a new transmission and pause their backoff timers and defer access to the new transmission. Additionally, should a collision still occur if two stations pick the same random backoff timer and no positive acknowledgment of the transmitted frame is received, the stations will increase the contention window range allowing for more possible random values to be selected and decrease the likelihood of subsequent collisions.

The contention window ranges from zero up to CWmin initially, with the potential to grow and range from zero to CWmax. Each subsequent collision (detected through a lack of acknowledgment in return) results in the station doubling the contention window size, up to the maximum value. Contention window values are decremented by one for every slot time that passes without detecting another station transmitting.

The DCF (non-QoS) contention window values are:
  • 802.11b – aCWmin 31, aCWmax 1023
  • 802.11g – aCWmin 31, aCWmax 1023 (when 802.11b stations are present)
  • 802.11g – aCWmin 15, aCWmax 1023
  • 802.11a – aCWmin 15, aCWmax 1023
  • 802.11n – aCWmin 15, aCWmax 1023


(Figure 2-4 courtesy of “Voice over Wireless LAN 4.1 Design Guide” page 2-6, by Cisco Systems)

So to recap:
  • DCF defines a distributed coordination function whereby all stations contend for access to the medium.
  • DCF is governed by the underlying CSMA/CA protocol which requires positive acknowledgment of frames and pro-active collision avoidance.
  • Each station defers access to the medium if busy.
  • Once the medium is determined to be idle through both CCA and NAV:
    • The station waits the appropriate inter-frame space (IFS) value based on the type of frame being sent.
    • If the medium was idle prior to the frame being queued, the random backoff timer is skipped.
    • If the medium was busy prior to the frame being queued, a random backoff value is selected in the range of 0 to CWmin (for the first transmission attempt), possibly up to 0 to CWmax (after multiple collisions).
      • The random backoff value is decremented by one for every slot time that passes without detecting another station transmitting.
      • Each slot time that passes, the stations checks CCA and NAV to determine if the medium is still idle, or if it is now busy with a transmission from another station.
      • If another station does begin transmitting, the backoff timer is paused until the end of transmission, the appropriate IFS value is waited, then the backoff timer resumes countdown from where it left off.
      • The random backoff timer expires (countdown to zero).
    • The station transmits the queued frame.
In subsequent posts, I will detail what changes are made as part of the 802.11e amendment to implement Quality of Service (QoS) over wireless networks.

- Andrew