§7.3.2The 802.11 MAC Protocol

Link layer Kurose & Ross pp. 548–553 · ~14 min read

  • csma/ca
  • hidden terminal problem
  • binary exponential backoff

Where you are

  • Application layer
  • Transport layer
  • Network layer
  • Link layer you are here
  • Physical layer

A radio adapter cannot hear anything but itself while it transmits, so 802.11 cannot detect collisions — and every difference between it and Ethernet follows from that.

Words you will meet

  • CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) — sense the channel, then avoid collisions rather than detect them.

  • DIFS (Distributed Inter-Frame Space) — the longer wait, before starting something new.

  • SIFS (Short Inter-Frame Space) — the shorter wait, before an acknowledgement.

  • RTS (Request to Send) and CTS (Clear to Send) — a short exchange that reserves the channel.

  • Link-layer acknowledgement — 802.11 confirms every frame; Ethernet confirms none.

Why this matters

The designers of 802.11 were, in the book’s words, inspired by the huge success of Ethernet — and then had to change almost everything about its multiple access protocol.

This page is the best place in the book to see a physical constraint force a protocol design. The protocol it produces is CSMA/CA . One fact does all the work: a radio adapter cannot usefully listen while it transmits. Follow that fact and you can derive the rest of CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance) yourself.

Why there is no collision detection

Ethernet’s collision detection needs a station to listen while transmitting. On radio that fails twice over.

It is expensive. Detecting requires sending and receiving at the same time, and the received signal is tiny next to the adapter’s own transmission. Building hardware that can pick one out of the other costs real money.

And it would not be enough. Even with that hardware, the adapter would still miss collisions — because of the hidden terminal problem and fading from section 7.2. Some collisions are simply not detectable from where the sender is standing.

In plain words

So once an 802.11 station starts transmitting, it finishes. There is no turning back, even if the frame was destroyed in its first microsecond.

That is the fact to hold on to. Under Ethernet a collision costs a fraction of a frame; under 802.11 it costs a whole one, at both ends. Which is exactly why 802.11 spends effort avoiding collisions that Ethernet is happy to have and then clean up.

Every frame is acknowledged

Wireless bit error rates are high enough that a silently discarded frame is a poor bargain. So 802.11 adds something Ethernet deliberately does without.

Figure 7.10 — 802.11 acknowledges at the link layer
message 2 of 2
0 ms6 ms12 ms18 ms24 msSourceTimeDestinationTimeDIFS — wait, then sendSIFS — a shorter waitdata8 msack6 ms

Click any arrow to see what that message says and why it is sent.

Two waits with different lengths, and the difference matters. SIFS is SHORTER than DIFS, so an acknowledgement always wins the channel against any station waiting to start something new.

Read this diagram as text
  1. Source sends data to Destination (8 ms). Sent in its entirety. 802.11 has no collision detection, so once a station starts there is no turning back — even if the frame is already ruined.
  2. Destination sends ack to Source (6 ms). Sent only if the frame passed its CRC. If the sender does not get this within a set time it assumes an error and retransmits, running CSMA/CA again to get the channel. After a fixed number of tries it gives up and discards the frame.

Lifelines, left to right: Source (host), Destination (access point).

A destination that receives a frame passing its CRC (Cyclic Redundancy Check) waits a short inter-frame spacing and sends an acknowledgement. A sender that does not get one within a set time assumes an error and retransmits, running CSMA/CA again to get the channel. After a fixed number of tries it gives up and discards the frame.

Why SIFS is shorter than DIFS

The two waiting intervals are not the same length, and the difference is doing work.

SIFS is short, and it comes before an acknowledgement. DIFS is longer, and it comes before a station starts something new. So an acknowledgement always reaches the channel before any station that is waiting to begin.

A finished exchange is never interrupted halfway. The priority is built out of nothing but two timer lengths.

The CSMA/CA algorithm

  1. Channel idle? Wait a DIFS, then transmit.
  2. Channel busy? Choose a random backoff using binary exponential backoff , and count it down — but only while the channel is sensed idle. While it is busy, the counter freezes.
  3. Counter reaches zero? Transmit the whole frame, then wait for an acknowledgement.
  4. Acknowledged? Good; go to step 2 for the next frame. Not acknowledged? Back to step 2, with the random value drawn from a larger interval.

The interesting difference is step 2

Under Ethernet’s CSMA/CD (Carrier Sense Multiple Access with Collision Detection) a station transmits as soon as the channel goes idle. Under CSMA/CA a station keeps counting down even when it senses the channel idle. Why?

Picture two stations waiting because a third is transmitting. Under CSMA/CD both start the instant the third finishes — a collision, which costs them almost nothing because both detect it and abort.

Under 802.11 that same collision would cost two entire frames. So instead, both stations enter random backoff, and if their values differ, one starts first and the other hears it, freezes its counter, and waits. The collision is avoided rather than survived.

Collisions still happen: the two stations may be hidden from each other, or may pick backoff values so close that the first transmission has not reached the second station yet. That second case is exactly Figure 6.12 again, from section 6.3.2-csma.

CSMA/CD against CSMA/CA
Ethernet · CSMA/CD§6.3.2-csma802.11 · CSMA/CAhere
Senses the channel before sending?
Detects collisions while sending?
Can it abort a doomed frame?
Acknowledges at the link layer?
When the channel goes idle, does it send at once?

Cells marked ⓘ have a reason behind them — click to read it.

Same first four letters, different everything else. Click any cell — the reasons all trace back to one physical fact.

Hidden terminals, and the RTS/CTS reservation

