はじめに
以前、Raspberry Pi (Raspberry Pi 5) をアクセスポイントとして動かすための記事を書きました。
この構成で運用していたところ、Wi-Fi のクライアント(エッジデバイス)が 8 台を超えた時点で、接続できなくなりました。
最初は、NetworkManager の設定ミスや Raspberry Pi のリソース不足を疑っていたのですが、違いました。
調べてみたところ、まったく同じ症状について議論されている issue を発見しました。
特定台数以上の接続ができなくなる原因と、対処法についてまとめます。
原因
これは issue で議論されている通りなのですが、無線通信用のチップ(CYW43455)のメモリのサイズが小さいことが原因のようです。
it looks like the limit being worked against here is 800 KB SRAM built-in to the wireless chip. (So the 1/2/4/8 GB of RAM available on the Raspberry Pi itself has nothing to do with the limits here.)
On-chip memory for the CPU includes 800 KB SRAM and 704 KB ROM.
これは、無線通信用のチップのメモリのサイズが原因なので、Raspberry Pi の RAM のサイズを上げても解決はしないです。
Raspberry Pi 4 でも同様の無線通信用のチップが搭載されているので、同じ問題が発生すると思います。
対応方法
通常の firmware よりも、省メモリになる minimal な firmware が用意されているので、それを使うことによって、今回の問題を解消することができます。
この firmware に置き換えることで、最大で 19 台の接続が可能になるようです。
記載されている通り、以下のコマンドを実行することで変更することができます。
$ sudo update-alternatives --config cyfmac43455-sdio.bin
通常の firmware を使うのか、minimal な firmware を使うのかを選択できるので、minimal な firmware を選択します。
$ sudo update-alternatives --config cyfmac43455-sdio.bin
There are 2 choices for the alternative cyfmac43455-sdio.bin (providing /lib/firmware/cypress/cyfmac43455-sdio.bin).
Selection Path Priority Status
------------------------------------------------------------
* 0 /lib/firmware/cypress/cyfmac43455-sdio-standard.bin 50 auto mode
1 /lib/firmware/cypress/cyfmac43455-sdio-minimal.bin 10 manual mode
2 /lib/firmware/cypress/cyfmac43455-sdio-standard.bin 50 manual mode
Press <enter> to keep the current choice[*], or type selection number:
実際に変更されているかは以下のコマンドで確認できます。
$ sudo update-alternatives --display cyfmac43455-sdio.bin
cyfmac43455-sdio.bin - manual mode
link best version is /lib/firmware/cypress/cyfmac43455-sdio-standard.bin
link currently points to /lib/firmware/cypress/cyfmac43455-sdio-minimal.bin
link cyfmac43455-sdio.bin is /lib/firmware/cypress/cyfmac43455-sdio.bin
/lib/firmware/cypress/cyfmac43455-sdio-minimal.bin - priority 10
/lib/firmware/cypress/cyfmac43455-sdio-standard.bin - priority 50