[PATCH AUTOSEL 6.19-6.18] wifi: rtw89: setting TBTT AGG number when mac port initialization

Sasha Levin
2026-02-14T21:25:28Z

From: Chih-Kang Chang <gary.chang@realtek.com>

[ Upstream commit 5e5f83fba48381098b26a8b2513a6d5fc5c66ccb ]

When initializing mac port, needs to set TBTT AGG number to trigger TBTT
related interrupts. Otherwise, after sending join info H2C command with
disconnection mode, firmware will clear TBTT AGG number. Without the
setting from mac port initialization after that, this port will not be
able to transmit beacons.

Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251223030651.480633-12-pkshih@realtek.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

The `tbtt_agg` field has been part of the port register structure since
the initial driver addition. The register mask `B_AX_TBTT_AGG_NUM_MASK`
also exists. This means all necessary infrastructure is already in
stable trees.

### User Impact

This affects users running the rtw89 WiFi driver (Realtek 802.11ax
cards) in AP mode or any mode that requires beacon transmission. After a
disconnect/reconnect cycle, beacons stop being transmitted, making the
wireless interface non-functional for AP operations. This is a
significant functionality loss.

### Assessment

**Meets stable criteria:**
- **Obviously correct**: The function follows the exact same trivial
pattern as all other port config functions
- **Fixes a real bug**: Beacon transmission failure after
disconnect/reconnect
- **Small and contained**: ~15 lines, 1 file, mechanical pattern
- **No new features**: This restores expected behavior (setting a
hardware register during initialization)
- **No new APIs**: Internal driver change only
- **Low risk**: Uses existing register definitions and write helpers

**Concerns:**
- The commit is part of a series (patch 12 of a series based on the
Link), but it appears self-contained - it only adds a new function and
calls it. No dependencies on other patches in the series.
- The code is simple and the pattern is well-established in this driver.

The fix is small, surgical, restores critical WiFi AP functionality, and
follows established patterns in the driver. It meets all stable kernel
criteria.

**YES**

drivers/net/wireless/realtek/rtw89/mac.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index b4c292c7e829d..6734e5d5a5e22 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -4341,6 +4341,7 @@ static void rtw89_mac_bcn_drop(struct rtw89_dev *rtwdev,
#define BCN_HOLD_DEF 200
#define BCN_MASK_DEF 0
#define TBTT_ERLY_DEF 5
+#define TBTT_AGG_DEF 1
#define BCN_SET_UNIT 32
#define BCN_ERLY_SET_DLY (10 * 2)

@@ -4644,6 +4645,16 @@ static void rtw89_mac_port_cfg_tbtt_early(struct rtw89_dev *rtwdev,
B_AX_TBTTERLY_MASK, TBTT_ERLY_DEF);
}

+static void rtw89_mac_port_cfg_tbtt_agg(struct rtw89_dev *rtwdev,
+ struct rtw89_vif_link *rtwvif_link)
+{
+ const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;
+ const struct rtw89_port_reg *p = mac->port_base;
+
+ rtw89_write16_port_mask(rtwdev, rtwvif_link, p->tbtt_agg,
+ B_AX_TBTT_AGG_NUM_MASK, TBTT_AGG_DEF);
+}
+
static void rtw89_mac_port_cfg_bss_color(struct rtw89_dev *rtwdev,
struct rtw89_vif_link *rtwvif_link)
{
@@ -4904,6 +4915,7 @@ int rtw89_mac_port_update(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvi
rtw89_mac_port_cfg_bcn_hold_time(rtwdev, rtwvif_link);
rtw89_mac_port_cfg_bcn_mask_area(rtwdev, rtwvif_link);
rtw89_mac_port_cfg_tbtt_early(rtwdev, rtwvif_link);
+ rtw89_mac_port_cfg_tbtt_agg(rtwdev, rtwvif_link);
rtw89_mac_port_cfg_bss_color(rtwdev, rtwvif_link);
rtw89_mac_port_cfg_mbssid(rtwdev, rtwvif_link);
rtw89_mac_port_cfg_func_en(rtwdev, rtwvif_link, true);
--
2.51.0