The Ethernet network may be used to provide shared access to a radio channel using the Medium Access Control (MAC)Because the Wi-Fi radio channel is a shared medium, each node contends to use the frequency channel that it is assigned. The simplest method resembles contention-based cable networks using CSMA/CD, with one important distinction: It can be impossible in some scenarios for a pair of contending wireless senders to observe a collision event. This happens for instance when the two sending nodes are at opposite extreme of coverage of a wireless access point: Although they share the same medium, one node is hidden from another.
The IEEE Ethernet working group solved this challenge by enhancing CSMA/CD to emulate the collision detection for a wireless medium, forming Carrier Sense Multiple Access/Collision Avoidance (CSMA/CA). The original CSMA/CA mechanism used in IEEE 802.11 was the Distributed Coordination Function (DCF). This seeks to provide equal access for all nodes shariung the same network. DCF is a timer-based system that uses three key sets of timers, the slot time, inter-frame space, and the contention window.
As in CSMA/CD, the slot time is the basic unit of time measure for both DCF. This value is different in the different generations of the IEEE 802.11 standards. IEEE.802.11-2016 specifies a slot time of 20 us for legacy implementations (such as IEEE 802.11b operating at 1, 2, 5.5 and 11 Mbps), while more recent specifications (including IEEE 802.11g, 80.11a, 802.11n and 802.11ac, supporting rates from 500 Mbps to over 1 Gbps) define a shorter slot time of 9 micosecs.Interframe Space
The time interval between frames transmitted is called the Interframe Space (IFS). Two values of IFS are defined in IEEE.802.11-2016: The Short Interframe Space (SIFS) and the DCF Interframe Space (DIFS).
The SIFS interval is the duration of time allowed for a wireless interface to process the received RF signal and its associated frame, and to generate a response frame. The SIFS for IEEE 802.11a, 802.11n and 802.11ac (at 5 GHz) is 16.
The DIFS interval is calculated as: DIFS = SIFS + (2 * Slot time)
A node is required to sense the activity of the wireless medium before transmitting (listen before talk). If it finds that the medium is continuously idle for the duration of a DIFS period, the node is then permitted to start transmission of a frame (after also waiting for an additional random backoff interval). The random backoff waiting time is introduced to avoid synchronisation in this decentralised system. The range of the generated random backoff timer is bounded by the Contention Window. If the channel becomes busy during the DIFS interval, the node is required to defer its transmission until the medium is again found idle for the duration of a DIFS interval.Contention Window
The Contention Window bounds the range of the generated random backoff timer. The initial range is set between 0 and the Contention Window minimum value (CWmin). The CWmin for DCF (in 5 GHz) is specified as 15 slot times (IEEE.802.11-2016).
It is possible that two (or more) nodes happen to (randomly) choose the same value. If this happens, a collision may occur. At this point, the node effectively restarts the algorithm, waiting for the DIFS interval and then selecting a new random backoff value. However, a key difference is that for this subsequent attempt, the Contention Window approximatively doubles in size (exponentially increasing the range of the random value, as in CSMA/CD). Further collisions cause the algorithm to continue to expand the backoff period, until the node reaches the maximum Contention Window size (CWmax). The CWmax for DCF is specified as 1023 slot times, after which the random backoff is not further expanded, but the algorithm may continue to retransmit.
A side effect is that a loaded WiFi access point (with many nodes trying to send at the same time), can result in significant numbers of retransmissions - each failed retransmission adds further delay resulting in jitter for the transmission (and some waste in network capacity due to collisions).
A wireless network can provide QoS support at the link layer, by enabling the Hybrid Coordination Function (HCF) specified in IEEE 802.11.User Priority (UP)
HCF introduce a QoS Control field of size 3 bits, called the User Priority (UP) bits. This supports 2^8 different code points, numbered 0-7. A node that has traffic to send therefore can select an appropriate UP depending upon the relative importance of the data it is trying to send. In practice, this needs to be determined either by reading the DSCP value in each IP packet and mapping it to a corresponding UP, or by a local policy map configured in the equipment.
A set of Access Categories (AC) are also defined, that can provide differentiated treatment over the wireless network.
The 8 UP code points are typically mapped to 4 access categories:
Higher priority access classes use smaller timer values, letting them first claim the network capacity. The fixed amount of time a node waits to access the medium (network capacity) depends on the access category and is referred to as an Arbitration Interframe Space (AIFS), defined in slot times. The relative size of the Contention Window (CW) also depends on Access Category, so that a AC_VO access backs off less than an AC_VI, etc - with AC_BK and AC_BE each backing off the largest amounts. This means that when there are collisions in the medium, any nodes using the AC_VO access category will still retransmit before any nodes trying to use the AC_BE access category.
IEEE 802.11u includes, among other enhancements, a mechanism by which wireless access points can communicate a control frame that indicates the DSCP to/from UP mappings that have been configured on the wired IP network.
MAC frame header and Ethernet Receive Algorithm
Ethernet Hubs and Repeaters (Collision Domains)