RT2870/RT3070 ath9k_htc and maximum number of STAs
For many years I have been using RT2870/RT3070 USB WiFi dongles and I was happy with them. They have great Linux support thanks to the ath9k_htc driver.
But as number of IoT devices increased, one day one of them couldn’t connect and hostapd was reporting errors like these:
Could not set STA to kernel driver
nl80211: NL80211_CMD_SET_STATION result: -105 (No buffer space available)
After 2 hours of reading ath9k_htc source code, I reached the following:
#define ATH9K_HTC_MAX_STA 8
/* ... */
if (priv->nstations >= ATH9K_HTC_MAX_STA)
return -ENOBUFS;
It turns out this chip is not big enough to support more than 8 WiFi clients. Some additional searching over the web revealed this conversation:
“K2/AR9271 is limited to 8 nodes in AP mode due to RAM size imitation of internal on-chip RAM (K2 does not use external RAM).
…
It was once suggested that, with a lot of work, the internal RAM might be able to be used more efficiently to realize up to 16 nodes. But this was deemed too much work in light of newer USB chipsets like WASP/AR9342 which have no such limitations.”
After quite extensive effort of reading about various alternatives and their Linux support, I decided to buy Alfa AWUS036ACM which is a dongle based on MT7612U which is Wi-Fi 5 (a/b/g/n/ac) and is in the mainline kernel since 4.19 (2018). It is not as open as ath9k_htc dongles but it works very well! I would even say this is one of the best Linux-supported USB wifi chips currently available.
If you know about other well-supported dongles or WiFi chips, please let us know in the comments.