[][MAC80211][WiFi7][misc][Prevent deadlock in a multiple AP+STA mode]
[Description]
Fix the deadlock in multiple AP+STA mode.
When setting up interfaces in a multiple AP+STA mode, there might be
a deadlock between hostapd and wpa_supplicant.
Netifd sets up each radio in order of radio number. For single radio
setup, hostapd is first asked for setting up AP interface, then it
leverages ucode to ask wpa_supplicant for setting up STA interface.
An interface setup order in a multiple AP+STA mode might be:
phy0-ap0 -> phy0-sta0 -> phy1-ap0 -> phy1-sta0 -> phy2-ap0 -> phy2-sta0
However, since netifd only controls the order to set radio up and the
setup time of each AP interface varies, the atual setup order might change.
For example, phy2-ap0 might start its setup BEFORE phy1-sta0 finishes the
setup.
Moreover, hostapd blocks when it levereges ucode to send message to
wpa_supplicant, and vice versa.
A deadlock happens in the following scenario:
1. [wpa_supplicant] phy1-sta0 enters SCANNING state and leverages ucode
to stop phy1-ap0. wpa_cupplicant blocks unitl hostapd finishes
stopping phy1-ap0.
2. [hostapd] After hostapd finishes setting up phy2-ap0, it leverages
ucode to ask wpa_supplicant for setting up phy2-sta0. hostapd blocks
until wpa_supplicant finishes setting up phy2-sta0.
To avoid the deadlock, the interval between setting up each radio
becomes longer so that each radio is set up without affecting
each other.
[Release-log]
N/A
Change-Id: Ieaaba99bd6505abd500c1f2ebe5137a61b9655fa
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8102680
1 file changed