Figure 7.11 — H1 is hidden from H2, and vice versa
Both stations reach the APstep 1 of 3
H1APH2the AP’s coverage reaches both stations

H1, the access point, and H2 sit in a line. Both stations are within range of the AP and both have associated with it. Nothing about that is unusual.

Coverage is drawn as rounded rectangles rather than circles, and the three stations are collinear as in the book. What matters is which region contains which station, not the shape of the boundary.

Read all steps as text
  1. Both stations reach the APH1, the access point, and H2 sit in a line. Both stations are within range of the AP and both have associated with it. Nothing about that is unusual.
  2. But their own ranges are smallerBecause of fading, each station’s signal reaches only the interior of its own circle. H1’s range covers the AP and stops short of H2. H2’s does the same in the other direction.
  3. So carrier sensing is honest and uselessH1 transmits. Halfway through, H2 senses the channel, hears genuine silence, waits its DIFS and transmits. Both frames are destroyed at the AP, and because 802.11 cannot abort, both are transmitted in full.

Both stations are in the AP’s range and both are associated with it. But fading limits each station’s own reach, so H1 and H2 cannot hear each other — while neither is hidden from the AP.

If H1 is transmitting and H2 wants to send, H2 senses an idle channel correctly, waits a DIFS and transmits. The channel is wasted for the whole of H1’s frame and the whole of H2’s.

Figure 7.12 — reserving the channel with RTS and CTS

H1 is transmitting. Halfway through, H2 wants to send. H2 cannot hear H1 at all, so it waits a DIFS and transmits — and both frames are destroyed at the AP.

message 2 of 2
0 ms5 ms9 ms14 ms18 msH1 · sourceTimeAP · destinationTimeH2 · all other nodeshidden from H1Timeboth frames destroyedDATA (long)16 msDATA10 ms

Click any arrow to see what that message says and why it is sent.

Switch between the runs. The reservation works because H2 can hear the AP even though it cannot hear H1 — so the AP does the announcing.

Read this diagram as text
  1. H1 · source sends DATA (long) to AP · destination — lost (16 ms). H1 hears nothing to stop it, and 802.11 cannot abort mid-frame. The whole frame is transmitted and the whole frame is wasted.
  2. H2 · all other nodes sends DATA to AP · destination — lost (10 ms). H2 sensed an idle channel, correctly — H1 is hidden from it. Both frames collide at the AP.

Lifelines, left to right: H1 · source (host), AP · destination (access point), H2 · all other nodes (host).

In plain words

The reservation works because of an asymmetry that was there all along: H2 cannot hear H1, but it can hear the AP.

So H1 asks the AP for permission with a short RTS naming how long it needs. The AP answers with a CTS that everybody in its range hears. That CTS does two jobs at once — it grants H1 permission, and it tells everyone else to stay quiet for the reserved duration.

H2, which never heard H1, hears the AP and defers.

Notice what the scheme actually buys. RTS and CTS frames are short, so when two of them do collide, very little is wasted. The long DATA frame is protected by a reservation that a much cheaper exchange established.

The book is careful to call the whole thing optional, and it is. RTS/CTS adds two frames to every exchange, so the trade only pays when frames are long or hidden terminals are likely.

A slip on page 550 — and the book has made it before

CDMA (Code Division Multiple Access) is the channel-partitioning protocol of section 7.2 — a different family from anything on this page.

Page 550 asks: “Why do CSMA/CD and CDMA/CA take such different approaches here?” It should be CSMA/CA.

This is the second time. Book page 489, in section 6.4.2, writes “Ethernet’s CDMA/CD protocol” for the same reason. Two chapters, two merges of CDMA with a CSMA (Carrier Sense Multiple Access) variant.

Everyday picture

Two people at opposite ends of a long table, with a chairperson in the middle. The room is noisy enough that the two cannot hear each other at all — but both can hear the chair.

Left to themselves they talk over each other constantly, and neither ever knows it. So instead each asks the chair for the floor, and the chair says out loud “Ana has the floor for the next two minutes”. Everyone hears that, including the person who could not hear Ana.

Where the picture stops. A person who is interrupted stops talking. An 802.11 station cannot: it finishes its frame whatever happens, because it never learns anything went wrong until the acknowledgement fails to arrive.

Check yourself

Check yourself

0 of 7 answered
  1. 1.Why does 802.11 not detect collisions the way Ethernet does?

  2. 2.predictAn 802.11 frame collides one microsecond after transmission begins. What happens to the rest of it?

  3. 3.Why is SIFS shorter than DIFS?

  4. 4.predictTwo stations are waiting because a third is transmitting. Under CSMA/CA, what happens when the third finishes?

  5. 5.H1 and H2 are both associated with the same AP but hidden from each other. How does RTS/CTS fix the collision?

  6. 6.Why is the RTS/CTS exchange worth its two extra frames?

  7. 7.predictUnder CSMA/CA, can collisions still occur even when every station follows the rules?

What to remember

  • 802.11 has no collision detection: listening while transmitting is expensive, and would still miss hidden-terminal and fading collisions. So a frame that collides is transmitted in full, and the protocol avoids rather than detects — hence the CA.
  • Every frame is acknowledged at the link layer, after a SIFS. SIFS is shorter than DIFS, so an acknowledgement always beats a station waiting to start: priority made of two timer lengths.
  • A station counts its backoff down only while the channel is idle, freezing it while busy — unlike Ethernet, which starts the moment the channel clears. RTS/CTS is optional and solves the hidden terminal, because everyone can hear the AP.