Showing posts with label csma. Show all posts
Showing posts with label csma. Show all posts

Monday, March 7, 2011

Understanding Wi-Fi Carrier Sense

The Importance of Carrier Sense
Carrier Sense (CS) is one of the most integral parts of modern Wi-Fi networks. Fundamentally, Wi-Fi is a multiple access link, which means that it is shared and requires vastly different protocol design and architecture than a point to point circuit (as any Masters graduate student studying computer science could tell you). In addition, random access to the medium is distributed across all stations on the network. Wi-Fi does not pass tokens, reserve the medium with bit-mappings, or use any other control mechanisms dictating which stations have access to transmit.

This distributed nature makes carrier sense (and subsequent medium contention) core components of network operation and efficiency. The practical implications are seen in Wi-Fi engineer's daily work. We perform site surveys, develop non-overlapping 1, 6, 11 channel plans, optimize channel re-use, and perform capacity planning all in the name of performance optimization for a network that runs over an unguided medium with random access distributed between stations. Understanding these principles of design and the protocol operation behind them are important for engineers to adequately and successfully build wireless networks.

The precursors to the IEEE 802.11 and Wi-Fi protocol design were developed in the pure ALOHAnet protocol, slotted ALOHA, and finally Carrier Sense Multiple Access (CSMA) developed for the 802.3 Ethernet specification.

As I've previously written, 802.11 Wi-Fi is based on CSMA/CA, whereas 802.3 Ethernet is based on CSMA/CD. What's the deal, one little letter difference? Well that one little letter represents a significant underlying difference between the two network protocols. What they both have in common is the need to perform Carrier Sense (CS) for medium idle/busy detection on a Multiple Access (MA) network segment (hence the CSMA portion). What differs are how stations determine if the medium is idle (Collision Detection versus Collision Avoidance), and how they are granted access to the medium once it is found to be idle (1-persistent for Ethernet versus p-persistent for Wi-Fi, where "p" indicates the probability of transmission when the medium is found to be idle). This is largely due to the inherent differences of electromagnetic signalling over guided versus unguided media (copper or fiber cabling versus the air). For an overview of collision avoidance and medium contention, see my previous series on Wireless QoS.

Let's review how carrier sense is performed.

Wi-Fi Carrier Sense Overview
Wi-Fi carrier sense is composed of two separate and distinct functions, Clear Channel Assessment (CCA) and the Network Allocation Vector (NAV). From a high level perspective, CCA is physical carrier sense which listens to received energy on the radio interface. NAV is virtual carrier sense which is used by stations to reserve the medium for mandatory frames which must follow the current frame.

It is important to note that CCA is not the same as the NAV. CCA indicates a busy medium for the current frame, whereas NAV reserves the medium as busy for future frames that are required to be transmitted immediately following the current frame.

Clear Channel Assessment
CCA is defined in the IEEE 802.11-2007 standards as part of the Physical Medium Dependant (PMD) and Physical Layer Convergence Protocol (PLCP) layer. For reference, the IEEE layer specifications include PMD, PLCP, MAC/LLC as shown below:

Clear Channel Assessment is composed of two related functions, carrier sense (CS) and energy detection (ED).

Carrier sense refers the ability of the receiver to detect and decode an incoming Wi-Fi signal preamble. In addition, CCA must be reported as BUSY when another Wi-Fi signal preamble is detected, and must be held as BUSY for the length of the received frame as indicated in the frame's PLCP Length field. Typically, any incoming Wi-Fi frame whose PLCP header can be decoded will cause CCA to report the medium as busy for the time required for the frame transmission to complete.

The PLCP header Length field indicates either the number of microseconds required for transmission of the full frame MPDU payload (DSSS), or the number of octects carried in the frame MPDU payload (OFDM) which is then used in combination with the Rate field (which identifies the modulation used for the payload) to determine the time required for MPDU transmission. Either way, the Length or Rate + Length fields give the receiver the information required to de-modulate the frame and determine how long the medium will be busy.

For reference, here is the PLCP frame header format for the DSSS PHY:

Note - for those curious, the PLCP header is always encoded at a fixed data rate so that the receiving stations can decode the information. DSSS PLCP is transmitted at 1 Mbps, DSSS Short Preamble at 2 Mbps, and OFDM at 6 Mbps. Only the frame MPDU payload is encoded at a variable data rate which is specified in the SIGNAL/RATE field.

Energy detection (ED) refers to the ability of the receiver to detect the non-Wi-Fi energy level present on the current channel (frequency range) based on the noise floor, ambient energy, interference sources, and unidentifiable Wi-Fi transmissions that may have been corrupted but can no longer be decoded. Unlike carrier sense which can determine the exact length of time the medium will be busy with the current frame, energy detection must sample the medium every slot time to determine if the energy still exists. In addition, energy detection requires a pre-defined threshold which determines if the reported energy level is adequate to report the medium as busy or idle. This is typically referred to as the ED threshold level or CCA sensitivity level. The ED threshold is usually much lower for valid Wi-Fi signals that can be decoded using carrier sense than it is for non-Wi-Fi signals. For example, the noise ED threshold must be 20 dB greater than the corresponding Wi-Fi signal ED threshold for most PHYs.

