lwfinger / rtw88

A backport of the Realtek Wifi 5 drivers from the wireless-next repo.
649 stars 183 forks source link

rtw_8822cs : no AP mode ? #245

Open chris4git opened 1 month ago

chris4git commented 1 month ago

Hi, Context : Armbian bookworm 24.11 6.6.58-current-rockchip64 After make/make install of current version of the driver (and reboot) iw list gives only managed and monitor modes available. Under Android all modes are available.

Logs : Oct 28 15:08:39 station-m2 kernel: rtw_8822cs mmc1:0001:1: WOW Firmware version 9.9.4, H2C version 15 Oct 28 15:08:39 station-m2 kernel: rtw_8822cs mmc1:0001:1: Firmware version 9.9.15, H2C version 15

Something necessary at compilation time to activate AP mode ?

Chris

dubhater commented 1 month ago

Yes, you need to make this change:

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index e91530ed05a0..4ba821dcc7eb 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -2228,7 +2228,7 @@ EXPORT_SYMBOL(rtw_core_deinit);

 int rtw_register_hw(struct rtw_dev *rtwdev, struct ieee80211_hw *hw)
 {
-   bool sta_mode_only = rtwdev->hci.type == RTW_HCI_TYPE_SDIO;
+   bool sta_mode_only = false;
    struct rtw_hal *hal = &rtwdev->hal;
    int max_tx_headroom = 0;
    int ret;

SDIO (and USB) devices had some problems with AP mode, so someone decided that AP mode should be disabled until the problems are fixed. It's very possible that the problems are all fixed now. People with USB devices reported that it's working better. I don't know if anyone tested the SDIO side.

chris4git commented 1 month ago

Thanks @dubhater ! Now all modes are present. Next step : to get a working setup with armbian-config...

chris4git commented 4 weeks ago

Hi, no success ! I tried directly with hostapd with this config :

interface=wlan0
driver=nl80211
ssid=test
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mustbechanged
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

the ssid "test" is seen but the connections attempts failed. wpa_supplicant side one can see :

wpa_supplicant[1202]: wlp2s0: SME: Trying to authenticate with 4c:24:ce:cd:dd:38 (SSID='test' freq=2412 MHz)
wpa_supplicant[1202]: wlp2s0: Trying to associate with 4c:24:ce:cd:dd:38 (SSID='test' freq=2412 MHz)
wpa_supplicant[1202]: wlp2s0: Associated with 4c:24:ce:cd:dd:38
wpa_supplicant[1202]: wlp2s0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
wpa_supplicant[1202]: wlp2s0: Authentication with 4c:24:ce:cd:dd:38 timed out.

and hostapd side :

nl80211: RX frame da=4c:24:ce:cd:dd:38 sa=5c:87:9c:fb:c3:ef bssid=4c:24:ce:cd:dd:38 freq=2412 ssi_signal=-55 fc=0x0 seq_ctrl=0x60 stype=0 (WLAN_FC_STYPE_ASSOC_REQ) len=104
wlan0: Event RX_MGMT (18) received
mgmt::assoc_req
association request: STA=5c:87:9c:fb:c3:ef capab_info=0x431 listen_interval=10 seq_ctrl=0x60
  new AID 1
wlan0: STA 5c:87:9c:fb:c3:ef IEEE 802.11: association OK (aid 1)
Add associated STA 5c:87:9c:fb:c3:ef (added_unassoc=1 auth_alg=0 ft_over_ds=0 reassoc=0 authorized=0 ft_tk=0 fils_tk=0)
nl80211: Set STA 5c:87:9c:fb:c3:ef
  * supported rates - hexdump(len=12): 02 04 0b 16 0c 12 18 24 30 48 60 6c
  * capability=0x431
  * aid=1
  * listen_interval=10
  * flags set=0xa4 mask=0xa4
nl80211: send_mlme - da=5c:87:9c:fb:c3:ef noack=0 freq=0 no_cck=0 offchanok=0 wait_time=0 no_encrypt=0 fc=0x10 (WLAN_FC_STYPE_ASSOC_RESP) nlmode=3
nl80211: send_mlme - Use bss->freq=2412
nl80211: send_mlme -> send_frame_cmd
nl80211: BSS Event 59 (NL80211_CMD_FRAME) received for wlan0
nl80211: RX frame da=4c:24:ce:cd:dd:38 sa=5c:87:9c:fb:c3:ef bssid=4c:24:ce:cd:dd:38 freq=2412 ssi_signal=-56 fc=0xc0 seq_ctrl=0x70 stype=12 (WLAN_FC_STYPE_DEAUTH) len=26
wlan0: Event RX_MGMT (18) received

It seems wpa_supplicant didn't received something expected. Any idea of the problem ?

Chris

dubhater commented 4 weeks ago

I don't know. Maybe there is something in dmesg on the AP side.

chris4git commented 4 weeks ago

Nothing in dmesg. I tried the same hostapd configuration with a USB adapter (8192eu/rtl8xxxu) and it worked :

wlx7cc2c609e437: interface state UNINITIALIZED->COUNTRY_UPDATE
wlx7cc2c609e437: interface state COUNTRY_UPDATE->ENABLED
wlx7cc2c609e437: AP-ENABLED 
wlx7cc2c609e437: STA 5c:87:9c:fb:c3:ef IEEE 802.11: authenticated
wlx7cc2c609e437: STA 5c:87:9c:fb:c3:ef IEEE 802.11: associated (aid 1)
wlx7cc2c609e437: AP-STA-CONNECTED 5c:87:9c:fb:c3:ef
wlx7cc2c609e437: STA 5c:87:9c:fb:c3:ef RADIUS: starting accounting session D217E0BED48CC56D
wlx7cc2c609e437: STA 5c:87:9c:fb:c3:ef WPA: pairwise key handshake completed (RSN)
wlx7cc2c609e437: EAPOL-4WAY-HS-COMPLETED 5c:87:9c:fb:c3:ef
wlx7cc2c609e437: AP-STA-DISCONNECTED 5c:87:9c:fb:c3:ef
wlx7cc2c609e437: interface state ENABLED->DISABLED
wlx7cc2c609e437: AP-DISABLED 
wlx7cc2c609e437: CTRL-EVENT-TERMINATING 
nl80211: deinit ifname=wlx7cc2c609e437 disabled_11b_rates=0

With the rtw_8822cs :

wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan0: interface state COUNTRY_UPDATE->ENABLED
wlan0: AP-ENABLED 
wlan0: interface state ENABLED->DISABLED
wlan0: AP-DISABLED 
wlan0: CTRL-EVENT-TERMINATING 
nl80211: deinit ifname=wlan0 disabled_11b_rates=0

The authentication/association don't go to the end. Something to do with mac80211.c ?

dubhater commented 4 weeks ago

The problem could be anywhere.