It's All a Matter of Timing
The most basic portion of the MAC layer is the ability to sense a quiet time on the network and then choose to transmit. Once the host has determined that the medium has been idle for a minimum time period, known as DIFS (DCF [Distributed Coordination Function] Inter-Frame Spacing), it may transmit a packet. If the medium is busy, the node must wait for a time equal to DIFS, plus a random number of slot times. The time between the end of the DIFS period and the beginning of the next frame is known as the contention window.
Each station listens to the network, and the first station to finish its allocated number of slot times begins transmitting. If any other station hears the first station talk, it stops counting down its back-off timer. When the network is idle again, it resumes the countdown. In addition to the basic back-off algorithm, 802.11 adds a back-off timer that ensures fairness. Each node starts a random back-off timer when waiting for the contention window. This timer ticks down to zero while waiting in the contention window. Each node gets a new random timer when it wants to transmit. This timer isn't reset until the node has transmitted (see "Contention Window" graphic).
Clear To Send?
In "The Hidden-Node Problem" illustration below, workstations A, B and C can all see wireless access point P. Workstations A and B can see one another, and B and C can see one another, but A can't see C. This happens often in real-world wireless environments, where walls and other structures create obscure radio coverage areas.
To handle this situation, an RTS/CTS (request to send/clear to send) is specified as an optional feature of the IEEE 802.11b standard. RTS/CTS solves the hidden-node problem in the following fashion:
When node A wants to transmit some data to node B, it first sends an RTS packet. The RTS packet includes the receiver of the data transmission ensuing and the duration of the whole transmission, including the ACK related to it. Node B hears this request (as do nodes D and E). Node A must use the standard transmission method to obtain access to send the RTS packet. Once the packet is received by the receiving host, that host replies with a CTS message that includes the same duration of the session about to happen. When node B replies with this CTS message, node C (and F and G) hears this response and is made aware of the potential collision, and will hold its data for the appropriate amount of time, preventing a collision. If every node on the network is using RTS/CTS, collisions are guaranteed to occur only while in the contention window. Access points also participate in the RTS/CTS process when necessary.
RTS/CTS adds significant overhead to the wireless 802.11 protocol, especially at small packet sizes. If used, RTS/CTS thresholds must be set on both the access point and the client side.
Power Saving and DTIMs
By default, wireless LANs use CAM (Constant Access Mode) to constantly listen to the network and get the data they need. When power utilization is an issue, however, the workstations and access points can be configured for PAM (Polled Access Mode). With this, the clients on the network wake up on a regular period and listen for a special packet called a TIM (traffic information map) from the access point. In between TIMs, the client shuts off its radio and thus conserves power. All the devices on the network share the same wake-up period, as they must all wake up at exactly the same time to hear the TIM from the access point.
The TIM informs certain clients that they have data waiting at the access point. A client card stays awake when the TIM indicates it has messages buffered at the access point until those messages are transferred, and then the card goes to sleep again. The access point buffers the data for each card until it receives a poll request from the destination station. Once the data is exchanged, the station goes back into power-saving mode until the next TIM is transmitted. In our lab tests, we've found that PAM mode can save power by as much as 1,000 percent, depending on the volume of traffic on your network.
The access point indicates the presence of broadcast traffic with a DTIM (delivery traffic information map) packet. The DTIM timer is always a multiple of the TIM timer and is often adjustable at the access point. Setting this value high cuts down on the amount of time the station must stay awake checking for broadcast traffic. However, a higher DTIM timer means that the radio will stay on longer to receive DTIM traffic when it does come up in the time cycle.
Roaming
In a typical environment, two or more access points will provide signals to a single client. The client is responsible for choosing the most appropriate access point based on the signal strength, network utilization and other factors. When a station determines the existing signal is poor, it begins scanning for another access point. This can be done by passively listening or by actively probing each channel and waiting for a response.
Once information has been received, the station selects the most appropriate signal and sends an association request to the new access point. If the new access point sends an association response, the client has successfully roamed to a new access point (make, then break behavior).
MAC Layer and Data Payload
In addition to collision avoidance, timing and roaming, the MAC layer is also responsible for identifying the source and destination address of the packet being sent, as well as the data payload and a CRC. The entire payload of the packet, including the MAC header, is transmitted at the rate specified in the PLCP (see "IEEE 802.11 Packet Structure" graphic, and, for comparison, "Ethernet Packet Structure").
Send your comments on this article to Joel Conover at jconover@nwc.com.