* [PATCH rtw-next v2 0/2] wifi: rtl8xxxu: A-MPDU sessions per station, FCS
@ 2026-12-02 10:57 Mehmet Fide
2026-12-02 10:57 ` [PATCH rtw-next v2 1/2] wifi: rtl8xxxu: keep the A-MPDU session state per station Mehmet Fide
2026-12-02 10:58 ` [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames Mehmet Fide
0 siblings, 2 replies; 5+ messages in thread
From: Mehmet Fide @ 2026-12-02 10:57 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: Jes Sorensen, Martin Kaistra, Kalle Valo, Taehee Yoo,
Andrea Merello, Bitterblue Smith, Georg Müller,
Shreyansh Khajanchi, linux-wireless, mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
Two patches found while testing the RTL8188EU as an access point. The
AP mode series for the 8188e will follow on top of them.
1 keeps the TX block ack sessions per station. They were per device,
so in AP mode only the first station got a block ack session, and the
other stations got aggregated frames without one.
2 lets every chip append the FCS to received frames. Without it the
8188e reports some MPDUs of an A-MPDU 4 bytes short, and with CCMP
they lose 4 bytes of payload. This happens in station mode too.
Tested with an RTL8188EU, rtl8xxxu from rtw-next: as a WPA2 station of
an MT7921AU and of an RTL8822BU AP, as an AP for nine stations with
the AP mode series on top, and as a monitor. I have no other rtl8xxxu
chip, so both patches ran on the RTL8188EU only.
With RTS for an A-MPDU only, the station got the same TCP throughput
as with v1, 11/4.9 against 10.7/4.6 Mbit/s up/down (medians of eight
runs), and the nine stations of the AP 6.9 to 9.1 against 6.8 to 7.6
Mbit/s in total (three runs each).
Patch 2 applies to 6.12.y and later. 6.6.y still has the old file
names and needs a separate backport.
v2:
- 1/2: no Fixes tag, AP mode is a new feature (Ping-Ke)
- 1/2: ampdu_enable is set only for a frame marked with
IEEE80211_TX_CTL_AMPDU, so RTS is on for an A-MPDU only, as in the
vendor drivers; the commented out check is gone (Ping-Ke)
- 1/2: the throughput numbers are gone; they came from single runs that
three runs each on the current rtw-next did not repeat
- 2/2: every chip appends the FCS, and RX_INCLUDES_FCS lets mac80211
remove it, so a monitor interface gets it too (Bitterblue)
- 2/2: the v1 message said that the vendor driver appends the FCS; it
does so only in monitor mode
- 2/2: Closes tag for the report of 2023
- rebased on rtw-next
Mehmet Fide (2):
wifi: rtl8xxxu: keep the A-MPDU session state per station
wifi: rtl8xxxu: append the FCS to received frames
drivers/net/wireless/realtek/rtl8xxxu/core.c | 31 +++++++++----------
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 3 +-
2 files changed, 15 insertions(+), 19 deletions(-)
base-commit: f496c65cc2870f2342ff37736dd31d0748588c72
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH rtw-next v2 1/2] wifi: rtl8xxxu: keep the A-MPDU session state per station
2026-12-02 10:57 [PATCH rtw-next v2 0/2] wifi: rtl8xxxu: A-MPDU sessions per station, FCS Mehmet Fide
@ 2026-12-02 10:57 ` Mehmet Fide
2026-12-02 10:58 ` [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames Mehmet Fide
1 sibling, 0 replies; 5+ messages in thread
From: Mehmet Fide @ 2026-12-02 10:57 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: Jes Sorensen, Martin Kaistra, Kalle Valo, Taehee Yoo,
Andrea Merello, Bitterblue Smith, Georg Müller,
Shreyansh Khajanchi, linux-wireless, mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
rtl8xxxu keeps the TX block ack state per TID for the whole device,
which was enough while it supported station mode only. In AP mode only
the first station that sends on a TID gets a block ack session, and
the frames to every other station still get AGG_ENABLE, as the TID is
marked operational for the device.
Keep the started sessions in rtl8xxxu_sta_info, and set ampdu_enable
only for a frame that mac80211 marks with IEEE80211_TX_CTL_AMPDU.
ampdu_enable also turns on RTS, so a QoS data frame to an HT station
now goes out without RTS when it is not part of an A-MPDU, unless
mac80211 asks for it. The vendor drivers of the 8188eu also turn on
RTS for an A-MPDU only.
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 27 ++++++++-----------
.../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 3 +--
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index f923983bd44f..ceecad84f58c 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -5386,8 +5386,6 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
{
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
- u8 *qc = ieee80211_get_qos_ctl(hdr);
- u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate = 0;
u16 seq_number;
int retries;
@@ -5410,7 +5408,7 @@ rtl8xxxu_fill_txdesc_v1(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT);
- if (ampdu_enable && test_bit(tid, priv->tid_tx_operational))
+ if (ampdu_enable)
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_ENABLE);
else
tx_desc->txdw1 |= cpu_to_le32(TXDESC32_AGG_BREAK);
@@ -5483,8 +5481,6 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
struct rtl8xxxu_txdesc40 *tx_desc40;
- u8 *qc = ieee80211_get_qos_ctl(hdr);
- u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate = 0;
u16 seq_number;
@@ -5506,7 +5502,7 @@ rtl8xxxu_fill_txdesc_v2(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
tx_desc40->txdw9 = cpu_to_le32((u32)seq_number << TXDESC40_SEQ_SHIFT);
- if (ampdu_enable && test_bit(tid, priv->tid_tx_operational))
+ if (ampdu_enable)
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE);
else
tx_desc40->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK);
@@ -5557,8 +5553,6 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
struct rtl8xxxu_priv *priv = hw->priv;
struct device *dev = &priv->udev->dev;
struct rtl8xxxu_ra_info *ra = &priv->ra_info;
- u8 *qc = ieee80211_get_qos_ctl(hdr);
- u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
u32 rate = 0;
u16 seq_number;
@@ -5579,7 +5573,7 @@ rtl8xxxu_fill_txdesc_v3(struct ieee80211_hw *hw, struct ieee80211_hdr *hdr,
tx_desc->txdw3 = cpu_to_le32((u32)seq_number << TXDESC32_SEQ_SHIFT);
- if (ampdu_enable && test_bit(tid, priv->tid_tx_operational))
+ if (ampdu_enable)
tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_ENABLE);
else
tx_desc->txdw2 |= cpu_to_le32(TXDESC40_AGG_BREAK);
@@ -5715,10 +5709,11 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
}
}
- /* (tx_info->flags & IEEE80211_TX_CTL_AMPDU) && */
ampdu_enable = false;
if (ieee80211_is_data_qos(hdr->frame_control) && sta) {
if (sta->deflink.ht_cap.ht_supported) {
+ struct rtl8xxxu_sta_info *sta_info =
+ (struct rtl8xxxu_sta_info *)sta->drv_priv;
u32 ampdu, val32;
u8 *qc = ieee80211_get_qos_ctl(hdr);
u8 tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
@@ -5727,12 +5722,12 @@ static void rtl8xxxu_tx(struct ieee80211_hw *hw,
val32 = ampdu << TXDESC_AMPDU_DENSITY_SHIFT;
tx_desc->txdw2 |= cpu_to_le32(val32);
- ampdu_enable = true;
+ ampdu_enable = tx_info->flags & IEEE80211_TX_CTL_AMPDU;
- if (!test_bit(tid, priv->tx_aggr_started) &&
+ if (!test_bit(tid, sta_info->tx_aggr_started) &&
!(skb->protocol == cpu_to_be16(ETH_P_PAE)))
if (!ieee80211_start_tx_ba_session(sta, tid, 0))
- set_bit(tid, priv->tx_aggr_started);
+ set_bit(tid, sta_info->tx_aggr_started);
}
}
@@ -7281,6 +7276,8 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct device *dev = &priv->udev->dev;
u8 ampdu_factor, ampdu_density;
struct ieee80211_sta *sta = params->sta;
+ struct rtl8xxxu_sta_info *sta_info =
+ (struct rtl8xxxu_sta_info *)sta->drv_priv;
u16 tid = params->tid;
enum ieee80211_ampdu_mlme_action action = params->action;
@@ -7301,13 +7298,11 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_STOP\n", __func__);
rtl8xxxu_set_ampdu_factor(priv, 0);
rtl8xxxu_set_ampdu_min_space(priv, 0);
- clear_bit(tid, priv->tx_aggr_started);
- clear_bit(tid, priv->tid_tx_operational);
+ clear_bit(tid, sta_info->tx_aggr_started);
ieee80211_stop_tx_ba_cb_irqsafe(vif, sta->addr, tid);
break;
case IEEE80211_AMPDU_TX_OPERATIONAL:
dev_dbg(dev, "%s: IEEE80211_AMPDU_TX_OPERATIONAL\n", __func__);
- set_bit(tid, priv->tid_tx_operational);
break;
case IEEE80211_AMPDU_RX_START:
dev_dbg(dev, "%s: IEEE80211_AMPDU_RX_START\n", __func__);
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
index 39bf35cbab2f..293cd5dfee84 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h
@@ -1917,8 +1917,6 @@ struct rtl8xxxu_priv {
u8 pi_enabled:1;
u8 no_pape:1;
u8 int_buf[USB_INTR_CONTENT_LENGTH];
- DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS);
- DECLARE_BITMAP(tid_tx_operational, IEEE80211_NUM_TIDS);
struct ieee80211_vif *vifs[2];
struct delayed_work ra_watchdog;
@@ -1946,6 +1944,7 @@ struct rtl8xxxu_sta_info {
u8 macid;
struct ewma_rssi avg_rssi;
u8 rssi_level;
+ DECLARE_BITMAP(tx_aggr_started, IEEE80211_NUM_TIDS);
};
struct rtl8xxxu_vif {
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames
2026-12-02 10:57 [PATCH rtw-next v2 0/2] wifi: rtl8xxxu: A-MPDU sessions per station, FCS Mehmet Fide
2026-12-02 10:57 ` [PATCH rtw-next v2 1/2] wifi: rtl8xxxu: keep the A-MPDU session state per station Mehmet Fide
@ 2026-12-02 10:58 ` Mehmet Fide
2026-12-04 3:14 ` Ping-Ke Shih
1 sibling, 1 reply; 5+ messages in thread
From: Mehmet Fide @ 2026-12-02 10:58 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: Jes Sorensen, Martin Kaistra, Kalle Valo, Taehee Yoo,
Andrea Merello, Bitterblue Smith, Georg Müller,
Shreyansh Khajanchi, linux-wireless, mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
Without RCR_APPEND_FCS the 8188e reports some MPDUs of an A-MPDU
4 bytes short, while their retries have the right length. With CCMP
such a frame loses the last 4 bytes of its payload when mac80211
strips the MIC.
An RTL8188EU station of an MT7921AU AP with WPA2 got the ARP reply of
the AP 38 bytes long after 5 of 45 connections, and could not reach
the AP. As an AP, with the AP mode patches for it applied, the
RTL8188EU got the ARP requests of two MT7921AU stations short after
21 of 45 connections.
Let every chip append the FCS, and set RX_INCLUDES_FCS so that
mac80211 removes it. A monitor interface then gets the FCS too.
No ARP frame arrived short then, in 45 connections as a station and 45
as an AP. A monitor interface got 300 frames with a correct FCS.
Fixes: 3dfb8e844fa3 ("wifi: rtl8xxxu: Support new chip RTL8188EU")
Closes: https://lore.kernel.org/linux-wireless/bfe732f4-60dd-4d78-1259-5f9f6c11adbc@gmail.com/
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
drivers/net/wireless/realtek/rtl8xxxu/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index ceecad84f58c..4d2475db22c8 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -4179,7 +4179,8 @@ static int rtl8xxxu_init_device(struct ieee80211_hw *hw)
*/
val32 = RCR_ACCEPT_PHYS_MATCH | RCR_ACCEPT_MCAST | RCR_ACCEPT_BCAST |
RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL |
- RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC;
+ RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC |
+ RCR_APPEND_FCS;
rtl8xxxu_write32(priv, REG_RCR, val32);
priv->regrcr = val32;
@@ -8138,6 +8139,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
ieee80211_hw_set(hw, AMPDU_AGGREGATION);
ieee80211_hw_set(hw, MFP_CAPABLE);
+ ieee80211_hw_set(hw, RX_INCLUDES_FCS);
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames
2026-12-02 10:58 ` [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames Mehmet Fide
@ 2026-12-04 3:14 ` Ping-Ke Shih
2026-12-04 6:27 ` Mehmet Fide
0 siblings, 1 reply; 5+ messages in thread
From: Ping-Ke Shih @ 2026-12-04 3:14 UTC (permalink / raw)
To: Mehmet Fide
Cc: Jes Sorensen, Martin Kaistra, Kalle Valo, Taehee Yoo,
Andrea Merello, Bitterblue Smith, Georg Müller,
Shreyansh Khajanchi, linux-wireless@vger.kernel.org,
mehmet.fide@screeningeagle.com
Mehmet Fide <mehmet.fide@gmail.com> wrote:
> From: Mehmet Fide <mehmet.fide@screeningeagle.com>
>
> Without RCR_APPEND_FCS the 8188e reports some MPDUs of an A-MPDU
> 4 bytes short, while their retries have the right length. With CCMP
> such a frame loses the last 4 bytes of its payload when mac80211
> strips the MIC.
>
> An RTL8188EU station of an MT7921AU AP with WPA2 got the ARP reply of
> the AP 38 bytes long after 5 of 45 connections, and could not reach
> the AP. As an AP, with the AP mode patches for it applied, the
> RTL8188EU got the ARP requests of two MT7921AU stations short after
> 21 of 45 connections.
>
> Let every chip append the FCS, and set RX_INCLUDES_FCS so that
> mac80211 removes it. A monitor interface then gets the FCS too.
>
> No ARP frame arrived short then, in 45 connections as a station and 45
> as an AP. A monitor interface got 300 frames with a correct FCS.
>
> Fixes: 3dfb8e844fa3 ("wifi: rtl8xxxu: Support new chip RTL8188EU")
It looks like you focus on RTL8188EU, but your change apply to all chips.
Could you at least test another one to confirm it works as before?
> Closes: https://lore.kernel.org/linux-wireless/bfe732f4-60dd-4d78-1259-5f9f6c11adbc@gmail.com/
> Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
pw-bot: needs-ack
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames
2026-12-04 3:14 ` Ping-Ke Shih
@ 2026-12-04 6:27 ` Mehmet Fide
0 siblings, 0 replies; 5+ messages in thread
From: Mehmet Fide @ 2026-12-04 6:27 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: Jes Sorensen, Martin Kaistra, Kalle Valo, Taehee Yoo,
Andrea Merello, Bitterblue Smith, Georg Müller,
Shreyansh Khajanchi, linux-wireless, mehmet.fide
Hi Ping-Ke,
> It looks like you focus on RTL8188EU, but your change apply to all chips.
>
> Could you at least test another one to confirm it works as before?
Yes. The RTL8188EU is the only rtl8xxxu chip I have here, so I have
ordered a TL-WN823N (RTL8192EU or RTL8192FU, depending on the revision)
and an EW-7611ULB (RTL8723BU). Both use the 24-byte RX descriptor, the
8188e the 16-byte one. They arrive next week; I will test them as
station and as AP, with and without the patch, and send the results in
this thread.
Best regards,
Mehmet
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-04 6:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 10:57 [PATCH rtw-next v2 0/2] wifi: rtl8xxxu: A-MPDU sessions per station, FCS Mehmet Fide
2026-12-02 10:57 ` [PATCH rtw-next v2 1/2] wifi: rtl8xxxu: keep the A-MPDU session state per station Mehmet Fide
2026-12-02 10:58 ` [PATCH rtw-next v2 2/2] wifi: rtl8xxxu: append the FCS to received frames Mehmet Fide
2026-12-04 3:14 ` Ping-Ke Shih
2026-12-04 6:27 ` Mehmet Fide
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox