patch: misc: rtw88: temporary workarounds

Review patches for information on the subject.
Tested on: BPI-CM4, X96-AIR and Tinkerboard R2

Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
This commit is contained in:
Patrick Yavitz 2023-06-13 18:28:02 -04:00 committed by Igor
parent 61aee9857c
commit bea8a7cde9
7 changed files with 62 additions and 100 deletions

View File

@ -412,19 +412,15 @@ driver_rtw88() {
process_patch_file "${SRC}/patch/misc/rtw88/${version}/001-rtw88-linux-next.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/002-rtw88-linux-next.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/003-rtw88-add-missing-unwind-goto-for_rtw_download_firmware.patch" "applying"
if [[ "$BOARD" == "bananapicm4io" ]]; then
display_alert "Adding" "SDIO RX Aggregation Limiting" "info"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/HACK/001-rtw88-SDIO-RX-aggregation-limiting.patch" "applying"
fi
process_patch_file "${SRC}/patch/misc/rtw88/hack/001-revert-rtw88-sdio-size-and-timout-to-rfc-v1.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/hack/002-rtw88-usb-make-work-queues-high-priority.patch" "applying"
fi
if [[ "$version" == "6.4" ]] && [ $EXTRAWIFI == yes ]; then
display_alert "Adding" "Upstream wireless RTW88 drivers" "info"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/001-rtw88-add-support-for-the-RTL8723DS-SDIO-wifi-chip.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/002-rtw88-add-missing-unwind-goto-for_rtw_download_firmware.patch" "applying"
if [[ "$BOARD" == "bananapicm4io" ]]; then
display_alert "Adding" "SDIO RX Aggregation Limiting" "info"
process_patch_file "${SRC}/patch/misc/rtw88/${version}/HACK/001-rtw88-SDIO-RX-aggregation-limiting.patch" "applying"
fi
process_patch_file "${SRC}/patch/misc/rtw88/hack/001-revert-rtw88-sdio-size-and-timout-to-rfc-v1.patch" "applying"
process_patch_file "${SRC}/patch/misc/rtw88/hack/002-rtw88-usb-make-work-queues-high-priority.patch" "applying"
fi
}

View File

@ -1,23 +0,0 @@
Certain Amlogic SDIO host controllers have a limit of
receiving/transmitting at most 1536 bytes at a time.
It turns out that rtw_sdio_enable_rx_aggregation() from rtw88/sdio.c
is not taking this into account currently.
For any RX buffer that is bigger than 1536 bytes (which can happen due
to RX aggregation) we're unable to do any processing on the host side
because all bytes beyond the 1536 bytes mark are lost.
Lukas found that limiting BIT_RXDMA_AGG_PG_TH to 0x6 makes his
RTL8822CS work on the affected Amlogic SoCs.
diff -Naur a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
--- a/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:25.018357329 -0400
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:29.514273802 -0400
@@ -670,7 +670,7 @@
rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH,
- FIELD_PREP(BIT_RXDMA_AGG_PG_TH, size) |
+ FIELD_PREP(BIT_RXDMA_AGG_PG_TH, 0x6) |
FIELD_PREP(BIT_DMA_AGG_TO_V1, timeout));
rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);

View File

@ -1,23 +0,0 @@
Certain Amlogic SDIO host controllers have a limit of
receiving/transmitting at most 1536 bytes at a time.
It turns out that rtw_sdio_enable_rx_aggregation() from rtw88/sdio.c
is not taking this into account currently.
For any RX buffer that is bigger than 1536 bytes (which can happen due
to RX aggregation) we're unable to do any processing on the host side
because all bytes beyond the 1536 bytes mark are lost.
Lukas found that limiting BIT_RXDMA_AGG_PG_TH to 0x6 makes his
RTL8822CS work on the affected Amlogic SoCs.
diff -Naur a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
--- a/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:25.018357329 -0400
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:29.514273802 -0400
@@ -670,7 +670,7 @@
rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH,
- FIELD_PREP(BIT_RXDMA_AGG_PG_TH, size) |
+ FIELD_PREP(BIT_RXDMA_AGG_PG_TH, 0x6) |
FIELD_PREP(BIT_DMA_AGG_TO_V1, timeout));
rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);

View File

@ -1,23 +0,0 @@
Certain Amlogic SDIO host controllers have a limit of
receiving/transmitting at most 1536 bytes at a time.
It turns out that rtw_sdio_enable_rx_aggregation() from rtw88/sdio.c
is not taking this into account currently.
For any RX buffer that is bigger than 1536 bytes (which can happen due
to RX aggregation) we're unable to do any processing on the host side
because all bytes beyond the 1536 bytes mark are lost.
Lukas found that limiting BIT_RXDMA_AGG_PG_TH to 0x6 makes his
RTL8822CS work on the affected Amlogic SoCs.
diff -Naur a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
--- a/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:25.018357329 -0400
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:29.514273802 -0400
@@ -670,7 +670,7 @@
rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH,
- FIELD_PREP(BIT_RXDMA_AGG_PG_TH, size) |
+ FIELD_PREP(BIT_RXDMA_AGG_PG_TH, 0x6) |
FIELD_PREP(BIT_DMA_AGG_TO_V1, timeout));
rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);

