* [PATCH rtw-next v2] wifi: rtw88: program the beacon interval
@ 2026-11-17 10:14 Mehmet Fide
2026-11-17 12:30 ` Luka Gejak
0 siblings, 1 reply; 2+ messages in thread
From: Mehmet Fide @ 2026-11-17 10:14 UTC (permalink / raw)
To: Ping-Ke Shih
Cc: Luka Gejak, Bitterblue Smith, Yan-Hsuan Chuang, Kalle Valo,
Stanislaw Gruszka, Brian Norris, linux-wireless, linux-kernel,
mehmet.fide
From: Mehmet Fide <mehmet.fide@screeningeagle.com>
The driver never writes the beacon interval register, so the hardware
keeps its default of 100 TU. An AP or IBSS started with another
interval says that interval in its beacons and sends them 100 TU apart.
With beacon_int=200 in hostapd the beacons of an RTL8822CE, RTL8822CU,
RTL8822BU and RTL8821CU are 102.4 ms apart on the air. The same holds
for an IBSS joined with a beacon interval of 200 on an RTL8822CE and
RTL8822BU.
Write the interval when mac80211 sets it for an AP or IBSS interface.
Both beacon from port 0: rtw_core_port_switch() moves an AP there, and
an IBSS interface is never combined with another one.
Reported-by: Luka Gejak <luka.gejak@linux.dev>
Closes: https://lore.kernel.org/linux-wireless/1D396970-35B7-4B0B-82E9-24B523AD69C2@linux.dev/
Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
---
Notes:
v2:
- write the interval for an AP or IBSS interface only (Ping-Ke)
- Luka's Reviewed-by not carried, the condition changed
- rebased on rtw-next fb51e39dfaea
Tested on rtw-next on an RTL8822CE, RTL8822CU, RTL8822BU and RTL8821CU
as AP with hostapd, the beacons sniffed from a second machine: with
beacon_int 50, 100 and 200 they are 51.2, 102.4 and 204.8 ms apart on
the air. As IBSS on the RTL8822CE and RTL8822BU, joined with a beacon
interval of 50 and 200, the TSF of their beacons shows them 50 and 200
TU apart. AP, association, power save, firmware crash and scan tests on
the RTL8822BU and RTL8821CU on both bands gave no new kernel report.
v1: https://lore.kernel.org/r/20261116072022.1142783-1-mehmet.fide@gmail.com/
drivers/net/wireless/realtek/rtw88/mac80211.c | 5 +++++
drivers/net/wireless/realtek/rtw88/reg.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 5e40cf06a9e3..26bc4a9913be 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -432,6 +432,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
if (changed & BSS_CHANGED_BEACON_INT) {
if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_STATION)
coex_stat->wl_beacon_interval = conf->beacon_int;
+ else if ((vif->type == NL80211_IFTYPE_AP ||
+ vif->type == NL80211_IFTYPE_ADHOC) &&
+ rtwvif->port == RTW_PORT_0)
+ rtw_write16(rtwdev, REG_MBSSID_BCN_SPACE,
+ conf->beacon_int);
}
if (changed & BSS_CHANGED_BEACON) {
diff --git a/drivers/net/wireless/realtek/rtw88/reg.h b/drivers/net/wireless/realtek/rtw88/reg.h
index afcdb66fdb9a..877b82640e91 100644
--- a/drivers/net/wireless/realtek/rtw88/reg.h
+++ b/drivers/net/wireless/realtek/rtw88/reg.h
@@ -498,6 +498,7 @@
#define BIT_EN_BCN_FUNCTION BIT(3)
#define BIT_EN_TXBCN_RPT BIT(2)
#define REG_BCN_CTRL_CLINT0 0x0551
+#define REG_MBSSID_BCN_SPACE 0x0554
#define REG_DRVERLYINT 0x0558
#define REG_BCNDMATIM 0x0559
#define REG_ATIMWND 0x055A
base-commit: fb51e39dfaea5b5990e783e53c657534a37987d6
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH rtw-next v2] wifi: rtw88: program the beacon interval
2026-11-17 10:14 [PATCH rtw-next v2] wifi: rtw88: program the beacon interval Mehmet Fide
@ 2026-11-17 12:30 ` Luka Gejak
0 siblings, 0 replies; 2+ messages in thread
From: Luka Gejak @ 2026-11-17 12:30 UTC (permalink / raw)
To: Mehmet Fide, Ping-Ke Shih
Cc: Bitterblue Smith, Yan-Hsuan Chuang, Kalle Valo,
Stanislaw Gruszka, Brian Norris, linux-wireless, linux-kernel,
mehmet.fide
On November 17, 2026 11:14:19 AM GMT+01:00, Mehmet Fide
<mehmet.fide@gmail.com> wrote:
>From: Mehmet Fide <mehmet.fide@screeningeagle.com>
>
>The driver never writes the beacon interval register, so the hardware
>keeps its default of 100 TU. An AP or IBSS started with another
>interval says that interval in its beacons and sends them 100 TU apart.
>
>With beacon_int=200 in hostapd the beacons of an RTL8822CE, RTL8822CU,
>RTL8822BU and RTL8821CU are 102.4 ms apart on the air. The same holds
>for an IBSS joined with a beacon interval of 200 on an RTL8822CE and
>RTL8822BU.
>
>Write the interval when mac80211 sets it for an AP or IBSS interface.
>Both beacon from port 0: rtw_core_port_switch() moves an AP there, and
>an IBSS interface is never combined with another one.
>
>Reported-by: Luka Gejak <luka.gejak@linux.dev>
>Closes: https://lore.kernel.org/linux-wireless/1D396970-35B7-4B0B-82E9-24B523AD69C2@linux.dev/
>Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
>Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
>---
>
>Notes:
> v2:
> - write the interval for an AP or IBSS interface only (Ping-Ke)
> - Luka's Reviewed-by not carried, the condition changed
> - rebased on rtw-next fb51e39dfaea
>
> Tested on rtw-next on an RTL8822CE, RTL8822CU, RTL8822BU and RTL8821CU
> as AP with hostapd, the beacons sniffed from a second machine: with
> beacon_int 50, 100 and 200 they are 51.2, 102.4 and 204.8 ms apart on
> the air. As IBSS on the RTL8822CE and RTL8822BU, joined with a beacon
> interval of 50 and 200, the TSF of their beacons shows them 50 and 200
> TU apart. AP, association, power save, firmware crash and scan tests on
> the RTL8822BU and RTL8821CU on both bands gave no new kernel report.
>
> v1: https://lore.kernel.org/r/20261116072022.1142783-1-mehmet.fide@gmail.com/
>
> drivers/net/wireless/realtek/rtw88/mac80211.c | 5 +++++
> drivers/net/wireless/realtek/rtw88/reg.h | 1 +
> 2 files changed, 6 insertions(+)
>
>diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
>index 5e40cf06a9e3..26bc4a9913be 100644
>--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
>+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
>@@ -432,6 +432,11 @@ static void rtw_ops_bss_info_changed(struct ieee80211_hw *hw,
> if (changed & BSS_CHANGED_BEACON_INT) {
> if (ieee80211_vif_type_p2p(vif) == NL80211_IFTYPE_STATION)
> coex_stat->wl_beacon_interval = conf->beacon_int;
>+ else if ((vif->type == NL80211_IFTYPE_AP ||
>+ vif->type == NL80211_IFTYPE_ADHOC) &&
>+ rtwvif->port == RTW_PORT_0)
>+ rtw_write16(rtwdev, REG_MBSSID_BCN_SPACE,
>+ conf->beacon_int);
> }
>
> if (changed & BSS_CHANGED_BEACON) {
[ ... ]
As far as I can see this is the same as v1 just expressed explicitly.
Either way I am fine with it.
Reviewed-by: Luka Gejak <luka.gejak@linux.dev>
Best regards,
Luka Gejak
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-17 12:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 10:14 [PATCH rtw-next v2] wifi: rtw88: program the beacon interval Mehmet Fide
2026-11-17 12:30 ` Luka Gejak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®