Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advice needed for optimal hostapd configuration with rtw88_8822bu devices. #578

Open
thememika opened this issue Feb 12, 2025 · 6 comments

Comments

@thememika
Copy link

Hello!
I'm using the rtw88 driver (kernel in-tree) to operate two 88x2bu-based devices over USB 2.0 in AP mode on my server.
I'm running two separate networks on these devices, one is 5 Ghz (hw_mode=a channel 144), and another is 2.4 GHz (hw_mode=g channel 13).

And, it is working, except unoptimal speed.
The speed is barely 20 Mbps, even in local communication on the 5Ghz network, and less than 10 Mbps on the 2.4Ghz one.
It's clearly not the issue with my server or routing, because I also have a wired localnet in house, and the speed to my server (over wires) is stable 1 Gbps there.

Yes, the rtw devices are on USB 2.0, and I expect never more than around 200 Mbps or similar, but not 10..

In this issue I would like to focus on the 5Ghz network configuration, for now.
Below is my currently used hostapd file, in essence:

interface=wlan0
driver=nl80211
ssid= <snip>
wpa_passphrase= <snip>
hw_mode=a
channel=144
wpa=3
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
ignore_broadcast_ssid=1

And it works, except speed.
Now I wanted to reconfigure it like this, after doing some research:

interface=wlan0
driver=nl80211
ssid= <snip>
hw_mode=a
channel=144
wpa=3
wpa_passphrase= <snip>
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
ignore_broadcast_ssid=1

wme_enabled=1
ieee80211n=1
require_vht=1
wmm_enabled=1

ieee80211ac=1
ieee80211d=1
ieee80211h=1

ht_capab=[HT40-][HT40+][SHORT-GI-40][MAX-AMSDU-7935]

vht_capab=[MAX-MPDU-11454][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][HTC-VHT][MAX-A-MPDU-LEN-EXP7]

vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=146

But this one fails to start:

wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
wlan0: interface state COUNTRY_UPDATE->HT_SCAN
nl80211: kernel reports: (extension) channel is disabled
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state HT_SCAN->DISABLED
wlan0: AP-DISABLED 
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED 
wlan0: CTRL-EVENT-TERMINATING 
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0

The message channel is disabled makes no sense, as in all my kernels I edit out the cfg80211 limitation/check.
I don't know what's the problem.
Here is IW list for this specific device:

