From: Rosen Penev <rosenp@gmail.com>
To: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH wireless-next 3/3] wifi: rt2800usb: don't hold every TX frame until its status is read
Date: Sat, 21 Nov 2026 23:03:42 -0800 [thread overview]
Message-ID: <20261122070342.101054-4-rosenp@gmail.com> (raw)
In-Reply-To: <20261122070342.101054-1-rosenp@gmail.com>
rt2800usb reads TX_STA_FIFO with one control transfer per report, and
keeps each frame in its 16 entry TX queue until its report has been
read, so the TX rate is bound to the latency of control transfers.
On the AMD X470 chipset USB 2.0 ports, each control transfer to an
RT3070 takes 3 ms or more (the host retries an endpoint that NAKs only
every few ms; the CPU's own xHCI does that within 0.25 ms). Pipelining
reads doesn't help, the host still serves one transfer per 3 ms. TX
there is limited to about 300 frames per second.
Enable REQUIRE_TXSTATUS_SAMPLING: complete frames that don't need their
status when the URB is done, read the FIFO while samples or waiting
frames are outstanding, and give the sample slots back only when the
FIFO is found empty.
RT3070 as station on an X470 chipset port, MT7612U AP, channel 6 HT20,
WPA2-CCMP, median of three 15 s iperf3 runs:
before after
TCP TX 3.4 Mbit/s, ~340 retr 37.8 Mbit/s, 1-8 retr
UDP TX (60M sent) 8.9 Mbit/s, 60% loss 43.8 Mbit/s, 0% loss
TCP RX 10.2 Mbit/s 29.8 Mbit/s
minstrel_ht keeps getting samples with retries at all rates and picks
MCS7. A GTK rekey every 10 s during 60 s of saturating TX with an
A-MPDU session completes every time, without TX status timeouts. WPA2
(CCMP, TKIP, mixed) and SAE connect in both station and AP mode.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
.../net/wireless/ralink/rt2x00/rt2800usb.c | 27 ++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
index 15de3db12429..5dd849e3dde5 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c
@@ -104,6 +104,14 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,
}
valid = rt2x00_get_field32(tx_status, TX_STA_FIFO_VALID);
+
+ /*
+ * Rate control samples may produce more than one report each (A-MPDU),
+ * so the sample slots are only given back once the FIFO is empty.
+ */
+ if (!valid)
+ atomic_set(&rt2x00dev->txstatus_samples, 0);
+
if (valid) {
if (!kfifo_put(&rt2x00dev->txstatus_fifo, tx_status))
rt2x00_warn(rt2x00dev, "TX status FIFO overrun\n");
@@ -156,7 +164,12 @@ static void rt2800usb_tx_dma_done(struct queue_entry *entry)
{
struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
- rt2800usb_async_read_tx_status(rt2x00dev);
+ if (test_bit(ENTRY_DATA_NO_TXSTATUS, &entry->flags))
+ queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);
+
+ if (!test_bit(ENTRY_DATA_NO_TXSTATUS, &entry->flags) ||
+ test_bit(ENTRY_DATA_TXSTATUS_SAMPLE, &entry->flags))
+ rt2800usb_async_read_tx_status(rt2x00dev);
}
static enum hrtimer_restart rt2800usb_tx_sta_fifo_timeout(struct hrtimer *timer)
@@ -458,11 +471,15 @@ static void rt2800usb_work_txdone(struct work_struct *work)
struct rt2x00_dev *rt2x00dev =
container_of(work, struct rt2x00_dev, txdone_work);
+ rt2800_txdone_unreported(rt2x00dev);
+
while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) ||
rt2800_txstatus_timeout(rt2x00dev)) {
rt2800_txdone(rt2x00dev, UINT_MAX);
+ rt2800_txdone_unreported(rt2x00dev);
+
rt2800_txdone_nostatus(rt2x00dev);
/*
@@ -615,6 +632,14 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
if (retval)
return retval;
+ /*
+ * Each TX status read is a USB control transfer, which can take
+ * several milliseconds. Holding every frame until its status has
+ * been read caps TX at one frame per transfer, so only frames that
+ * need a status wait for it.
+ */
+ __set_bit(REQUIRE_TXSTATUS_SAMPLING, &rt2x00dev->cap_flags);
+
/*
* Set txstatus timer function.
*/
--
2.56.1
prev parent reply other threads:[~2026-11-22 7:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 7:03 [PATCH wireless-next 0/3] wifi: rt2800usb: don't wait for every TX status Rosen Penev
2026-11-22 7:03 ` [PATCH wireless-next 1/3] wifi: rt2x00: add a mode that doesn't " Rosen Penev
2026-11-22 7:03 ` [PATCH wireless-next 2/3] wifi: rt2800: support TX status sampling Rosen Penev
2026-11-22 7:03 ` Rosen Penev [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261122070342.101054-4-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=stf_xl@wp.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox