greearb / ath10k-ct

Stand-alone ath10k driver based on Candela Technologies Linux kernel.
111 stars 41 forks source link

qca9980 lacks airtime fariness support indication #195

Closed ghost closed 2 years ago

ghost commented 2 years ago

ath10k-ct driver/firmware for the r7500v2 running openwrt do not indicate airtime fairness support. i.e.

r7500v2 # cat /sys/kernel/debug/ieee80211/phy0/ath10k/wmi_services | grep -E '(AIRTIME|PEER_STATS)'
WMI_SERVICE_PEER_STATS                   -
WMI_SERVICE_REPORT_AIRTIME               -

and NL80211_EXT_FEATURE_AIRTIME_FAIRNESS is not set. This is the same for the more than 5 year old openwrt default non-ct qca9980 firmware when using the ath10k-ct driver. Both values are apparently enabled for qca9984 devices using the ath10k (non ct) driver/firmware - see here.

Outside of ath10k-ct, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS is used by iw i.e.

r7500v2 # iw dev wlan0 station set <mac_address> airtime_weight 512
command failed: Not supported (-95)

ATF debugging files /sys/kernel/debug/ieee80211/phy0/airtime and airtime_flags are not present, and obviously there is no indication of ATF support under "Supported extended features" from iw list.

If I force setting NL80211_EXT_FEATURE_AIRTIME_FAIRNESS in the ath10k-ct driver, the above iw commands work and the ATF debugging files show up.

It does not seem possible to not use ATF in openwrt master for this device (at least setting airtime_mode=0 in the hostapd conf files followed by kill -HUP $(pidof hostapd) does not look like it disables ATF - hard for me to assess).

This is making troubleshooting issues that might be related to ATF difficult (openwrt forum thread here).

As I'm sure you are aware, a disabled WMI_SERVICE_PEER_STATS results in ath10k_peer_stats_enabled(ar) evaluating to false bypassing any functionality in the ath10k-ct driver dependent on them. E.g. peer_stats does not show up in /sys/kernel/debug/ieee80211/phy0/ath10k. I'm uncertain if either of these items contribute to ATF.

Last, if i cat /sys/kernel/debug/ieee80211/phy0/ath10k/fw_stats I only see peer stats for one less than the number of connected peers. Not sure if this is related at all to the above.

Software (OS, Firmware version, kernel, driver, etc) Openwrt (master with PR #4036 - dsa support).

r7500v2 # uname -a
Linux r7500v2 5.10.78 #0 SMP Mon Nov 8 23:13:10 2021 armv7l GNU/Linux

r7500v2 # opkg list | grep ath10k
ath10k-board-qca99x0 - 20210511-1
ath10k-firmware-qca99x0-ct-full-htt - 2020-11-08-1
kmod-ath10k-ct - 5.10.78+2021-09-22-e6a7d5b5-1

Hardware (NIC chipset, platform, etc) r7500v2, qca9980

Logs (dmesg, maybe supplicant and/or hostap) See description, I can provide logs or other info by request.

greearb commented 2 years ago

ath10k-ct firmware plus driver reports proper tx-status for every frame transmitted (and rx-status for received frames0. This means the mac80211 stack can calculate the airtime used (close enough at least) and thus can make decisions at queueing level to enforce ATF. I do not know if stack currently can do this or not, but I suspect it can since ath9k and older mtk radios would need and use similar support. Please see if that can somehow be enabled for ath10k-ct. I have no interest compiling back in the ATF code in ath10k-firmware, it was sketchy at best. Nor will I compile in more peer stats logic, since that can also be calculated at driver level and above as needed.

ghost commented 2 years ago

I have no interest compiling back in the ATF code in ath10k-firmware, it was sketchy at best. Nor will I compile in more peer stats logic, since that can also be calculated at driver level and above as needed.

I understand. Does it make sense to change (in mac.c)

if (ath10k_peer_stats_enabled(ar) || test_bit(WMI_SERVICE_REPORT_AIRTIME, ar->wmi.svc_map)) 
    wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);

to

wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS);

so that NL80211_EXT_FEATURE_AIRTIME_FAIRNESS is always set, iw functions as expected for ATF, airtime debug files show up, and iw list output is consistent amoung devices? Or should i make a bug report about the potential difference in states for this variable to openwrt?

EDIT: Also would you like a separate bug report for the fw_stats behavior I mentioned above?