Wiphy phy3
	wiphy index: 3
	max # scan SSIDs: 4
	max scan IEs length: 2243 bytes
	max # sched scan SSIDs: 0
	max # match sets: 0
	Retry short limit: 7
	Retry long limit: 4
	Coverage class: 0 (up to 0m)
	Device supports T-DLS.
	Supported Ciphers:
		* WEP40 (00-0f-ac:1)
		* WEP104 (00-0f-ac:5)
		* TKIP (00-0f-ac:2)
		* CCMP-128 (00-0f-ac:4)
		* CCMP-256 (00-0f-ac:10)
		* GCMP-128 (00-0f-ac:8)
		* GCMP-256 (00-0f-ac:9)
		* CMAC (00-0f-ac:6)
		* CMAC-256 (00-0f-ac:13)
		* GMAC-128 (00-0f-ac:11)
		* GMAC-256 (00-0f-ac:12)
	Available Antennas: TX 0x3 RX 0x3
	Configured Antennas: TX 0x3 RX 0x3
	Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * monitor
	Band 1:
		Capabilities: 0x196f
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			RX STBC 1-stream
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 2 usec (0x04)
		HT Max RX data rate: 300 Mbps
		HT TX/RX MCS rate indexes supported: 0-15, 32
		Bitrates (non-HT):
			* 1.0 Mbps
			* 2.0 Mbps
			* 5.5 Mbps
			* 11.0 Mbps
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 2412.0 MHz [1] (20.0 dBm)
			* 2417.0 MHz [2] (20.0 dBm)
			* 2422.0 MHz [3] (20.0 dBm)
			* 2427.0 MHz [4] (20.0 dBm)
			* 2432.0 MHz [5] (20.0 dBm)
			* 2437.0 MHz [6] (20.0 dBm)
			* 2442.0 MHz [7] (20.0 dBm)
			* 2447.0 MHz [8] (20.0 dBm)
			* 2452.0 MHz [9] (20.0 dBm)
			* 2457.0 MHz [10] (20.0 dBm)
			* 2462.0 MHz [11] (20.0 dBm)
			* 2467.0 MHz [12] (30.0 dBm)
			* 2472.0 MHz [13] (30.0 dBm)
			* 2484.0 MHz [14] (30.0 dBm)
	Band 2:
		Capabilities: 0x196f
			RX LDPC
			HT20/HT40
			SM Power Save disabled
			RX HT20 SGI
			RX HT40 SGI
			RX STBC 1-stream
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
		Minimum RX AMPDU time spacing: 2 usec (0x04)
		HT Max RX data rate: 300 Mbps
		HT TX/RX MCS rate indexes supported: 0-15, 32
		VHT Capabilities (0x03d071b2):
			Max MPDU length: 11454
			Supported Channel Width: neither 160 nor 80+80
			RX LDPC
			short GI (80 MHz)
			TX STBC
			SU Beamformee
			MU Beamformee
			+HTC-VHT
		VHT RX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT RX highest supported: 780 Mbps
		VHT TX MCS set:
			1 streams: MCS 0-9
			2 streams: MCS 0-9
			3 streams: not supported
			4 streams: not supported
			5 streams: not supported
			6 streams: not supported
			7 streams: not supported
			8 streams: not supported
		VHT TX highest supported: 780 Mbps
		VHT extended NSS: not supported
		Bitrates (non-HT):
			* 6.0 Mbps
			* 9.0 Mbps
			* 12.0 Mbps
			* 18.0 Mbps
			* 24.0 Mbps
			* 36.0 Mbps
			* 48.0 Mbps
			* 54.0 Mbps
		Frequencies:
			* 5180.0 MHz [36] (30.0 dBm)
			* 5200.0 MHz [40] (30.0 dBm)
			* 5220.0 MHz [44] (30.0 dBm)
			* 5240.0 MHz [48] (30.0 dBm)
			* 5260.0 MHz [52] (30.0 dBm)
			* 5280.0 MHz [56] (30.0 dBm)
			* 5300.0 MHz [60] (30.0 dBm)
			* 5320.0 MHz [64] (30.0 dBm)
			* 5500.0 MHz [100] (30.0 dBm)
			* 5520.0 MHz [104] (30.0 dBm)
			* 5540.0 MHz [108] (30.0 dBm)
			* 5560.0 MHz [112] (30.0 dBm)
			* 5580.0 MHz [116] (30.0 dBm)
			* 5600.0 MHz [120] (30.0 dBm)
			* 5620.0 MHz [124] (30.0 dBm)
			* 5640.0 MHz [128] (30.0 dBm)
			* 5660.0 MHz [132] (30.0 dBm)
			* 5680.0 MHz [136] (30.0 dBm)
			* 5700.0 MHz [140] (30.0 dBm)
			* 5720.0 MHz [144] (30.0 dBm)
			* 5745.0 MHz [149] (30.0 dBm)
			* 5765.0 MHz [153] (30.0 dBm)
			* 5785.0 MHz [157] (30.0 dBm)
			* 5805.0 MHz [161] (30.0 dBm)
			* 5825.0 MHz [165] (30.0 dBm)
	Supported commands:
		 * new_interface
		 * set_interface
		 * new_key
		 * start_ap
		 * new_station
		 * new_mpath
		 * set_mesh_config
		 * set_bss
		 * authenticate
		 * associate
		 * deauthenticate
		 * disassociate
		 * join_ibss
		 * join_mesh
		 * remain_on_channel
		 * set_tx_bitrate_mask
		 * frame
		 * frame_wait_cancel
		 * set_wiphy_netns
		 * set_channel
		 * tdls_mgmt
		 * tdls_oper
		 * probe_client
		 * set_noack_map
		 * register_beacons
		 * start_p2p_device
		 * set_mcast_rate
		 * connect
		 * disconnect
		 * set_qos_map
		 * set_multicast_to_unicast
		 * set_sar_specs
	software interface modes (can always be added):
		 * AP/VLAN
		 * monitor
	interface combinations are not supported
	HT Capability overrides:
		 * MCS: ff ff ff ff ff ff ff ff ff ff
		 * maximum A-MSDU length
		 * supported channel width
		 * short GI for 40 MHz
		 * max A-MPDU length exponent
		 * min MPDU start spacing
	Device supports TX status socket option.
	Device supports HT-IBSS.
	Device supports SAE with AUTHENTICATE command
	Device supports scan flush.
	Device supports per-vif TX power setting
	Driver supports full state transitions for AP/GO clients
	Driver supports a userspace MPM
	Device supports configuring vdev MAC-addr on create.
	Device supports randomizing MAC-addr in scans.
	max # scan plans: 1
	max scan plan interval: -1
	max scan plan iterations: 0
	Supported TX frame types:
		 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * mesh point: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
		 * P2P-device: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
	Supported RX frame types:
		 * IBSS: 0x40 0xb0 0xc0 0xd0
		 * managed: 0x40 0xb0 0xd0
		 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * mesh point: 0xb0 0xc0 0xd0
		 * P2P-client: 0x40 0xd0
		 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
		 * P2P-device: 0x40 0xb0 0xd0
	Supported extended features:
		* [ RRM ]: RRM
		* [ SET_SCAN_DWELL ]: scan dwell setting
		* [ FILS_STA ]: STA FILS (Fast Initial Link Setup)
		* [ CONTROL_PORT_OVER_NL80211 ]: control port over nl80211
		* [ TXQS ]: FQ-CoDel-enabled intermediate TXQs
		* [ SCAN_RANDOM_SN ]: use random sequence numbers in scans
		* [ CAN_REPLACE_PTK0 ]: can safely replace PTK 0 when rekeying
		* [ CONTROL_PORT_NO_PREAUTH ]: disable pre-auth over nl80211 control port support
		* [ DEL_IBSS_STA ]: deletion of IBSS station support
		* [ SCAN_FREQ_KHZ ]: scan on kHz frequency support
		* [ CONTROL_PORT_OVER_NL80211_TX_STATUS ]: tx status for nl80211 control port support
		* [ POWERED_ADDR_CHANGE ]: can change MAC address while up

