How does a Wi-Fi device know what speed to transmit at?
April 5, 2022 3:54 PM   Subscribe

Example: I run a speed test on my phone while connected to Wi-Fi and get a result. I go around the corner and test again and get another, lower result. Did my phone and AP somehow detect that they need to slow down? Or do they just transmit data at full speed and see if it works?

For this question let's consider only the connection between client and access point and ignore other possible limits like Internet speed.

Clearly devices know if they're connected to a 802.11g network or a 802.11ac network. But even on a 802.11ac network, speeds vary. How do the devices find the right speed? Does a client or AP somehow estimate the maximum rate based on signal strength before it even transmits? Does WiFi have some kind of ack process so the transmitting device knows to slow down if it's not getting every expected ack? Does a device just transmit at maximum speed and let higher protocols like TCP handle dropped packets?
posted by Tehhund to Technology (3 answers total) 3 users marked this as a favorite
 
What you are talking about is called Dynamic Rate Scaling and is based on the signal quality -- primarily the signal strength -- of the received signal. Either side of the connection can instigate a speed negotiation at any time.

Since both sides take part in the negotiation the station with the worse signal gets its needs met.
posted by Tell Me No Lies at 4:10 PM on April 5, 2022 [2 favorites]


There is also exponential backoff in response to channel contention. Even if you're the only device on your WLAN, if you end up on the same channel as your neighbor's network you could face contention.
posted by goingonit at 4:23 PM on April 5, 2022 [2 favorites]


Best answer: In here, I'm using the term "bandwidth" in the radio sense - the amount of radio spectrum used (in hertz) rather than the computer science sense of information transfer rate (in bits per second). If you're especially curious about how this works, I think with some Wi-Fi adapters, you can capture all information about link adaptation/establishment in Wireshark or other analyzers.

In modern 802.11ac network, the bandwidth of the link (how much of the radio spectrum is used) and the "MCS" ("modulation and coding set" - how the information is encoded on the radio spectrum) can be set by both link partners, and can change at any time. In 802.11n, "spatial streams" can be changed as well; this option was eliminated in 802.11ac in favor of requiring MCS options to have a specific number of spatial streams.

Every WiFi device advertises what bandwidths/modulations the device supports in "VHT Capabilities" frames that define the maximum possible link speed. That may or may not be usable at any given time, but determines how far each device can go in increasing link speed. These are transferred with a very conservative modulation scheme (I think the most conservative) to ensure that all devices accurately receive the information.

Bandwidth is the easiest parameter to negotiate - the sending device sends a "request to send" (RTS) frame on all channels that it wants to use. The receiving device will then send a "clear to send" (CTS) frame back on all channels that the receiving device receives the RTS on. If portions of the bandwidth aren't available, the receiving device will only receive some of the RTS packets, and hence, will only respond to CTS on the usable bandwidths. Bandwidth is hence self-limiting based on RTS/CTS exchange.

The selection of MCS is trickier. There is a feature in 802.11ac for each device to send feedback periodically and on-request to the other side about received signal quality continuously ("MCS feedback") in order to set MCS. The advantage to this is retransmissions due to incorrectly received frames are reduced significantly. However, the implementation of this in 802.11ac is difficult in practice [*] and hence, this feature is rarely used. Instead, it's far more common to use the presence/absence of 802.11 level acknowledgement frames to determine whether data has been successfully received - and if not, do a back-off of MCS selection (as alluded to goingonit) until data is received successfully.

[*] Without getting into fairly complicated wireless communications theory, there's effectively insufficient information in the protocol for the side receiving the MCS feedback to determine whether the received feedback is appropriate for future mentions. The feedback may be accurate for some packet sizes, but inaccurate for other packet sizes. Further, the signal quality estimates are averaged too much, reducing the quality of the estimate.
posted by saeculorum at 4:54 PM on April 5, 2022 [11 favorites]


« Older What was this movie that made me cry   |   What has it really been like owning an electric... Newer »
This thread is closed to new comments.