opnsense-src/sys/dev/rtwn
Adrian Chadd 0ea7f8ca66 rtwn: try enforcing net80211 regulatory / txpower limits for 11n chips
This is an attempt to reverse engineer what the actual transmit power
calculations are doing and apply net80211 limits on them.  It doesn't
look as simple as just applying the check at the end - there are plenty
of places where offsets are calculated between different PHY modes and
1 / 2 antenna MCS transmit rates.

There are also some places where the offset being added is negative,
so handle the potential underflow so when things hit 0, they don't
just wrap and cause the maximum transmit power into the registers.

This is being done to aide in power/performance debugging - if there
are issues with the transmit power being wrongly calculated and are too
high, the output waveform will be distorted and it will effect performance.
Being able to drop the transmit power by a few dB here and there can
quickly identify if this is happening (because suddenly higher MCS
rates / OFDM rates suddenly work better!)

I've tested each NIC through the transmit power values from 0 dBm
to 30dBm via ifconfig (and they're all capped far before that,
normally around 20-25dBm) and they're not underflowing.

Locally tested:

* RTL8192CU, STA
* RTL8192EU, STA
* RTL8188EU, STA

Differential Revision:	https://reviews.freebsd.org/D47987
Reviewed by:	bz, imp
2024-12-18 15:46:15 -08:00
..
pci rtwn: add placeholder for the per-MACID rate report 2024-12-06 16:22:47 -08:00
rtl8188e rtwn: try enforcing net80211 regulatory / txpower limits for 11n chips 2024-12-18 15:46:15 -08:00
rtl8192c rtwn: try enforcing net80211 regulatory / txpower limits for 11n chips 2024-12-18 15:46:15 -08:00
rtl8192e rtwn: try enforcing net80211 regulatory / txpower limits for 11n chips 2024-12-18 15:46:15 -08:00
rtl8812a rtwn: add APIs for setting transmit power 2024-12-18 15:45:24 -08:00
rtl8821a rtwn: add APIs for setting transmit power 2024-12-18 15:45:24 -08:00
usb rtwn: add placeholder for the per-MACID rate report 2024-12-06 16:22:47 -08:00
if_rtwn.c rtwn: add APIs for setting transmit power 2024-12-18 15:45:24 -08:00
if_rtwn_beacon.c sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
if_rtwn_beacon.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_calib.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_calib.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_cam.c net80211: migrate the group/unicast key check into inline functions 2024-07-15 11:45:30 -07:00
if_rtwn_cam.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_debug.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_efuse.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_efuse.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_fw.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_fw.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
if_rtwn_nop.h rtwn: add APIs for setting transmit power 2024-12-18 15:45:24 -08:00
if_rtwn_ridx.h rtwn: expand the ridx numbers to include VHT; add accessor macros 2024-12-06 23:13:50 -08:00
if_rtwn_rx.c rtwn: don't do 64 bit TSF extension by default 2024-12-04 23:27:46 -08:00
if_rtwn_rx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_task.c sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
if_rtwn_task.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwn_tx.c rtwn: ensure TX work isn't scheduled during reset / abort 2024-11-08 08:26:05 -08:00
if_rtwn_tx.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
if_rtwnreg.h rtwn: add VHT awareness to rtwn_chan2centieee() 2024-12-06 23:14:20 -08:00
if_rtwnvar.h rtwn: add APIs for setting transmit power 2024-12-18 15:45:24 -08:00