Here is the iw info while it's running (on the working but slow config):

Interface wlan0
	ifindex 22
	wdev 0x300000001
	addr <snip>
	ssid <snip>
	type AP
	wiphy 3
	channel 144 (5720 MHz), width: 20 MHz (no HT), center1: 5720 MHz
	txpower 30.00 dBm
	multicast TXQ:
		qsz-byt	qsz-pkt	flows	drops	marks	overlmt	hashcol	tx-bytes	tx-packets
		0	0	3	0	0	0	0	5300		57

I would really appreciate any help regarding the hostapd configuration, big thanks for any help!

@morrownr
Copy link
Owner

Hi @thememika

Alright. Time to have some fun.

It appears that you provided most of the information needed but one thing seems to be missing: What country are you in? I have to know that so that I know what channels and power settings are allowable.

Here are a couple of initial changes to make to get you started:

Change

wpa=3

to

wpa=2

Why? Read the hostapd docs.

Change

wpa_pairwise=TKIP

to

wpa_pairwise=CCMP

Why? Well, you may think you want TKIP but you really don't.

Standing by for the country.

@thememika
Copy link
Author

thememika commented Feb 12, 2025

@morrownr thank you very much for your reply!
About wpa, do I understand correctly that you were talking about this? (excerpt from android docs)

This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)
# and/or WPA2 (full IEEE 802.11i/RSN):
# bit0 = WPA
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
# Note that WPA3 is also configured with bit1 since it uses RSN just like WPA2.
# In other words, for WPA3, wpa=2 is used the configuration (and
# wpa_key_mgmt=SAE for WPA3-Personal instead of wpa_key_mgmt=WPA-PSK).
#wpa=2

" In other words, for WPA3, wpa=2 is used "

Regarding country, there isn't any limit (you can see in the iw list I posted)

Thanks!^^

@morrownr
Copy link
Owner

Regarding country, there isn't any limit (you can see in the iw list I posted)

You are welcome to not tell me what country you live in. However, without it, I am done. Good luck.

@thememika
Copy link
Author

@morrownr Can you help since I tell you my country? It's EU

@morrownr
Copy link
Owner

Can you help since I tell you my country? It's EU

There is no such country as EU. Information in the regdb is broken out by country. I have little tolerance for being jerked around. At this point, even if you answer my question, I probably won't find time to help until maybe next week or maybe longer.

https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#EU

@thememika
Copy link
Author

thememika commented Feb 14, 2025

@morrownr my country is FI. I've never had the intention to play jokes on you, sorry. I thought that you would assume frequencies which are allowed everywhere in Europe. (and look at this patch suggesting EU to the regdb)

Create entry for united European region, as usage of frequency bands
is harmonized over EU and almost all CEPT countries as well.

More than that, there's also the worldwide registry, which allows only frequencies permitted in all countries. You could just use that one, back when I didn't tell you the country, initially.

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants