linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero
@ 2025-11-25 18:09 Roman Peshkichev
  2025-11-26  0:33 ` Ping-Ke Shih
  2025-12-23  3:31 ` Ping-Ke Shih
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Peshkichev @ 2025-11-25 18:09 UTC (permalink / raw)
  To: linux-wireless; +Cc: pkshih

The function rtw_set_dtim_period() accepted an 'int' dtim_period parameter,
while mac80211 provides dtim_period as 'u8' in struct ieee80211_bss_conf.
In IBSS (ad-hoc) mode mac80211 may set dtim_period to 0.

The driver unconditionally wrote (dtim_period - 1) to REG_DTIM_COUNTER_ROOT,
which resulted in 0xFF when dtim_period was 0. This caused delays in
broadcast/multicast traffic processing and issues with ad-hoc operation.

Convert the function parameter to u8 to match ieee80211_bss_conf and avoid
the underflow by writing 0 when dtim_period is 0.

Link: https://github.com/lwfinger/rtw88/issues/406
Signed-off-by: Roman Peshkichev <roman.peshkichev@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/main.c | 4 ++--
 drivers/net/wireless/realtek/rtw88/main.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c
index fa0ed39cb..361ce0d40 100644
--- a/drivers/net/wireless/realtek/rtw88/main.c
+++ b/drivers/net/wireless/realtek/rtw88/main.c
@@ -730,10 +730,10 @@ void rtw_set_rx_freq_band(struct rtw_rx_pkt_stat *pkt_stat, u8 channel)
 }
 EXPORT_SYMBOL(rtw_set_rx_freq_band);
 
-void rtw_set_dtim_period(struct rtw_dev *rtwdev, int dtim_period)
+void rtw_set_dtim_period(struct rtw_dev *rtwdev, u8 dtim_period)
 {
 	rtw_write32_set(rtwdev, REG_TCR, BIT_TCR_UPDATE_TIMIE);
-	rtw_write8(rtwdev, REG_DTIM_COUNTER_ROOT, dtim_period - 1);
+	rtw_write8(rtwdev, REG_DTIM_COUNTER_ROOT, dtim_period ? dtim_period - 1 : 0);
 }
 
 void rtw_update_channel(struct rtw_dev *rtwdev, u8 center_channel,
diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h
index 43ed6d6b4..1ab70214c 100644
--- a/drivers/net/wireless/realtek/rtw88/main.h
+++ b/drivers/net/wireless/realtek/rtw88/main.h
@@ -2226,7 +2226,7 @@ enum nl80211_band rtw_hw_to_nl80211_band(enum rtw_supported_band hw_band)
 }
 
 void rtw_set_rx_freq_band(struct rtw_rx_pkt_stat *pkt_stat, u8 channel);
-void rtw_set_dtim_period(struct rtw_dev *rtwdev, int dtim_period);
+void rtw_set_dtim_period(struct rtw_dev *rtwdev, u8 dtim_period);
 void rtw_get_channel_params(struct cfg80211_chan_def *chandef,
 			    struct rtw_channel_params *ch_param);
 bool check_hw_ready(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 target);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero
  2025-11-25 18:09 [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero Roman Peshkichev
@ 2025-11-26  0:33 ` Ping-Ke Shih
  2025-12-23  3:31 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-11-26  0:33 UTC (permalink / raw)
  To: Roman Peshkichev, linux-wireless@vger.kernel.org

Roman Peshkichev <roman.peshkichev@gmail.com> wrote:
> The function rtw_set_dtim_period() accepted an 'int' dtim_period parameter,
> while mac80211 provides dtim_period as 'u8' in struct ieee80211_bss_conf.
> In IBSS (ad-hoc) mode mac80211 may set dtim_period to 0.
> 
> The driver unconditionally wrote (dtim_period - 1) to REG_DTIM_COUNTER_ROOT,
> which resulted in 0xFF when dtim_period was 0. This caused delays in
> broadcast/multicast traffic processing and issues with ad-hoc operation.
> 
> Convert the function parameter to u8 to match ieee80211_bss_conf and avoid
> the underflow by writing 0 when dtim_period is 0.
> 
> Link: https://github.com/lwfinger/rtw88/issues/406
> Signed-off-by: Roman Peshkichev <roman.peshkichev@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero
  2025-11-25 18:09 [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero Roman Peshkichev
  2025-11-26  0:33 ` Ping-Ke Shih
@ 2025-12-23  3:31 ` Ping-Ke Shih
  1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-12-23  3:31 UTC (permalink / raw)
  To: Roman Peshkichev, linux-wireless; +Cc: pkshih

Roman Peshkichev <roman.peshkichev@gmail.com> wrote:

> The function rtw_set_dtim_period() accepted an 'int' dtim_period parameter,
> while mac80211 provides dtim_period as 'u8' in struct ieee80211_bss_conf.
> In IBSS (ad-hoc) mode mac80211 may set dtim_period to 0.
> 
> The driver unconditionally wrote (dtim_period - 1) to REG_DTIM_COUNTER_ROOT,
> which resulted in 0xFF when dtim_period was 0. This caused delays in
> broadcast/multicast traffic processing and issues with ad-hoc operation.
> 
> Convert the function parameter to u8 to match ieee80211_bss_conf and avoid
> the underflow by writing 0 when dtim_period is 0.
> 
> Link: https://github.com/lwfinger/rtw88/issues/406
> Signed-off-by: Roman Peshkichev <roman.peshkichev@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

9f68fdcdc9db wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero

---
https://github.com/pkshih/rtw.git


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-23  3:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-25 18:09 [PATCH] wifi: rtw88: fix DTIM period handling when conf->dtim_period is zero Roman Peshkichev
2025-11-26  0:33 ` Ping-Ke Shih
2025-12-23  3:31 ` Ping-Ke Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).