For me it works briefly. The SSID is visible at first, but when I try to connect there is a kernel panic (see below).
From that point, the system is broken.
I’m running on ArchlinuxARM with a kernel from BPI-R2 github page and default configuration.
hostapd with default config as well.
[ 1015.666910] [MTK-WIFI] WIFI_open: WIFI_open: major 153 minor 0 (pid 8160)
[ 1015.684243] [MTK-WIFI] WIFI_write: WIFI_write A
[ 1015.731654] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt wlan func on before wlan probe
[ 1016.804540] [MTK-WIFI] register_set_p2p_mode_handler: (pid 8184) register set p2p mode handler c071f534
[ 1016.824227] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt call wlan probe ok
[ 1016.841654] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:2 lpbk:2 coredump:0 wmt:2 stp:0)
[ 1016.864324] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(3) ok
[ 1016.881505] [MTK-WIFI] WIFI_write: WMT turn on WIFI success!
[ 1016.898993] [MTK-WIFI] WIFI_write: Set wlan mode 0 --> 1
[ 1016.914772] [MTK-WIFI] WIFI_close: WIFI_close: major 153 minor 0 (pid 8160)
[ 1281.064828] ------------[ cut here ]------------
[ 1281.079627] WARNING: CPU: 1 PID: 8197 at net/wireless/nl80211.c:3618 nl80211_put_sta_rate+0xf8/0x1f8()
[ 1281.099112] Modules linked in: input_leds led_class ahci libahci libata mtk_thermal mtk_cir ip_tables x_tables
[ 1281.119464] CPU: 1 PID: 8197 Comm: tx_thread Not tainted 4.4.70-BPI-R2-Kernel #2
[ 1281.136976] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1281.152708] [<c001a180>] (unwind_backtrace) from [<c0014c1c>] (show_stack+0x20/0x24)
[ 1281.170691] [<c0014c1c>] (show_stack) from [<c0564048>] (dump_stack+0x94/0xa8)
[ 1281.188082] [<c0564048>] (dump_stack) from [<c0034944>] (warn_slowpath_common+0x94/0xc4)
[ 1281.206255] [<c0034944>] (warn_slowpath_common) from [<c0034a30>] (warn_slowpath_null+0x2c/0x34)
[ 1281.225180] [<c0034a30>] (warn_slowpath_null) from [<c0aa2adc>] (nl80211_put_sta_rate+0xf8/0x1f8)
[ 1281.244195] [<c0aa2adc>] (nl80211_put_sta_rate) from [<c0a7a08c>] (nl80211_send_station+0x4f8/0xb1c)
[ 1281.263549] [<c0a7a08c>] (nl80211_send_station) from [<c0a7a740>] (cfg80211_new_sta+0x90/0x18c)
[ 1281.282483] [<c0a7a740>] (cfg80211_new_sta) from [<c0735124>] (kalP2PGOStationUpdate+0x94/0x9c)
[ 1281.301426] [<c0735124>] (kalP2PGOStationUpdate) from [<c074fc5c>] (p2pRunEventAAASuccess+0x24/0x2c)
[ 1281.320844] [<c074fc5c>] (p2pRunEventAAASuccess) from [<c0739f44>] (aaaFsmRunEventTxDone+0x194/0x19c)
[ 1281.340460] [<c0739f44>] (aaaFsmRunEventTxDone) from [<c07187e8>] (nicRxProcessEventPacket+0x7f4/0x9b4)
[ 1281.360288] [<c07187e8>] (nicRxProcessEventPacket) from [<c0718b10>] (nicRxProcessRFBs+0xbc/0x188)
[ 1281.379755] [<c0718b10>] (nicRxProcessRFBs) from [<c0718ea8>] (nicProcessRxInterrupt+0x3c/0x40)
[ 1281.399042] [<c0718ea8>] (nicProcessRxInterrupt) from [<c07122bc>] (nicProcessIST_impl+0x5c/0xb4)
[ 1281.418511] [<c07122bc>] (nicProcessIST_impl) from [<c071236c>] (nicProcessIST+0x58/0xa4)
[ 1281.437278] [<c071236c>] (nicProcessIST) from [<c07045a8>] (wlanIST+0x50/0x9c)
[ 1281.455021] [<c07045a8>] (wlanIST) from [<c0722c2c>] (tx_thread+0x3bc/0x440)
[ 1281.472548] [<c0722c2c>] (tx_thread) from [<c0054350>] (kthread+0x118/0x120)
[ 1281.490061] [<c0054350>] (kthread) from [<c0010038>] (ret_from_fork+0x14/0x3c)
[ 1281.507806] ---[ end trace 2a0a5799a7240bb4 ]---
Edit: I’ve added a printk just before the switch case near line 3618 in net/wireless/nl80211.c, printing info->bw. In a single run, the printk got hit twice:
[ 108.431013] nl80211_put_sta_rate(3610): info->bw=218
PANIC TRACE
[ 109.266831] nl80211_put_sta_rate(3610): info->bw=223
PANIC TRACE
Both values do not match a value from enum rate_info_bw, hitting the default clause, triggering the trace output. I will try to find where this value is determined.
Then, subsequently, a different trace is printed:
[ 108.780753] ------------[ cut here ]------------
[ 108.795727] WARNING: CPU: 3 PID: 418 at net/wireless/util.c:1124 cfg80211_calculate_bitrate+0x208/0x238()
[ 108.815771] Modules linked in: ahci libahci libata mtk_cir mtk_thermal ip_tables x_tables
[ 108.834560] CPU: 3 PID: 418 Comm: tx_thread Tainted: G W 4.4.70-BPI-R2-Kernel #3
[ 108.853563] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 108.869589] [<c001a180>] (unwind_backtrace) from [<c0014c1c>] (show_stack+0x20/0x24)
[ 108.887806] [<c0014c1c>] (show_stack) from [<c0564048>] (dump_stack+0x94/0xa8)
[ 108.905474] [<c0564048>] (dump_stack) from [<c0034944>] (warn_slowpath_common+0x94/0xc4)
[ 108.923982] [<c0034944>] (warn_slowpath_common) from [<c0034a30>] (warn_slowpath_null+0x2c/0x34)
[ 108.943183] [<c0034a30>] (warn_slowpath_null) from [<c0a5ef08>] (cfg80211_calculate_bitrate+0x208/0x238)
[ 108.963169] [<c0a5ef08>] (cfg80211_calculate_bitrate) from [<c0aa2a3c>] (nl80211_put_sta_rate+0x58/0x214)
[ 108.983277] [<c0aa2a3c>] (nl80211_put_sta_rate) from [<c0a7a08c>] (nl80211_send_station+0x4f8/0xb1c)
[ 109.002970] [<c0a7a08c>] (nl80211_send_station) from [<c0a7a740>] (cfg80211_new_sta+0x90/0x18c)
[ 109.022195] [<c0a7a740>] (cfg80211_new_sta) from [<c0735124>] (kalP2PGOStationUpdate+0x94/0x9c)
[ 109.041497] [<c0735124>] (kalP2PGOStationUpdate) from [<c074fc5c>] (p2pRunEventAAASuccess+0x24/0x2c)
[ 109.061335] [<c074fc5c>] (p2pRunEventAAASuccess) from [<c0739f44>] (aaaFsmRunEventTxDone+0x194/0x19c)
[ 109.081261] [<c0739f44>] (aaaFsmRunEventTxDone) from [<c07187e8>] (nicRxProcessEventPacket+0x7f4/0x9b4)
[ 109.101407] [<c07187e8>] (nicRxProcessEventPacket) from [<c0718b10>] (nicRxProcessRFBs+0xbc/0x188)
[ 109.121197] [<c0718b10>] (nicRxProcessRFBs) from [<c0718ea8>] (nicProcessRxInterrupt+0x3c/0x40)
[ 109.140739] [<c0718ea8>] (nicProcessRxInterrupt) from [<c07122bc>] (nicProcessIST_impl+0x5c/0xb4)
[ 109.160488] [<c07122bc>] (nicProcessIST_impl) from [<c071236c>] (nicProcessIST+0x58/0xa4)
[ 109.179554] [<c071236c>] (nicProcessIST) from [<c07045a8>] (wlanIST+0x50/0x9c)
[ 109.197603] [<c07045a8>] (wlanIST) from [<c0722c2c>] (tx_thread+0x3bc/0x440)
[ 109.215443] [<c0722c2c>] (tx_thread) from [<c0054350>] (kthread+0x118/0x120)
[ 109.233280] [<c0054350>] (kthread) from [<c0010038>] (ret_from_fork+0x14/0x3c)
[ 109.251348] ---[ end trace ef406c8ee8e40661 ]---
Edit 2: Good news!
It seems the kernel was crashing on uninitialized memory. After I added the line below in drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_kal.c on line 1078, hostapd accepted the key handshake and no more kernel trace outputs
memset(&rStationInfo, 0, sizeof(struct station_info));
@garywang: Could you please test and add this line to the repo?
Result:
Oct 18 22:14:46 alarm hostapd[438]: Using interface ap0 with hwaddr 02:08:22:10:f8:fc and ssid "BPI-R2"
Oct 18 22:14:46 alarm hostapd[438]: ap0: interface state UNINITIALIZED->ENABLED
Oct 18 22:14:46 alarm hostapd[438]: ap0: AP-ENABLED
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa IEEE 802.11: associated
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa IEEE 802.11: associated
Oct 18 22:15:35 alarm hostapd[438]: ap0: AP-STA-CONNECTED 38:ca:da:a0:f8:aa
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa RADIUS: starting accounting session ECFA0EF00D8C6ED2
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa WPA: pairwise key handshake completed (RSN)
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa RADIUS: starting accounting session ECFA0EF00D8C6ED2
Oct 18 22:15:35 alarm hostapd[438]: ap0: STA 38:ca:da:a0:f8:aa WPA: pairwise key handshake completed (RSN)
My device now indicates it is connected, although i didn’t setup any IP configuration yet.
Edit 3: I just configured DHCP and NAT on the R2, seems to work perfectly in my limited test.