mikaelhg / vpn-ipv6

https://mikaelhg.github.io/vpn-ipv6/
1 stars 0 forks source link

hostapd configuration for 802.11ac #2

Closed mikaelhg closed 2 years ago

mikaelhg commented 4 years ago

I'm only hitting around 320 Mbps on the home gateway device. See if that could be improved.

image

mikaelhg commented 4 years ago

image

80 MHz channels for 802.11ac:

dchao @ https://www.raspberrypi.org/forums/viewtopic.php?t=230168

The problem is "vht_oper_centr_freq_seg1_idx" is not implemented correctly.

If you really want to use channel 149, reuse the variable for seg0, set vht_oper_centr_freq_seg0_idx = 155. When you change back to channel 36, set vht_oper_centr_freq_seg0_idx = 42.

Also the hostapd is quite buggy, do not use automatic channel selection. Set the channel manually.

mikaelhg commented 4 years ago

Kernel 5.8.0 / mainline

20000.354707] usb 6-2: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[20000.378666] usb 6-2: New USB device found, idVendor=0e8d, idProduct=7612, bcdDevice= 1.00
[20000.378676] usb 6-2: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[20000.378682] usb 6-2: Product: Wireless 
[20000.378687] usb 6-2: Manufacturer: MediaTek Inc.
[20000.378692] usb 6-2: SerialNumber: 000000000
[20000.512445] usb 6-2: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[20000.535156] mt76x2u 6-2:1.0: ASIC revision: 76120044
[20000.616098] mt76x2u 6-2:1.0: ROM patch build: 20141115060606a
[20000.804317] mt76x2u 6-2:1.0: Firmware Version: 0.0.00
[20000.804321] mt76x2u 6-2:1.0: Build: 1
[20000.804323] mt76x2u 6-2:1.0: Build Time: 201507311614____
[20001.858853] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
mikaelhg commented 4 years ago

hostapd.conf:

channel=149
# ...
hw_mode=a

ieee80211n=1
ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]

ieee80211ac=1
vht_oper_chwidth=1
vht_capab=[RXLDPC][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP3][SHORT-GI-80][RX-ANTENNA-PATTERN][TX-ANTENNA-PATTERN]
vht_oper_centr_freq_seg0_idx=155

wmm_enabled=1
uapsd_advertisement_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0

tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5
mikaelhg commented 4 years ago

https://en.wikipedia.org/wiki/Jaguar_(microarchitecture)

Targeting builds for Jaguar can be done with the -march=btver2 -mtune=btver2 switches.

CC=clang CFLAGS="-MMD -O2 -Wall -g -march=btver2 -mtune=btver2" LDFLAGS="-fuse-ld=lld" make -j14
CC=gcc CFLAGS="-MMD -O2 -Wall -g -march=btver2 -mtune=btver2" make -j14

Build config: hostapd-2.9/.config

mikaelhg commented 4 years ago

The biggest CPU hog seems to be USB interrupts. Let's see what we can do about that.

mikaelhg commented 4 years ago
echo 0 | sudo tee /proc/sys/net/ipv4/tcp_slow_start_after_idle
ip route | while read p; do sudo ip route change $p initcwnd 20 initrwnd 20; done
mikaelhg commented 4 years ago

WTF? When I unplug the wifi device from one port and plug it into the lower port, the speed immediately almost doubles?

... turns out only one of the blue "USB 3.0" ports on the front is actually USB 3.0.

mikaelhg commented 3 years ago

As per haraldrudell/Linux-WPA3-Personal#1, enabling WPA3 will drop the network speed from 350 Mbps to 250 Mbps.

mikaelhg commented 3 years ago
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0

ssid=XXXXX
wpa_passphrase=XXXXXXXXXXXX
channel=149

country_code=FI
ieee80211d=1

# DFS radar detection
ieee80211h=1
spectrum_mgmt_required=1
local_pwr_constraint=3

interface=wlx00c0caab9f93
driver=nl80211

wpa=2
wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256 SAE

#wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP

rsn_preauth=1
ieee80211w=2

hw_mode=a

ieee80211n=1
ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40]

ieee80211ac=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=155

wmm_enabled=1

rts_threshold=-1
fragm_threshold=-1

beacon_int=100
dtim_period=2
max_num_sta=255

ap_isolate=1