First of all, thank you so much for making OpenWRT available for TP-Link Archer A7 v5. Everything is working good in version 21.02.1 including SQM over PPPoE WAN interface. The only issue I have is the 2.4 GHz WiFi range seems to be low for this device. Country is "India". Below is my /etc/config/wireless:
You are right. Changing the country code to 'US' for the 2.4 GHz radio allows full 20 dBm TXPOWER. Looks like for 'US' the max allowed TXPOWER is 24 dBm which is higher than 20 dBm allowed for 'IN'. So I restricted the max txpower using 'option txpower' in the config and that seems to work.
Hi Felix @nbd , from what I understand you wrote the ath9k driver. Can you please tell me why the TP-Link Archer A7 v5 is limiting its TXPOWER to 17 dBm rather than max allowed 20 dBm (for Country: India). I tried web searching for answers but couldn't find any. Can you please point me to any document that explains why the TXPOWER is restricted?
I am not seeing similar behavior from a Belkin RT3200 (currently running 22.03-SNAPSHOT) in a different location but in the same city and ISP. The mt76 driver in RT3200 is providing TXPOWER of 20 dBm.
Below is the /etc/config/wireless from the TP-Link Archer A7 v5:
This might be because of limits included in the radio's configuration settings (which might be configured incorrectly). These settings are usually included in a separate mtd partition (e.g. often names "art", "caldata" or similar).
Also there may be an adjustment for the antenna gain (e.g. if your regulations state that you need to have max 20dBm EIRP, and you have a 3dbi gain antenna, then you would need to set the txpower to 17dBm). I'm not sure how the regulatory db actually handles this - because as far as I understand it, some countries specify their max tx power in absolute terms (i.e. "you can transmit at 300mW into any antenna", and some specify it as maximum EIRP (i.e. maximum directional antenna gain is counted into the limit like the 17dBm into a 3dBi antenna = 20dBm EIRP example).
India's wireless-regdb rules were corrected upstream in the latest release dated 2023-05-03. India actually allows upto 30 dBm max txpower (same as USA) but the wireless-regdb upstream had max txpower incorrectly set to 20 dBm for India. This has been corrected now.
However even after this wireless-regdb update, the Archer A7 v5 still only provides 17 dBm max txpower, while "iw" output shows max txpower available as 24 dBm (less than 30 dBm due to router hardware limitation).
Any idea why max txpower is still restricted to 17 dBm? Is this restricted by the ath9k driver based on regulatory domain?
It's also restricted by the firmware.
There are some hardware limits for each modulation/bandwidth, so it could be far less for the high-order modulations. Also, there are some basic regulatory limits inside.
You may try if the latest stock firmware will do anything in terms of update. Modifying it yourself or using the already patched firmware of another device is not recommended. Even some small changes (still complying the regulatory limits) can result a signal distortion which will impact the achievable throughput and may jam any other devices/services in the area. The maximum power level (without distortion) will likely be different even between the antennas of the same device. If your device has external LNAs/PAs (used as a part of the antenna combiners/diplexers) they will still limit the signal levels. So it's unlikely 30dBm to be achievable. Also the 20dBm could be the sum of all the antennas. For example on device having 20dBm with two TX antennas, if you disable the second one you will be possibly limited to 17dBm, since 2x17dBm is 20dBm. So if using fewer TX antennas will reduce it further. Possibly your device is hardware limited to 18dBm per antenna.
As already explained the firmware contains the regulatory data and the power levels for each modulation. Yours is likely outdated. If you remove the radio firmware partition, it won't start. The calibration data inside could be even unique per device. If you bypass it, the radio won't transmit anything useful if you set the TX power to 20dBm for 64QAM for example, so the driver needs this data.
You may check your version of the kernel wireless-regdb for some country matching or close to your current regulations instead using "US". If possible set the 5Ghz radio (separately) to the correct country, since the list of the permitted and the DFS channels is different per country. Failing to set the 5Ghz correctly is likely to break the local regulatory requirements.