This post details my attempt to evaluate enabling ATF on the r7500v2 via my adaptation of castiel652's patch with the current openwrt ATF implementation in mac80211.
Since discovering earlier in this thread that the r7500v2 ath10k wifi firmware & drivers do not support ATF and then subsequently evaluating castiels652's patch to enable ATF, there have been a number of changes to the mac80211 code around ATF (this post and below is a good summary of the issue and resolution - but posts about this issue can be found in various forum threads). Below, I've attempted to use the flent rtt_fair4be test to evaluate the r7500v2 as an AP with and without ATF enabled via the patch.
Since this post is long, I'll report my conclusion at this point. I do not plan to use my adaptation of castiel652's patch going forward. At best, it seems to make little difference. At worst, it may be hampering fairness as measured by the flent rtt_fair4be "fairness" metric.
Here are the details of the test and some selected results:
At this time, master has moved on to kernel 5.15 but most of my prior testing has been on kernel 5.10 (5.10 is very stable for me). Hence I'm using a custom 22.03 "snapshot" build with my adaptation of castiel652's patch applied to kmod-ath10k-ct - 5.10.149+2022-05-13-f808496f-2 driver (firmware is ath10k-firmware-qca99x0-ct-htt - 2020-11-08-1). mac80211 is kmod-mac80211 - 5.10.149+5.15.74-1-1.
r7500v2 # uname -a
Linux r7500v2 5.10.149 #0 SMP Tue Nov 1 12:20:10 2022 armv7l GNU/Linux
For testing ATF, 4 wifi clients were configured as netperf "servers" and a lan device was used to run the flent rtt_fair4be test to these clients. The r7500v2 is configured as an AP only, 5 GHz wifi, channel 36, (up to) 80 MHz width, AQL enabled for all tests. There are no other wifi clients connected (including 2.4 GHz) and 5 GHz channel 36 has little to no interference from other wifi networks in my area.
On the r7500v2, I edited the vht_capab
config entry in /var/run/hostapd-phy0.conf
to add [BF-ANTENNA-2][BF-ANTENNA-3][SOUNDING-DIMENSION-2][SOUNDING-DIMENSION-3]
and remove [BF-ANTENNA-4][SOUNDING-DIMENSION-4]
followed by kill -HUP $(pidof hostapd)
and then reconnecting the 4 wifi clients. The reason for changing the hostapd config is detailed here. I don't think this should make a difference, but this is consistent with prior tests and I think [BF-ANTENNA-4][SOUNDING-DIMENSION-4]
is not supported by the r7500v2.
I tested two different location arrangements of the 4 wifi clients. One is "ideal": all 4 clients 2-3 meters with a clear line of sight to the AP. One is "actual" or "non-ideal" (i.e. how wifi clients are actually distributed in my household). 2 clients 10-15 meters from the AP, no line of site (blocked by wood frame drywall covered walls). 2 clients 2-5 meters from the AP with a clear line of site. One (fast) client is a macbook air with an updated os. I did run sudo ifconfig awdl0 down
on the mac. The other three clients are older model laptops with intel wifi cards running an updated ubuntu 20.04.5 lts os.
For tests using ATF, on the r7500v2 I ran
echo "alternate_atf = 1" >/lib/firmware/ath10k/fwcfg-pci-0000:01:00.0.txt
echo "alternate_atf = 1" >/lib/firmware/ath10k/fwcfg-pci-0001:01:00.0.txt
rebooted the AP, updated the hostapd config as mentioned above, and connected the wifi clients.
For tests without ATF, on the r7500v2 I removed the fwcfg-*.txt files rebooted the AP, updated the hostapd config as mentioned above, and connected the wifi clients.
On an AP lan device, I used the following flent command:
flent rtt_fair4be -H <wifi_host_1> -H <wifi_host_2> -H <wifi_host_3> -H <wifi_host4> --test-parameter=cpu_stats_hosts=root@r7500v2 -t woatf >> sum-20221108.txt
adjusting the -t <test-name>
for tests with ATF (watf) and without ATF (woatf) for the ideal arrangement. I used watf-1 woatf-1 for the non-ideal arrangement.
I ran 10 sequential 70 second flent tests for each configuration and recorded the "TCP download fairness" and "TCP upload fairness" metric from the sum-20221108.txt file. 40 tests total. The wifi clients were not moved between tests with and without ATF for different spacial arrangements.
The following show the python code (with data), analysis, and output.
import numpy as np
from scipy.stats import ttest_ind
# rtt_fair4be*.watf.flent.gz = ideal_watf_5_up_fairness
# rtt_fair4be*.woatf.flent.gz = ideal_woatf_5_up_fairness
# rtt_fair4be*.watf-1.flent.gz = nonideal_watf_5_up_fairness
# rtt_fair4be*.woatf-1.flent.gz = nonideal_woatf_5_up_fairness
ideal_woatf_5_down_fairness = [0.65, 0.77, 0.74, 0.83, 0.6, 0.69, 0.57, 0.88, 0.84, 0.87]
ideal_woatf_5_up_fairness = [0.82, 0.84, 0.75, 0.71, 0.88, 0.9, 0.86, 0.8, 0.92, 0.74]
ideal_watf_5_down_fairness = [0.8, 0.78, 0.72, 0.74, 0.86, 0.84, 0.6, 0.66, 0.61, 0.67]
ideal_watf_5_up_fairness = [0.75, 0.78, 0.64, 0.55, 0.64, 0.5, 0.71, 0.82, 0.81, 0.87]
ideal_woatf_5_down_fairness = np.array(ideal_woatf_5_down_fairness)
ideal_woatf_5_up_fairness = np.array(ideal_woatf_5_up_fairness)
ideal_watf_5_down_fairness = np.array(ideal_watf_5_down_fairness)
ideal_watf_5_up_fairness = np.array(ideal_watf_5_up_fairness)
print("ideal woatf 5GHz down fairness ave: %f" % ideal_woatf_5_down_fairness.mean())
print("ideal woatf 5GHz down fairness stdev: %f" % ideal_woatf_5_down_fairness.std())
print("ideal woatf 5GHz up fairness ave: %f" % ideal_woatf_5_up_fairness.mean())
print("ideal woatf 5GHz up fairness stdev: %f" % ideal_woatf_5_up_fairness.std())
print("ideal watf 5GHz down fairness ave: %f" % ideal_watf_5_down_fairness.mean())
print("ideal watf 5GHz down fairness stdev: %f" % ideal_watf_5_down_fairness.std())
print("ideal watf 5GHz up fairness ave: %f" % ideal_watf_5_up_fairness.mean())
print("ideal watf 5GHz up fairness stdev: %f" % ideal_watf_5_up_fairness.std())
ttest_ideal_w_wo_atf_down = ttest_ind(ideal_woatf_5_down_fairness.reshape(ideal_woatf_5_down_fairness.size,1),
ideal_watf_5_down_fairness.reshape(ideal_watf_5_down_fairness.size,1))
ttest_ideal_w_wo_atf_up = ttest_ind(ideal_woatf_5_up_fairness.reshape(ideal_woatf_5_up_fairness.size,1),
ideal_watf_5_up_fairness.reshape(ideal_watf_5_up_fairness.size,1))
nonideal_watf_5_down_fairness = [0.52, 0.43, 0.62, 0.76, 0.47, 0.44, 0.53, 0.5, 0.49, 0.48]
nonideal_watf_5_up_fairness = [0.65, 0.54, 0.64, 0.51, 0.49, 0.65, 0.72, 0.58, 0.51, 0.56]
nonideal_woatf_5_down_fairness = [0.62, 0.67, 0.65, 0.73, 0.72, 0.73, 0.69, 0.65, 0.67, 0.59]
nonideal_woatf_5_up_fairness = [0.61, 0.63, 0.63, 0.74, 0.68, 0.72, 0.74, 0.65, 0.43, 0.46]
nonideal_woatf_5_down_fairness = np.array(nonideal_woatf_5_down_fairness)
nonideal_woatf_5_up_fairness = np.array(nonideal_woatf_5_up_fairness)
nonideal_watf_5_down_fairness = np.array(nonideal_watf_5_down_fairness)
nonideal_watf_5_up_fairness = np.array(nonideal_watf_5_up_fairness)
print("nonideal woatf 5GHz down fairness ave: %f" % nonideal_woatf_5_down_fairness.mean())
print("nonideal woatf 5GHz down fairness stdev: %f" % nonideal_woatf_5_down_fairness.std())
print("nonideal woatf 5GHz up fairness ave: %f" % nonideal_woatf_5_up_fairness.mean())
print("nonideal woatf 5GHz up fairness stdev: %f" % nonideal_woatf_5_up_fairness.std())
print("nonideal watf 5GHz down fairness ave: %f" % nonideal_watf_5_down_fairness.mean())
print("nonideal watf 5GHz down fairness stdev: %f" % nonideal_watf_5_down_fairness.std())
print("nonideal watf 5GHz up fairness ave: %f" % nonideal_watf_5_up_fairness.mean())
print("nonideal watf 5GHz up fairness stdev: %f" % nonideal_watf_5_up_fairness.std())
ttest_nonideal_w_wo_atf_down = ttest_ind(nonideal_woatf_5_down_fairness.reshape(nonideal_woatf_5_down_fairness.size,1),
nonideal_watf_5_down_fairness.reshape(nonideal_watf_5_down_fairness.size,1))
ttest_nonideal_w_wo_atf_up = ttest_ind(nonideal_woatf_5_up_fairness.reshape(nonideal_woatf_5_up_fairness.size,1),
nonideal_watf_5_up_fairness.reshape(nonideal_watf_5_up_fairness.size,1))
Output
%run analysis.py
ideal woatf 5GHz down fairness ave: 0.744000
ideal woatf 5GHz down fairness stdev: 0.106977
ideal woatf 5GHz up fairness ave: 0.822000
ideal woatf 5GHz up fairness stdev: 0.067646
ideal watf 5GHz down fairness ave: 0.728000
ideal watf 5GHz down fairness stdev: 0.087384
ideal watf 5GHz up fairness ave: 0.707000
ideal watf 5GHz up fairness stdev: 0.115590
nonideal woatf 5GHz down fairness ave: 0.672000
nonideal woatf 5GHz down fairness stdev: 0.044452
nonideal woatf 5GHz up fairness ave: 0.629000
nonideal woatf 5GHz up fairness stdev: 0.102220
nonideal watf 5GHz down fairness ave: 0.524000
nonideal watf 5GHz down fairness stdev: 0.093509
nonideal watf 5GHz up fairness ave: 0.585000
nonideal watf 5GHz up fairness stdev: 0.072560
ttest_nonideal_w_wo_atf_up
Out[6]: Ttest_indResult(statistic=array([1.0530053]), pvalue=array([0.30626963]))
ttest_nonideal_w_wo_atf_down
Out[7]: Ttest_indResult(statistic=array([4.28830412]), pvalue=array([0.00044242]))
ttest_ideal_w_wo_atf_down
Out[8]: Ttest_indResult(statistic=array([0.34749779]), pvalue=array([0.7322476]))
ttest_ideal_w_wo_atf_up
Out[9]: Ttest_indResult(statistic=array([2.57599011]), pvalue=array([0.01903518]))
Given the test configuration (lan device running flent rtt_fair4be out to 4 wifi hosts running netserver), I believe the average "TCP upload fairness" metric should evaluate if enabling ATF on the r7500v2 (at least the way as described in this thread) is beneficial or not. It's my understanding that a "fairness" result close to 1 is considered "fair" and values less than 1 are less fair.
Using a t-test to check if the average "TCP upload fairness" with and without ATF enabled are statistically different, for the ideal case the p value is less than 0.05 indicating the averages are different at the 95% confidence level. Given the average "fairness" is less with ATF enabled, this is not the result I hoped for.
For the non ideal case, the average "TCP upload fairness" is also less fair with ATF enabled (again not what I hoped for), but it is not statistically significant at the 95% confidence level.
It has been suggested that wifi rate control in the r7500v2 wifi firmware/hardware might be responsible for the observations that started this thread (more about that in my next post). On the r7500v2 (from the lan device) during the flent testing, I periodically ran:
printf "woatf-1: " >> /tmp/sum-rap-20221108.txt && date >> /tmp/sum-rap-20221108.txt && iw dev wlan0 station dump | grep "tx bitrate" >> /tmp/sum-rap-20221108.txt
I did not observe changes in MCS values that might indicate such issues (like I have in other testing); however, the macbook client did change during the tests (this client was moved to a non line of site location for the non-ideal test arrangement). Some MCS output excerpts:
r7500v2 # cat /tmp/sum-rap-20221108.txt
woatf: Tue Nov 8 10:13:01 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
woatf: Tue Nov 8 10:19:20 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
watf: Tue Nov 8 10:59:00 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
watf: Tue Nov 8 11:06:30 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
watf: Tue Nov 8 11:06:39 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 866.7 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
watf-1: Tue Nov 8 11:18:55 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 650.0 MBit/s VHT-MCS 7 80MHz short GI VHT-NSS 2
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
watf-1: Tue Nov 8 11:20:37 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 650.0 MBit/s VHT-MCS 7 80MHz short GI VHT-NSS 2
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
watf-1: Tue Nov 8 11:30:16 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 360.0 MBit/s VHT-MCS 8 40MHz short GI VHT-NSS 2
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
watf-1: Tue Nov 8 11:30:24 EST 2022
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
tx bitrate: 360.0 MBit/s VHT-MCS 8 40MHz short GI VHT-NSS 2
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
woatf-1: Tue Nov 8 11:50:50 EST 2022
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 585.1 MBit/s VHT-MCS 6 80MHz short GI VHT-NSS 2
tx bitrate: 243.0 MBit/s MCS 14 40MHz
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
woatf-1: Tue Nov 8 11:52:17 EST 2022
tx bitrate: 216.0 MBit/s MCS 13 40MHz
tx bitrate: 300.0 MBit/s VHT-MCS 7 40MHz short GI VHT-NSS 2
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
woatf-1: Tue Nov 8 11:52:41 EST 2022
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 300.0 MBit/s VHT-MCS 7 40MHz short GI VHT-NSS 2
tx bitrate: 270.0 MBit/s MCS 14 40MHz short GI
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
woatf-1: Tue Nov 8 11:55:24 EST 2022
tx bitrate: 240.0 MBit/s MCS 13 40MHz short GI
tx bitrate: 270.0 MBit/s VHT-MCS 6 40MHz short GI VHT-NSS 2
tx bitrate: 243.0 MBit/s MCS 14 40MHz
tx bitrate: 300.0 MBit/s MCS 15 40MHz short GI
I have to look over the flent results in detail to see what might be going on in the non-ideal case. Even if wifi rate control is affecting the non-ideal flent results, ATF is still of little use to me since it doesn't help in the "ideal" or "real world" use test arrangement.
sigh...
blaming wifi rate control is easy to do but hard (possbily impossible) to show or fix. More about that below. I did have hope for ATF - it seems I'm better off without it.