View File

@ -1,23 +0,0 @@
Certain Amlogic SDIO host controllers have a limit of
receiving/transmitting at most 1536 bytes at a time.
It turns out that rtw_sdio_enable_rx_aggregation() from rtw88/sdio.c
is not taking this into account currently.
For any RX buffer that is bigger than 1536 bytes (which can happen due
to RX aggregation) we're unable to do any processing on the host side
because all bytes beyond the 1536 bytes mark are lost.
Lukas found that limiting BIT_RXDMA_AGG_PG_TH to 0x6 makes his
RTL8822CS work on the affected Amlogic SoCs.
diff -Naur a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
--- a/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:25.018357329 -0400
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-11 18:00:29.514273802 -0400
@@ -670,7 +670,7 @@
rtw_write8_set(rtwdev, REG_TXDMA_PQ_MAP, BIT_RXDMA_AGG_EN);
rtw_write16(rtwdev, REG_RXDMA_AGG_PG_TH,
- FIELD_PREP(BIT_RXDMA_AGG_PG_TH, size) |
+ FIELD_PREP(BIT_RXDMA_AGG_PG_TH, 0x6) |
FIELD_PREP(BIT_DMA_AGG_TO_V1, timeout));
rtw_write8_set(rtwdev, REG_RXDMA_MODE, BIT_DMA_MODE);

View File

@ -0,0 +1,30 @@
Certain Amlogic SDIO host controllers have a limit of
receiving/transmitting at most 1536 bytes at a time.
It turns out that rtw_sdio_enable_rx_aggregation() from rtw88/sdio.c
is not taking this into account currently.
For any RX buffer that is bigger than 1536 bytes (which can happen due
to RX aggregation) we're unable to do any processing on the host side
because all bytes beyond the 1536 bytes mark are lost.
Revert size and timout to RFC v1 patch until solution is found.
https://lore.kernel.org/linux-wireless/CAFBinCBaXtebixKbjkWKW_WXc5k=NdGNaGUjVE8NCPNxOhsb2g@mail.gmail.com/T/#u
Signed-off-by: Patrick Yavitz <pyavitz@gxxxx.com>
diff -Naur a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c
--- a/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-13 14:16:07.695892972 -0400
+++ b/drivers/net/wireless/realtek/rtw88/sdio.c 2023-06-13 15:04:26.278383326 -0400
@@ -657,11 +657,11 @@
u8 size, timeout;
if (rtw_chip_wcpu_11n(rtwdev)) {
+ size = 0xff;
+ timeout = 0x20;
+ } else {
size = 0x6;
timeout = 0x6;
- } else {
- size = 0xff;
- timeout = 0x1;
}
/* Make the firmware honor the size limit configured below */

View File

@ -0,0 +1,28 @@
The rtw8822/21cu driver has problems handling high rx or tx rates compared with high
load (such as high I/O) on slower systems.
Examples: i.MX6 SoloX, NanoPi M1 and similar platforms.
https://lore.kernel.org/linux-wireless/20230612134048.321500-1-petter@technux.se/T/#t
Signed-off-by: Patrick Yavitz <pyavitz@gxxxx.com>
diff -Naur a/drivers/net/wireless/realtek/rtw88/usb.c b/drivers/net/wireless/realtek/rtw88/usb.c
--- a/drivers/net/wireless/realtek/rtw88/usb.c 2023-06-13 14:16:07.696892956 -0400
+++ b/drivers/net/wireless/realtek/rtw88/usb.c 2023-06-13 14:17:13.026863229 -0400
@@ -716,7 +716,7 @@
struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev);
int i;
- rtwusb->rxwq = create_singlethread_workqueue("rtw88_usb: rx wq");
+ rtwusb->rxwq = alloc_workqueue("rtw88_usb: rx wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
if (!rtwusb->rxwq) {
rtw_err(rtwdev, "failed to create RX work queue\n");
return -ENOMEM;
@@ -750,7 +750,7 @@
struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev);
int i;
- rtwusb->txwq = create_singlethread_workqueue("rtw88_usb: tx wq");
+ rtwusb->txwq = alloc_workqueue("rtw88_usb: tx wq", WQ_UNBOUND | WQ_HIGHPRI, 0);
if (!rtwusb->txwq) {
rtw_err(rtwdev, "failed to create TX work queue\n");
return -ENOMEM;