Pages

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

3 comments:

  1. Hi Andrew,
    In recap you mentioned that,
    "If the medium was idle prior to the frame being queued, the random backoff timer is skipped."

    I was wondering when this situation is hit. I think we trigger the CCA function only if we have some frame in TX queue. Please correct me if I am wrong

    -Thanks
    Jeevan

    ReplyDelete
    Replies
    1. Hi Jeevan,
      The contention window (random backoff timer) can be skipped only when the transmitter determines through CCA (both physical and virtual NAV) that the medium is idle for a period of time equal to or greater than one InterFrame Space (DIFS, or AIFS when WMM is in-use) immediately prior to when a frame has been queued for transmission. If the frame gets queued and the medium is busy and the transmitter has to wait, then the contention window must be used. For more information refer to 802.11-2012 section 9.2.2 and Figure 9-3.

      The benefit of skipping the contention window is that if the network is relatively idle, then a bit of overhead can be cut out of the process without too much risk of causing collisions. But as the network gets busier, the contention window helps to randomly space out the transmissions so they don't cause collisions (because the busy medium from a prior frame transmission serves to align all other transmitters who are waiting for their turn).

      Cheers,
      Andrew

      Delete
    2. Its clear now,, Thanks for the reference Andrew.

      -Jeevan

      Delete