From: Mehmet Fide <mehmet.fide@gmail.com>
To: Ping-Ke Shih <pkshih@realtek.com>
Cc: "Jes Sorensen" <Jes.Sorensen@gmail.com>,
"Martin Kaistra" <martin.kaistra@linutronix.de>,
"Kalle Valo" <kvalo@kernel.org>,
"Taehee Yoo" <ap420073@gmail.com>,
"Andrea Merello" <andrea.merello@gmail.com>,
"Bitterblue Smith" <rtl8821cerfe2@gmail.com>,
"Georg Müller" <georgmueller@gmx.net>,
"Shreyansh Khajanchi" <hi@shreyan.sh>,
linux-wireless@vger.kernel.org, mehmet.fide@screeningeagle.com
Subject: [PATCH rtw-next v2 1/2] wifi: rtl8xxxu: keep the A-MPDU session state per station
Date: Wed, 2 Dec 2026 11:57:59 +0100 [thread overview]
Message-ID: <20261202105800.2584278-2-mehmet.fide@gmail.com> (raw)
In-Reply-To: <20261202105800.2584278-1-mehmet.fide@gmail.com>
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
next prev parent reply other threads:[~2026-12-02 10:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=20261202105800.2584278-2-mehmet.fide@gmail.com \
--to=mehmet.fide@gmail.com \
--cc=Jes.Sorensen@gmail.com \
--cc=andrea.merello@gmail.com \
--cc=ap420073@gmail.com \
--cc=georgmueller@gmx.net \
--cc=hi@shreyan.sh \
--cc=kvalo@kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=martin.kaistra@linutronix.de \
--cc=mehmet.fide@screeningeagle.com \
--cc=pkshih@realtek.com \
--cc=rtl8821cerfe2@gmail.com \
/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