git: dd58d03a2a46 - main - rtwn: set the maximum A-MPDU size correctly for RTL8812AU/RTL8821AU
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 08 Jan 2025 02:59:17 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=dd58d03a2a46dddf2ce661d623224a947751beff commit dd58d03a2a46dddf2ce661d623224a947751beff Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-12-17 05:36:02 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2025-01-08 02:32:56 +0000 rtwn: set the maximum A-MPDU size correctly for RTL8812AU/RTL8821AU The vendor driver sets it to 64k or 128k depending upon chipset, along with bit 31 being set in hal/rtl8812a_hal_init.c:SetHwReg8812A(). Differential Revision: https://reviews.freebsd.org/D48118 Obtained from: https://github.com/lwfinger/rtl8812au Reviewed by: bz --- sys/dev/rtwn/rtl8812a/r12a_var.h | 1 + sys/dev/rtwn/rtl8812a/usb/r12au_attach.c | 1 + sys/dev/rtwn/rtl8812a/usb/r12au_init.c | 12 +++++++++++- sys/dev/rtwn/rtl8821a/usb/r21au_attach.c | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/dev/rtwn/rtl8812a/r12a_var.h b/sys/dev/rtwn/rtl8812a/r12a_var.h index 182e6b902758..0a76e013b6a7 100644 --- a/sys/dev/rtwn/rtl8812a/r12a_var.h +++ b/sys/dev/rtwn/rtl8812a/r12a_var.h @@ -99,6 +99,7 @@ struct r12a_softc { int ac_usb_dma_size; int ac_usb_dma_time; int ampdu_max_time; + int ampdu_max_size; }; #define R12A_SOFTC(_sc) ((struct r12a_softc *)((_sc)->sc_priv)) diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c index 84bfcfbda0e8..c87bffb4db19 100644 --- a/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c +++ b/sys/dev/rtwn/rtl8812a/usb/r12au_attach.c @@ -141,6 +141,7 @@ r12a_attach_private(struct rtwn_softc *sc) rs->rs_iq_calib_sw = r12a_iq_calib_sw; rs->ampdu_max_time = 0x70; + rs->ampdu_max_size = 0x1ffff; /* 128k */ sc->sc_priv = rs; } diff --git a/sys/dev/rtwn/rtl8812a/usb/r12au_init.c b/sys/dev/rtwn/rtl8812a/usb/r12au_init.c index ac6a599895ac..1bee2c665657 100644 --- a/sys/dev/rtwn/rtl8812a/usb/r12au_init.c +++ b/sys/dev/rtwn/rtl8812a/usb/r12au_init.c @@ -142,7 +142,17 @@ r12au_init_ampdu(struct rtwn_softc *sc) /* Setup AMPDU aggregation. */ rtwn_write_1(sc, R12A_AMPDU_MAX_TIME, rs->ampdu_max_time); - rtwn_write_4(sc, R12A_AMPDU_MAX_LENGTH, 0xffffffff); + /* + * Note: The vendor driver (hal/rtl8812a_hal_init.c:SetHwReg8812A()) + * also sets bit 31. + */ + /* + * TODO: this should be limited to the peer in STA mode, + * and perhaps the minimum A-MPDU of all VAPs/peers in + * multi-STA / other operating modes. + */ + rtwn_write_4(sc, R12A_AMPDU_MAX_LENGTH, + rs->ampdu_max_size | (1<<31)); /* 80 MHz clock (again?) */ rtwn_write_1(sc, R92C_USTIME_TSF, 0x50); diff --git a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c index 9f0e2c950a1e..175bac8f6fc9 100644 --- a/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c +++ b/sys/dev/rtwn/rtl8821a/usb/r21au_attach.c @@ -141,6 +141,7 @@ r21a_attach_private(struct rtwn_softc *sc) rs->rs_iq_calib_sw = r21a_iq_calib_sw; rs->ampdu_max_time = 0x5e; + rs->ampdu_max_size = 0xffff; /* 64k */ rs->ac_usb_dma_size = 0x01; rs->ac_usb_dma_time = 0x10;