For more information on the CCA sensitivity level of each PHY, see the "Further Reading" notes at the end of this post.

As an interesting side note, when evaluating the RF environment with a spectrum analyzer, the ED threshold level value may be implemented differently than Wi-Fi stations. This may cause the spectrum analyzer's duty cycle metric to be out of alignment with how a Wi-Fi station would interpret the same environment. For example the Cisco Spectrum Expert SaGE v2 chipset reports duty cycle as any energy above the noise floor which is typically -92 to -95 dBm, whereas a client adhering to DSSS specifications transmitting at 50mW would only mark the medium as busy based on ED of -76 dBm or greater (per IEEE 802.11-2007 section 15.4.8.4). This difference is worth noting, but in my experience is not cause for significant concern when evaluating an environment for noise or interference.

Network Allocation Vector
In addition to CCA determining the medium idle/busy state for the current frame and noise, the NAV allows stations to indicate the amount of time required for transmission of required frames immediately following the current frame. This is important to reserve the medium as busy for these mandatory frames.

The importance of NAV virtual carrier sense is to ensure medium reservation for frames critical to operation of the 802.11 protocol. Typically these are control frames, but not always. They include 802.11 acknowledgements, subsequent data and acknowledgement frames as part of a fragment burst, and data and acknowledgement frames following an RTS/CTS exchange.

The NAV is carried in the 802.11 MAC header Duration field which is part of the MPDU payload, and is encoded at a variable data rate as discussed previously. Therefore, not all stations within the area may be able to decode the MPDU due to insufficient SNR. However, all stations within the area should still be able to decode the PLCP header used for CCA. Since the critical frames that the NAV protects use shorter inter-frame spacing values (SIFS for example), those frames should still gain access to the medium before any other station attempts to transmit and stations will detect a busy medium through CCA carrier sense. However, the added protection through NAV reservation is lost.

Stations that are able to decode the 802.11 header extract the Duration field value and use it mark the medium as busy for the amount of time specified (in microseconds). Therefore, the transmitter should follow the strict rules defined in the 802.11 specification for calculation of the NAV value to be sent within frames. Stations (including APs) not adhering to the specification could reserve too much time in order to hog the medium, as has been accused of at least one infrastructure vendor in the past. (I won't name names, but they know who they are :)

Note - The NAV timer also accounts for time required for appropriate inter-frame spacing, such as SIFS intervals between data and acknowledgement for example.

Summary and Recap
Every Wi-Fi station must first determine the state of the medium as idle or busy through the process of carrier sense, prior to being allowed to perform pro-active collision avoidance and ultimately transmit a frame. Carrier sense is composed of clear channel assessment and the network allocation vector, which together allow for adequate sensing of the physical environment as well as reserve the medium for frames critical to the operation of the protocol.

If you're like me, you find the physical layer properties of Wi-Fi networks fascinating. These fundamental concepts of carrier sense, CCA, NAV, modulation, encoding and the underlying physical properties of radio frequency propagation form the building blocks for most of the advanced mobile technologies that form our modern civilization. It's exciting to understand these concepts and see real-world examples in front of us everyday that are shaping our culture and our lives.

My intent is to convey my joy of these concepts to you, my readers, and inspire the same passion for Wi-Fi as I have. We are a new generation of RF engineers, not all that different from generations past who invented the telegraph, radio communications, and amateur ham radio operators.

Cheers,
Andrew


A Note on Nomenclature
PHY stands for Physical Layer Specifications.
DSSS stands for Direct Sequence Spread Spectrum, and is used in the original 802.11 PHY at 1 and 2 Mbps.
HR-DSSS stands for High Rate DSSS, and is used in the 802.11b PHY at 5.5 and 11 Mbps.
ERP stands for Extended Rate Physical, and is used with OFDM encoding with 802.11g PHY at 6 - 54 Mbps.
OFDM stands for Orthogonal Frequency Division Multiplexing, and is used in the 802.11a PHY at 6 - 54 Mbps.
HT stands for High Throughput, and is used with OFDM encoding with 802.11n PHY at 6.5 - 600 Mbps.

Further Reading
The following references are worthwhile reading for those looking for more information:

CSMA Persistence - "Computer Networks: Fifth Edition" by Andrew S. Tanenbaum and David J. Wetherall

The following sections in the IEEE 802.11-2007 standard:

PLCP Header Format in DSSS 15.2.2
PLCP Header Format in HR-DSSS 18.2.2
PLCP Header Format in ERP 19.3.2 (Can actually use any of the other 3 formats, depending on the situation)
PLCP Header Format in OFDM 17.3.2
PLCP Header Format in HT 20.3.2 (Found in the 802.11n amendment, not 802.11-2007)

CCA Sensitivity in DSSS 15.4.8.4
CCA Sensitivity in HR-DSSS 18.4.8.4
CCA Sensitivity in ERP 19.3.5
CCA Sensitivity in OFDM 17.3.10.5
CCA Sensitivity in HT 20.3.22.5 (Found in the 802.11n amendment, not 802.11-2007)

NAV 9.2.5.4 through 9.2.5.6, and 9.2.11

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

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